Home / Docs / Codex CLI

Codex CLI

Run OpenAI's Codex CLI and the Codex IDE extension against the gateway, with GPT or Claude models.

Codex reads ~/.codex/config.toml, shared by the CLI, codex exec and the IDE extension. Add a provider that points at the gateway. Current Codex versions speak only the Responses API.

export GATEWAY_API_KEY="sk-your-key"   "c"># from a group that serves the model you want

Config file

"c"># ~/.codex/config.toml
model_provider = "gateway"
model = "gpt-6-astra"

[model_providers.gateway]
name = "API gateway"
base_url = "https://claudeapikey.dev/v1"
env_key = "GATEWAY_API_KEY"
wire_api = "responses"
supports_websockets = false

Claude ids such as claude-sonnet-5 work with the same provider when the key belongs to a Claude group: the gateway translates Responses API calls. A key reaches only the models of its own group.

wire_api = "chat" from older guides is no longer accepted: Codex supports only responses. A custom provider id also cannot be openai, ollama or lmstudio.