# Connect Codex CLI

https://omnimodel.me/apps/codex

> 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](/catalog?lang=en); rewritten calls show the rewrite in usage records.

## If it cannot connect

1. Set `base_url` to `https://omnimodel.me/v1`, without `/responses`.
2. The key starts with `key_` and is not paused or revoked; `auth.invalid_key` means the key cannot be used.
3. The model ID matches the [catalog](/catalog) and is in the key's allowed models.
4. `billing.insufficient_credit` means the balance is too low; see [common errors](/docs/errors?lang=en) for more.

## Setup

1. Install: npm install -g @openai/codex.
2. Export the key in your shell profile: export A2AGENT_API_KEY=<the API key above>.
3. 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.

```toml
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.

