Skip to main content

list_codex_models

Function list_codex_models 

Source
pub fn list_codex_models() -> Vec<String>
Expand description

Returns the list of models accepted by Codex with ChatGPT Pro OAuth.

Tries to read ~/.codex/models_cache.json (which the official CLI refreshes on every login) and falls back to the static CODEX_PRO_OAUTH_MODELS constant when the file is missing or malformed. The returned Vec<String> is the union of both sources, de-duplicated.

The official cache file is an object with the shape {"fetched_at": "...", "etag": "...", "client_version": "...", "models": [{"slug": "gpt-5.5", ...}, ...]} (v1.0.81 fix: previously we iterated obj.keys() which produced bogus entries like client_version and etag as “models”; now we extract only the models array).