Skip to content

Commit a279b9d

Browse files
anandgupta42claude
andcommitted
docs: record why the Codex model allowlist is static, not discovered
The obvious objection to the allowlist this PR corrects is that any static list drifts. There is an authoritative per-account endpoint that would let us derive it instead — `GET /backend-api/codex/models?client_version=<v>` — so I probed it rather than leave the objection unanswered. It works, and it accepts our own identity: `originator: altimate` plus our own User-Agent, no impersonation. Its `visibility: "list"` slugs are exactly the seven ids in `OAUTH_ALLOWED_MODELS`, which independently confirms the table built by request-level probing. It is still unusable as a runtime source of truth. `client_version` is mandatory and is gated against each model's `minimal_client_version`, today 0.98.0 through 0.144.0 — Codex CLI release numbers, a line we are not on. Our versions sit below all of them and the gate fails silently: our published `0.9.7` returns `HTTP 200 {"models":[]}`, and a dev build's `local` returns `400 {"detail":"Invalid client_version format"}`. Deriving the list would mean asserting a Codex CLI version we are not, so the list stays static. Comment-only; no behavior change. Records the endpoint, the corroboration, the blocker, and the drop-in shape should a legitimate client_version ever exist, so the next person does not repeat the investigation. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ
1 parent 71f25bd commit a279b9d

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎packages/opencode/src/plugin/codex.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ const OAUTH_POLLING_SAFETY_MARGIN_MS = 3000
3636
* endpoint above on a subscription credential; guessing puts a model in the
3737
* picker that then fails at request time.
3838
*
39+
* WHY THIS IS STATIC AND NOT DISCOVERED. There is an authoritative per-account
40+
* endpoint — ``GET https://chatgpt.com/backend-api/codex/models?client_version=<v>``
41+
* — and it accepts our own identity (``originator: altimate`` plus our
42+
* User-Agent; no impersonation needed) and returns exactly the set above, each
43+
* entry carrying ``slug``, ``visibility`` and ``minimal_client_version``. Its
44+
* ``visibility: "list"`` slugs corroborate this list precisely, which is why
45+
* that list is reproduced here rather than derived at runtime:
46+
*
47+
* ``client_version`` is mandatory (omitted or unparseable ⇒ HTTP 400) and is
48+
* gated against each model's ``minimal_client_version``, which today ranges
49+
* from 0.98.0 to 0.144.0. Those are Codex CLI release numbers, a numbering line
50+
* we are not on. Our own versions sit below all of them, and the gate fails
51+
* SILENTLY — ``client_version=0.9.7`` (our published version) returns
52+
* ``HTTP 200 {"models":[]}``, and a dev build's ``local`` returns
53+
* ``400 {"detail":"Invalid client_version format"}``. So discovery yields
54+
* nothing usable unless we assert a Codex CLI version we are not, which would
55+
* be impersonating the first-party client. We do not do that, so the list stays
56+
* static. If we ever have a legitimate client_version to send, the mechanism is
57+
* a small drop-in: fetch, keep ``visibility === "list"``, and fall back to this
58+
* set whenever the response is empty or the call fails.
59+
*
3960
* Exported for unit-test coverage — see test/plugin/codex-allowlist.test.ts. */
4061
export const OAUTH_ALLOWED_MODELS = new Set([
4162
"gpt-5.3-codex-spark",

0 commit comments

Comments
 (0)