Connect Codex CLI
OpenAI's terminal coding agent, connected over the Responses API.
Use cases
Good for letting an agent read your project, edit files and run tests from the terminal. Codex CLI uses the Responses API (wire_api = "responses") and reads the key from an environment variable instead of the config file.
Tips
A coding agent sends many long requests per task, so pick a long-context model with tool calling and set a daily spend limit on the key.
Reasoning effort
Codex CLI sends model_reasoning_effort from config.toml as reasoning.effort. The platform follows the levels the serving line accepts: a level the upstream rejects becomes the next higher accepted level, or its highest one. If the model cannot turn reasoning off, asking for it returns 422 model.reasoning_off_unsupported. Each model's table is under Reasoning effort on its page in the catalog; rewritten calls show the rewrite in usage records.
If it cannot connect
- Set
base_urltohttps://omnimodel.me/v1, without/responses. - The key starts with
key_and is not paused or revoked;auth.invalid_keymeans the key cannot be used. - The model ID matches the catalog and is in the key's allowed models.
billing.insufficient_creditmeans the balance is too low; see common errors for more.
Setup
- Install: npm install -g @openai/codex.
- Export the key in your shell profile: export A2AGENT_API_KEY=.
- Put the block below at the top of ~/.codex/config.toml, then run codex in your project.
Settings
- API host:
https://omnimodel.me/v1 - API key:
YOUR_API_KEY - Model:
MODEL_ID
Compatibility testing for Codex CLI is still in progress; if something breaks, open a ticket with the request ID.
model = "MODEL_ID"
model_provider = "a2agent"
[model_providers.a2agent]
name = "A2Agent"
base_url = "https://omnimodel.me/v1"
env_key = "A2AGENT_API_KEY"
wire_api = "responses"
FAQ
- Why must model and model_provider sit at the top of the file?
- In TOML, keys written after a table header belong to that table. Only at the top are they top-level settings that Codex reads.
- Can I put the key in config.toml?
- Better not. env_key makes Codex read the key from an environment variable, so the config file is safe to sync or back up.