Skip to content

Codex CLI Setup

The recommended Codex CLI setup uses ~/.codex/config.toml and ~/.codex/auth.json. The QuotaAPI console generates the same file structure from the Use Key dialog.

See the Codex CLI integration overview for supported workflows and compatibility notes.

Prerequisites

  1. Create a Key on the API Keys page.
  2. Bind the Key to the group that exposes the model you intend to use.
  3. Responses is not supported for DeepSeek groups; use a Chat Completions client for those groups.

Configure config.toml

Use ~/.codex/config.toml on macOS and Linux, or %userprofile%\.codex\config.toml on Windows:

toml
model_provider = "OpenAI"
model = "gpt-5.5"
review_model = "gpt-5.5"
model_reasoning_effort = "xhigh"
disable_response_storage = true

[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://quotarouter.ai"
wire_api = "responses"
requires_openai_auth = true

The model names are examples. Use models currently exposed by the group bound to your Key.

Configure auth.json

Use ~/.codex/auth.json on macOS and Linux, or %userprofile%\.codex\auth.json on Windows:

json
{
  "OPENAI_API_KEY": "YOUR_QUOTAAPI_KEY"
}

WARNING

auth.json contains a credential. Do not commit it to Git or expose it in screenshots and support tickets.

Verify models and Responses

Codex refreshes its picker with a model request that includes client_version. You can verify the same route first:

bash
curl "https://quotarouter.ai/v1/models?client_version=1.0.0" \
  -H "Authorization: Bearer YOUR_QUOTAAPI_KEY"

Then verify Responses:

bash
curl https://quotarouter.ai/v1/responses \
  -H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "input": "Return one short Codex test sentence.",
    "max_output_tokens": 80
  }'

Reasoning models may consume reasoning tokens before visible output. Use a practical max_output_tokens value for real tasks.

Environment-variable compatibility

Use this only for older tools that explicitly read environment variables:

bash
export OPENAI_BASE_URL="https://quotarouter.ai/v1"
export OPENAI_API_KEY="YOUR_QUOTAAPI_KEY"

Codex CLI should use the two files above as its primary configuration so client upgrades do not silently ignore environment variables.

Common errors

  • 401: verify that the Key in auth.json is complete and enabled.
  • 404: check for a duplicated /v1/v1 path or a group that does not support Responses.
  • Empty model picker: verify the Key, group, and model mapping with the model-list request.
  • WebSocket connection failure: Responses WebSocket is available only for OpenAI/Grok-compatible targets.
  • Changes do not apply: fully quit and restart Codex CLI.

QuotaAPI is an AI API relay service for developers and teams.