
In Codex, API errors arrive in the OpenAI format, because Codex uses the Responses format. What matters is the code field: it is the same code our API uses everywhere.
What an error looks like
The error comes inside an error object, with four fields:
| Field | What it is |
| message | Text for people. It can change: do not compare against it. |
| type | The error type, in the OpenAI style. |
| param | The request field with the problem, when it applies. |
| code | The stable code, such as unauthorized or insufficient_credits. This is the one to read. |
The codes you see most
| Status | code | What to do |
| 401 | unauthorized | The key is missing or wrong, or Codex did not read the env_key variable. Open a new terminal and start Codex again. |
| 402 | insufficient_credits | The credits do not cover the reservation. Nothing was charged. Buy credits. |
| 403 | insufficient_scope | The key does not have ai:write. Create one with ai:read and ai:write. |
| 403 | account_* | The All in One AI account is not active. Open All in One AI and check the account status. |
| 404 | model_not_found | The model id is wrong or incomplete. Use the id with the slash, as it comes in GET /v1/models. |
| 404 | not_found | base_url is wrong, nearly always missing /v1 at the end. |
| 429 | plan_limit_reached | The plan points ran out and the request cannot be paid with credits. Wait for the reset or turn on "Use credits when the plan runs out". |
| 429 | rate_limited | Too many requests per minute with this key. Wait the seconds in Retry-After. |
| 502 | upstream_error | The AI service did not respond as expected. Try again shortly or choose another model. |
Codex retries on its own
According to the Codex documentation, the provider retries HTTP requests up to 4 times (request_max_retries) and resumes answers cut off midway up to 5 times (stream_max_retries). You can change these values in the provider block:
[model_providers.api]
# ... the lines you already have ...
request_max_retries = 4
stream_max_retries = 5
The same error in other tools
In Claude Code, the same errors arrive in the Anthropic format, with the same message. In other API requests, they come in the API's own format, with code, message, correlation_id and details. The code is always the same.
| The errors of each tool are gathered in errors when setting up a tool with All in One AI. |
|
Want to code with AI in Codex? Visit the Coding with AI page. See Coding with AI |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from $5.36/mo (3-year plan, with coupon) See plans |











