Skip to content

feat(codex): extend the model allowlist from the Codex CLI's model cache - #130

Open
GiulianoCosta71 wants to merge 1 commit into
raine:mainfrom
GiulianoCosta71:codex-model-catalog
Open

feat(codex): extend the model allowlist from the Codex CLI's model cache#130
GiulianoCosta71 wants to merge 1 commit into
raine:mainfrom
GiulianoCosta71:codex-model-catalog

Conversation

@GiulianoCosta71

Copy link
Copy Markdown

Why

Every new Codex model currently needs a code change plus a release before the proxy accepts it (#129 for gpt-6-astra, #113/#114 for gpt-daybreak-blue). Meanwhile the Codex CLI already knows the model: it keeps ~/.codex/models_cache.json fresh from the server, including supported_in_api, use_responses_lite and visibility per model.

What

Read that cache at runtime ($CODEX_HOME/models_cache.json, default ~/.codex/) and treat it as an extension of the static allowlist:

  • is_allowed_model / assert_allowed_model accept catalog models with supported_in_api.
  • uses_responses_lite honours the catalog's use_responses_lite, so a new Lite-lane model is not sent down the full Responses API.
  • -fast aliases, models --full, the unknown-model hint and registry routing (expand_codex_models) include catalog models with visibility == "list".

The static lists remain the baseline for machines without a cache. The file is parsed leniently per model entry and cached by (mtime, len); an unreadable file keeps the last good parse.

Verification

  • cargo test (864 + integration suites) green, cargo fmt --check and cargo clippy --all-targets -- -D warnings clean.
  • Manual: with a cache entry gpt-7-test (supported_in_api: true) the binary lists gpt-7-test and gpt-7-test-fast and routes requests to Codex without any code change; an entry with supported_in_api: false stays rejected.
  • Live: gpt-6-astra requests through the patched binary against the Codex backend (Subscription/OAuth) succeed, including a 905k-token input.

The Codex CLI keeps `~/.codex/models_cache.json` fresh from the server, so
new models (gpt-6-astra on 2026-09-04, for example) appear there the moment
OpenAI ships them — but the proxy only accepted models compiled into
`ALLOWED_MODELS`/`CODEX_MODELS`, and every new model needed a code change
plus a release (raine#129 for gpt-6-astra).

Read the cache at runtime (`$CODEX_HOME/models_cache.json`, default
`~/.codex/`) and treat it as an extension of the static allowlist:

- `is_allowed_model`/`assert_allowed_model` accept catalog models with
  `supported_in_api`.
- `uses_responses_lite` honours the catalog's `use_responses_lite` flag,
  so a new Lite-lane model is not sent down the full Responses API.
- `-fast` aliases, `models --full`, the unknown-model hint and the registry
  routing (`expand_codex_models`) include catalog models with
  `visibility == "list"`.

The static lists stay as the baseline for machines without a cache. The
file is parsed leniently per model entry and cached by (mtime, len); an
unreadable file keeps the last good parse.

Verified locally: with a cache entry `gpt-7-test` the binary lists
`gpt-7-test` and `gpt-7-test-fast` without any code change.
GiulianoCosta71 pushed a commit to RankM8/WhisperM8 that referenced this pull request Sep 6, 2026
…etriebener Allowlist

Der claude-code-proxy führt seine Modell-Allowlist einkompiliert; jedes
neue Codex-Modell brauchte upstream einen Code-Merge plus ein Release,
das erfahrungsgemäß Wochen nach dem Merge kommt (gpt-6-astra: Merge am
2026-09-04, kein Release). Damit hätte die katalog-getriebene
WhisperM8-Seite neue Modelle angeboten, die der Proxy ablehnt.

Der Fork GiulianoCosta71/claude-code-proxy liest den Codex-Modellcache
(~/.codex/models_cache.json) zur Laufzeit und akzeptiert jedes dort
API-fähige Modell zusätzlich zur statischen Liste — derselbe Patch ist
upstream als raine/claude-code-proxy#130 eingereicht. Release
v0.1.36-whisperm8.1 = Upstream 0.1.35 + main@55bf0b58 + Patch.

- Installer zeigt auf den Fork; known-good 0.1.36-whisperm8.1 mit
  SHA-256-Pins aus den Release-Sidecars (arm64 lokal gegengeprüft).
- Versionsvergleich verträgt das Prerelease-Suffix (numerische Teile
  zählen), abgesichert per Test.

Rückweg: sobald #130 upstream gemerged und released ist, `repository`
wieder auf raine/claude-code-proxy und die Pins auf das Upstream-Release.
@Getty

Getty commented Sep 8, 2026

Copy link
Copy Markdown

Good that this patch exists. Just bought OpenAI Pro subscription to use astra with claude code proxy and was a bit confused that i didnt got it! :D haha Thanks!

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.

2 participants