Add a cli command like `codex models` to print available models
Open 💬 3 comments Opened May 18, 2026 by WingT
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What variant of Codex are you using?
cli
What feature would you like to see?
Add a cli command like codex models to print available models
Additional information
_No response_
3 Comments
Can you provide more details about the problem you want to solve? What is the use case?
There is already a way to do this through the app server API. It requires a bit more scripting, but codex can write that script for you.
Expose available models through a supported CLI command (
codex models/codex list-models)Summary
Please add a supported, non-interactive CLI command that prints the effective model list Codex would use for the current config, auth mode, provider, and profile.
Suggested shape:
This should be a first-class CLI surface over the same model-discovery path already used by the app server, TUI, and desktop surfaces, not a separate hard-coded list.
Why this is needed
Codex already accepts model overrides through
--model, but the CLI does not provide a supported way to discover which values are valid for the user's current account, provider, profile, and local catalog. Incodex-cli 0.137.0, bothcodex help modelsandcodex help list-modelsreturnunrecognized subcommand.There is an existing request for this exact feature in #23279, and an earlier request in #8871. The maintainer response in both threads points users toward the app-server
model/listAPI, but that leaves a gap for CLI users and third-party integrations:codex exec.This is especially painful because model availability in Codex is no longer a static OpenAI-only list. It depends on provider, auth mode, account entitlement, rollout state, model catalog source, local config, cached remote data, and sometimes the specific app surface.
Evidence from related issues and PRs
There is already user demand for a CLI-visible model list:
codex models.codex exec --model <model>, without asking for the user's API key.--modelvalue is provided.There have also been implementation attempts or internal building blocks:
list-modelssubcommand for the Rust CLI.--list-modelsflag with available models and reasoning efforts.app_server.list_modelsnon-blocking.That history suggests the hard part, model discovery itself, already exists in Codex. The missing piece is a stable CLI interface for the same effective model list.
Recent bugs also show why this is not only a convenience feature:
gpt-5.5was locally listed or selectable but actual Codex requests failed with404 Model not found.codex_models_managerrefresh errors on stderr duringcodex exec, creating noise for host integrations.--oss/ custom model metadata can be present in cache but not loaded at turn setup.A CLI command would give users, integration authors, and maintainers a shared diagnostic question:
Proposed behavior
codex modelsshould print the effective model list for the same config resolution thatcodex execwould use.For human output, it could include:
model_catalog_json, or provider endpointFor automation,
codex models --jsonshould expose the same data in a stable schema.Example:
Example JSON shape:
The exact schema can be adjusted to match existing app-server
model/listtypes, but the important part is that it is documented and stable enough for tools to consume.Acceptance criteria
codex modelsworks without launching the TUI or starting a prompt.codex models --jsonprovides machine-readable output suitable for editor integrations and CI/host tooling.codex exec.Why the app-server workaround is not enough
The app-server
model/listAPI is useful, but it is not a replacement for a CLI command. A user who can run:should also be able to run:
to discover valid
<model>values under the same resolved config. This is the same level of discoverability users expect from command-line tools with named runtime targets, and it would reduce repeated issues caused by model picker mismatches, stale local catalogs, custom-provider confusion, and backend availability drift.