Skip to content

Codex CLI

Codex CLI uses the OpenAI-compatible API. With QuotaAPI, set the Base URL to https://quotarouter.ai/v1 and authenticate with a Bearer token.

Environment variables

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

If your tool expects OPENAI_API_BASE, set it to the same URL:

bash
export OPENAI_API_BASE="https://quotarouter.ai/v1"

First confirm that models are reachable:

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

Then send a Chat Completions request:

bash
curl https://quotarouter.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      { "role": "user", "content": "Return a short Codex CLI test response." }
    ],
    "max_tokens": 80
  }'

Responses API

Clients that support Responses can call /v1/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": "Write one sentence about QuotaAPI.",
    "max_output_tokens": 80
  }'

Some reasoning models consume reasoning tokens before producing visible output. To avoid upstream rejection for an output limit that is too low, use 16 or more for max_output_tokens or max_completion_tokens.

Model names

Common GPT / OpenAI-style model examples:

ModelGood for
gpt-5.5General reasoning, coding and multi-step tasks
gpt-5.5-miniFast Q&A, lightweight coding help and lower-cost tasks

Actual availability depends on the console group. If a group is named Codex but uses the OpenAI-compatible protocol, configure it as an OpenAI-compatible client with https://quotarouter.ai/v1.

Troubleshooting

  • OPENAI_BASE_URL is ignored: check whether the client reads OPENAI_API_BASE or its own config file.
  • 401: verify the Bearer token and remove extra spaces.
  • 400: check model name, request body and token fields.
  • 403: the API Key does not have access to the target OpenAI / GPT group.

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