Skip to content

Fetch live TensorX catalog via refreshModels using the /login key - #1

Open
Marcuss2 wants to merge 1 commit into
czottmann:mainfrom
Marcuss2:fix/stale-fallback-catalog
Open

Fetch live TensorX catalog via refreshModels using the /login key#1
Marcuss2 wants to merge 1 commit into
czottmann:mainfrom
Marcuss2:fix/stale-fallback-catalog

Conversation

@Marcuss2

@Marcuss2 Marcuss2 commented Aug 8, 2026

Copy link
Copy Markdown

Problem

The tensorx provider 403s with TensorX's permission_error:

key not allowed to access model. This key can only access models=['public'].
Tried to access deepseek/deepseek-v4-flash

The key is fine — TensorX retired deepseek-v4-flash (renamed to deepseek-v4-flash-0731) and dropped several models. The extension only fetched the live /v1/model/info catalog when TENSORX_API_KEY was set in the environment; otherwise it registered a bundled snapshot. Because /login-stored keys are not handed to the extension factory, /login-authenticated users always got the snapshot — so once the snapshot aged, pi requested a retired id and TensorX rejected it.

Fix

Register a refreshModels callback instead of a factory-time env-only fetch. pi invokes refreshModels during model refresh and passes the effective credential — the /login-stored API key, falling back to TENSORX_API_KEY. The extension uses it to fetch the live catalog from GET /v1/model/info every refresh, so /login users always get current models with no snapshot maintenance.

The bundled snapshot is retained only as the initial/offline catalog (so TensorX still appears under /login → API Keys before a key is stored) and as a failure fallback. It's regenerated from the live endpoint (removes deepseek-v4-flash, -backup, deepseek-chat-v3*, meta-llama/*, gpt-oss-*, nemotron-*, GLM-4.x, etc.; adds deepseek-v4-flash-0731, kimi-k3).

Because refreshModels requires pi >= 0.81.0 (existing peerDependencies was "*"), the peer + dev ranges are bumped and the lockfile re-resolved so CI typecheck passes.

Verification

  • tsc --noEmit passes against @earendil-works/pi-coding-agent@0.83.0 (the version refreshModels was introduced) and latest.
  • Running the installed extension, pi invokes refreshModels with a credential present; the /login-keyed fetch resolves the current catalog including deepseek-v4-flash-0731.
  • GET /v1/model/info with the key returns the new model set; chat completions to deepseek-v4-flash-0731 return 200 while the retired id returns 403.

The provider previously only fetched GET /v1/model/info when TENSORX_API_KEY
was set in the environment, otherwise it relied on a bundled snapshot. pi does
not expose the /login-stored key directly, so /login-authenticated users were
stuck with the snapshot. When TensorX retired deepseek-v4-flash (renamed to
deepseek-v4-flash-0731) and dropped several models, pi requested a retired id
and TensorX returned 403 permission_error.

Register a refreshModels callback instead: pi invokes it on model refresh and
passes the effective credential (the /login-stored key, falling back to
TENSORX_API_KEY), so the live catalog is always fetched with an authenticated
key. The bundled snapshot now only serves as the initial/offline catalog so the
provider still appears under /login pre-auth, and as a fallback if the fetch
fails. The snapshot is regenerated from the live endpoint, dropping retired
models like deepseek-v4-flash.

refreshModels requires pi >= 0.81.0 (was "*"), so the peer dependency is
tightened and the dev dependency is bumped; this also re-resolves the lockfile.
@Marcuss2
Marcuss2 force-pushed the fix/stale-fallback-catalog branch from 72025a2 to 3733828 Compare August 8, 2026 16:56
@Marcuss2 Marcuss2 changed the title Refresh stale TensorX catalog snapshot (fixes 403 for retired deepseek-v4-flash) Fetch live TensorX catalog via refreshModels using the /login key Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant