Docs

Codex CLI

Codex speaks the Responses API and nothing else. One provider block in config.toml points it at Kunavo's native /v1/responses surface, with the key held in an environment variable rather than in the file.

A [model_providers.kunavo] block in ~/.codex/config.toml with env_key, so the key stays in the environment and never in the config file.

~/.codex/config.toml
model = "gpt-5-6-sol"
model_provider = "kunavo"

[model_providers.kunavo]
name = "Kunavo"
base_url = "https://api.kunavo.com/v1"
env_key = "KUNAVO_API_KEY"     # the NAME of the variable, not the key
# wire_api defaults to "responses", which is the only supported value
wire_api has exactly one legal value now: "responses", and it is the default when omitted. Chat Completions support was removed from Codex, so any older guide telling you to write wire_api = "chat" is stale — and any endpoint without a real /v1/responses route cannot be used from Codex at all. Kunavo implements it natively.
env_key holds the name of an environment variable, not the key itself. That is deliberate on OpenAI's side: config.toml is a file people commit and paste into issues.

Step by step

  1. Create a key at /app/keys and copy it — it is shown once.
  2. Add the block above to ~/.codex/config.toml, creating the file if it does not exist.
  3. Export the variable named by env_key: export KUNAVO_API_KEY=sk-kn-...
  4. Run codex. The top-level model_provider selects the block; model selects the id inside it.
  5. To switch model per session rather than editing the file, use codex -m <model id>, or keep several provider blocks and change model_provider.

Checked against the Codex config-file reference on September 6, 2026. Third-party settings move; if a field name here no longer matches what you see, that page is the authority, not this one.

This is the short version. The full walkthrough — model choice, what a real session costs, and the failure modes — is in the Codex CLI API key guide.

Verify before you debug the client

One request settles whether a failure is the endpoint, the key, or the configuration file. If this returns JSON, the same base URL and key work in Codex CLI.

# Settles whether a failure is the endpoint, the key, or the client.
curl -sS https://api.kunavo.com/v1/models \
  -H "Authorization: Bearer sk-kn-..."

Which model id to put in the field

Every text model is reachable as a model id — the live list is GET /v1/models, and the catalog with prices is on the models page. Rates are USD per 1M tokens, input / output.

Model idKunavo in / outWhere it fits in Codex CLI
gpt-5-6-sol$2.00 / $12.00the default Codex pairing — Responses-native, straight through
gpt-5-3-codex$0.70 / $5.60the code-specialised build, when the task is mostly editing
claude-sonnet-5$2.00 / $10.00a non-GPT model over Responses — translated at the gateway
claude-opus-5$2.00 / $10.00planning passes where the reasoning depth is worth the rate
Billing is per token from a prepaid balance with no monthly fee — see billing. On repeated context — which is most of what an editor or a chat client sends — prompt caching moves the bill more than the model choice does.

FAQ

How do I point Codex CLI at a custom API endpoint?

Add a [model_providers.<id>] table to ~/.codex/config.toml with name, base_url and env_key, then set the top-level model_provider to that id and model to the id you want to run. base_url is the /v1 root of the service; env_key names the environment variable that holds the key, so the key never appears in the file itself.

What wire_api value does Codex CLI need?

"responses" — the config reference states it is the only supported value and the default when omitted. Codex removed Chat Completions support, so an endpoint that implements only /v1/chat/completions cannot be used from Codex regardless of configuration. The endpoint must serve a real /v1/responses route.

Can Codex CLI run Claude models?

Yes, if the endpoint exposes them on the Responses API. Codex sends a Responses-format request to whatever base_url names and passes the model id through, so a gateway that translates Responses to the model's own format can serve Claude or Gemini ids to Codex. Codex itself has no knowledge of which vendor answers.

Where does Codex CLI keep the API key?

In an environment variable named by the provider block's env_key field, not in config.toml. Codex reads the variable at startup, so the key lives in your shell profile or secret manager and the config file stays safe to commit and to paste into a bug report.