guide

Fix Codex and Claude Code API Errors: 401, 429 and More

Start by identifying where a failure occurred: local configuration, gateway authentication, model selection, usage limits or an upstream response. Keep the exact error, UTC time and request reference, and retry only when the cause is likely temporary.

A quick diagnosis order

  1. Record codex --version or claude --version, the requested model, selected key platform and timestamp.
  2. Check whether the client parsed its local configuration and selected the intended provider.
  3. Confirm the base URL and an active matching key, without printing its full value.
  4. Check available balance, plan status, model access and key limits in Console.
  5. Run a single small client smoke test and compare the matching usage record.

If no matching record appears, the request may have failed before authenticated gateway processing; that alone does not identify which network hop failed. If a record exists, keep its reference and error detail for support.

Common status codes and next actions

Diagnostic starting points, not an exhaustive error-code contract
SymptomWhat to checkRetry?
401 authenticationFull key instead of a masked preview, active status, correct key platform, correct credential source and header. Rotate a leaked key.After correcting credentials.
403 access deniedClient/channel restrictions, workspace policy and requested feature. Read the response body; do not try to bypass policy.After access is resolved.
400 / unknown modelExact model ID, available channel catalog, supported parameters, context size and stale client configuration.After correcting the request.
404 endpointBase path and protocol. Codex preset uses /v1; Claude Code preset uses the origin without that suffix.After correcting the path.
429 usage or rate limitError details, concurrency, key window limits, balance and reset time. A quota problem and temporary upstream saturation require different fixes.Respect Retry-After when present; avoid a retry storm.
502 / 503 / 504Temporary upstream/network availability, timeouts, and whether the request already produced output.Use a small bounded retry policy with backoff and jitter.
Timeout / interrupted streamClient network, corporate proxy, elapsed time and terminal completion event. Partial text is not a completed response.Inspect status and possible prior usage before resubmitting.

The JSON error message is more specific than an HTTP status alone. For example, several different rate and quota conditions can produce 429. Do not infer that adding credit will fix every 429, or that switching models fixes an invalid key.

Fix the common configuration traps

Codex

Put provider keys in the user config, keep top-level values before table headers, and avoid duplicate tables. Fully restart after changing authentication mode. The Codex guide includes a read-only smoke command. If an existing task behaves differently from a new task, recheck the generated preset and client version.

Claude Code

Run from the terminal where variables are set, and inspect /status. User or managed settings can override shell configuration. A dock-launched editor may not inherit exports. The Claude Code guide shows all three common shell formats.

Do not disable TLS verification, remove sandbox protections, change proxy policy or expose your API key in a URL as a workaround for an authentication error.

Send enough evidence for support

Redacted support template
Client and version:
Operating system / shell:
UTC time of failure:
Gateway hostname and client preset:
Model ID:
HTTP status and exact error code/message:
Request reference, if available:
Does the small smoke test fail too?
Did any output arrive before failure?

Send this to support@superfastai.org. Remove Authorization headers, keys, cookies, personal data, prompts and proprietary code unless a specific, appropriate support process requires them. Provide a minimal non-sensitive reproduction when possible.

Ready for a small test?

Review the matching client guide, create a gateway key, and verify one completed request before starting a larger task.

Open API Keys