Client or integration
Other (the ocx opencode launcher for the OpenCode CLI)
Area
CLI
Summary
ocx opencode reads the model catalog from GET /api/models with the data-plane admission key. That route is part of the management API, which requireManagementAuth (src/server/management-auth.ts:539, gated at src/server/index.ts:1289) admits only with the admin credential. On a hardened install the proxy therefore answers 401 {"error":"opencodex admin token required"}, the launcher prints ❌ Could not fetch the model catalog from the proxy: … and returns 1, and OpenCode is never launched.
Verified against a live 2.51.0 proxy on 127.0.0.1:10100 with an admin-api-token present:
$ curl -s -o /dev/null -w '%{http_code}\n' -H 'X-OpenCodex-API-Key: <data-plane admission key>' http://127.0.0.1:10100/api/models
401
{"error":"opencodex admin token required"}
$ curl -s -o /dev/null -w '%{http_code}\n' -H 'X-OpenCodex-API-Key: <admin token from ~/.opencodex/admin-api-token>' http://127.0.0.1:10100/api/models
200
Every other headless management caller already sends the admin credential — runningProxyUpdateHeaders in src/oauth/login-cli.ts, src/cli/claude.ts, and the GUI. cmdOpencode is the outlier: it calls fetchOpencodeProxyModels(live, apiKey) where apiKey = opencodeApiKey(startupConfig) resolves the admission key that is handed to the child OpenCode process.
Expected: the launcher authenticates its one management read with the configured admin token, keeping the admission key for the child process (and as a fallback for a host that truly has no admin credential).
Reproduction
- Use a hardened install where
ocx start has minted ~/.opencodex/admin-api-token.
- With the proxy running, execute
ocx opencode.
- Observe
❌ Could not fetch the model catalog from the proxy: and exit code 1; OpenCode never starts.
Code path: src/cli/opencode.ts — const apiKey = opencodeApiKey(startupConfig); then fetchOpencodeProxyModels(live, apiKey).
The same request with the admin token returns 200 and the catalog, which is what the launcher needs.
Version
@bitkyc08/opencodex 2.51.0 installed; the call site is unchanged on dev at 7a0513c (2.52.0).
Operating system
macOS 26.6.2 arm64 (proxy on loopback, port 10100).
Provider and model
Not provider-specific. The failing request is the management catalog read performed by the ocx opencode launcher.
Logs or error output
$ ocx opencode
❌ Could not fetch the model catalog from the proxy: GET /api/models responded 401: {"error":"opencodex admin token required"}
Screenshots and supporting files
A fix with regression coverage is linked below as a pull request.
Checks
Client or integration
Other (the
ocx opencodelauncher for the OpenCode CLI)Area
CLI
Summary
ocx opencodereads the model catalog fromGET /api/modelswith the data-plane admission key. That route is part of the management API, whichrequireManagementAuth(src/server/management-auth.ts:539, gated atsrc/server/index.ts:1289) admits only with the admin credential. On a hardened install the proxy therefore answers401 {"error":"opencodex admin token required"}, the launcher prints❌ Could not fetch the model catalog from the proxy: …and returns 1, and OpenCode is never launched.Verified against a live 2.51.0 proxy on
127.0.0.1:10100with anadmin-api-tokenpresent:Every other headless management caller already sends the admin credential —
runningProxyUpdateHeadersinsrc/oauth/login-cli.ts,src/cli/claude.ts, and the GUI.cmdOpencodeis the outlier: it callsfetchOpencodeProxyModels(live, apiKey)whereapiKey = opencodeApiKey(startupConfig)resolves the admission key that is handed to the child OpenCode process.Expected: the launcher authenticates its one management read with the configured admin token, keeping the admission key for the child process (and as a fallback for a host that truly has no admin credential).
Reproduction
ocx starthas minted~/.opencodex/admin-api-token.ocx opencode.❌ Could not fetch the model catalog from the proxy:and exit code 1; OpenCode never starts.Code path:
src/cli/opencode.ts—const apiKey = opencodeApiKey(startupConfig);thenfetchOpencodeProxyModels(live, apiKey).The same request with the admin token returns 200 and the catalog, which is what the launcher needs.
Version
@bitkyc08/opencodex2.51.0 installed; the call site is unchanged ondevat7a0513c(2.52.0).Operating system
macOS 26.6.2 arm64 (proxy on loopback, port 10100).
Provider and model
Not provider-specific. The failing request is the management catalog read performed by the
ocx opencodelauncher.Logs or error output
$ ocx opencode ❌ Could not fetch the model catalog from the proxy: GET /api/models responded 401: {"error":"opencodex admin token required"}Screenshots and supporting files
A fix with regression coverage is linked below as a pull request.
Checks