You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ocx opencode: catalog fetch needs admin token but sends data-plane key — always 401 on forwarded endpoints #401
ocx opencode (any subcommand that builds the runtime provider config) fails with:
❌ Could not fetch the model catalog from the proxy: opencodex admin token required
Observed on a host where the proxy runs as a forwarded/remote endpoint (Docker container, live.pid === null), client + server on 1.5.8.
Root cause
fetchOpencodeProxyModels() in src/cli/opencode.ts calls GET {proxy}/api/models with header X-OpenCodex-API-Key: <apiKey> where apiKey = opencodeApiKey(config, env) — i.e. OPENCODEX_API_AUTH_TOKEN → service-api-token file → config.apiKeys[0] fallback. But /api/models is a management route: management-auth.ts only accepts a validated admin token (admin-api-token / ocx_admin_*) or GUI session — the service/data-plane token is rejected with 401.
So one credential is used for two trust planes:
/api/models fetch → needs admin token
OPENCODEX_OPENCODE_API_KEY baked into the opencode provider block for /v1/* calls → needs service token (admin token is 401 there)
Whichever single token opencodeApiKey returns, one side fails. Verified on a live 1.5.8 proxy:
Mirror src/cli/droid.ts, which uses configuredAdminToken() for the management fetch and explicitly keeps it separate from the data-plane credential ("Never substitute a management/admin token for a data-plane credential").
Suggested fix: in fetchOpencodeProxyModels, send the admin token (env OPENCODEX_ADMIN_AUTH_TOKEN or admin-api-token via configuredAdminToken()) on X-OpenCodex-API-Key/Authorization, while OPENCODEX_OPENCODE_API_KEY keeps resolving to the service/api key for the child process.
Repro
Run proxy (service token in service-api-token, admin token in admin-api-token).
Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.
This issue does not use a recognized issue template.
Please edit the issue to add:
Open a new issue with the Bug report, Feature request, Documentation, or Provider compatibility template.
Or edit this issue so the body uses the template section headings for the kind of report you are filing.
Activity
github-actions commentedon Oct 24, 2026
Issue closed: use an issue template
Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.
Please edit the issue to add:
See the README for details.
Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.
github-actions commentedon Oct 24, 2026
Automated translation bookkeeping — detected language: unknown.