Codex CLI
Connecting Codex CLI to the gateway through a provider in config.toml.
Codex CLI works through /v1/responses in the OpenAI Responses format.
For an overview and model pricing, see Codex CLI on llmbox.
Quick start
Codex reads the key from the environment variable named in env_key:
bash
export LLMBOX_API_KEY="your-key"
Add the provider to ~/.codex/config.toml (the llmbox provider name is
arbitrary — it lives only in your config):
toml
model_provider = "llmbox"
model = "openai/gpt-5.6-sol"
[model_providers.llmbox]
name = "llmbox"
base_url = "https://llmbox.cc/v1"
env_key = "LLMBOX_API_KEY"
wire_api = "responses"
Then run codex. Switch models with codex -m <id>; take IDs from the
model catalog, which also lists prices and specs for each model.
How it works
wire_api = "responses"— Codex sends requests to/v1/responses.- The gateway keeps no provider-side state (
store: false), and Codex sends the whole history with every request — exactly as needed. - Codex web search works on GPT models and is billed as input tokens — see
Web search. Codex's local tools (
shell,apply_patch) work.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
Missing environment variable: LLMBOX_API_KEY | The variable is not exported in this terminal — run the export from the quick start or add it to your shell profile. |
401 invalid_api_key | Wrong or revoked key. |
404 model_not_found | The model ID has a typo or the model is not a text model — check GET/v1/models. |
400 unsupported_parameter with previous_response_id | A provider-side state mode is on — it is not supported; Codex does not use it by default. |
| The stream breaks off midway | The provider failed after the response started — retry; see Streaming. |