REQUEST TROUBLESHOOTING

AI API errors: 401, 429, 5xx and timeouts

Separate authentication, quota, rate limits and transient failures for OpenAI, Claude and Gemini APIs. Use error details before deciding to retry.

Quick answer

An API error does not by itself establish a provider outage. Read the provider’s error body and request ID, then check the matching status component. Authentication and billing problems need configuration changes; transient failures may justify limited retries.

Start with the error category

Use this table to choose a first check. Exact meanings and remedies depend on the provider, endpoint and error body.

What you seeFirst checkWhat it does not establish
400 / 404 / 413Request format, endpoint, resource and size; read the provider errorA general service outage
401 / 403Credentials, access permissions and provider-specific restrictionsThat all users are blocked
429Rate-limit headers, quota, credits and spend limitsThat retrying immediately will work
500 / 503 / 529Provider error details and the relevant official componentA confirmed global incident
Timeout / connection errorClient deadline, DNS, TLS, proxy and request durationWhich side caused the failure

OpenAI: a 429 can mean different limits

Inspect error.code, not just HTTP 429. OpenAI distinguishes request rate limits from exhausted credits and organization or project limits. Billing and quota failures will not be fixed by repeated retries. For transient rate limits or overload, honor Retry-After when present and limit retries.

Use the OpenAI API entry for API components. The ChatGPT application entry cannot confirm the result of an API request or the health of a specific GPT model.

Claude: overload and spend caps are different

Claude documents 529 as overload, 401 as authentication failure and 403 as permission failure. A 429 can reflect rate limits or a spend cap. A usage-tier spend-cap 429 has no Retry-After header and keeps failing until access resumes. Read the full error before selecting a retry policy.

For streaming responses, Claude documents that an error can occur after HTTP 200. Check stream completion and error events; receiving response headers alone does not establish a successful generation.

Claude returns 413 request_too_large when a request exceeds its endpoint limit: 32 MB for the Messages and Token Counting APIs, 256 MB for the Batch API and 500 MB for the Files API. For long-running requests, especially those over 10 minutes, Claude suggests considering the streaming Messages API or the Message Batches API; its 504 timeout_error means the request timed out while processing.

Gemini: verify the developer endpoint

Identify the Gemini API endpoint first. GenerateContent uses HTTP status and fields such as error.status (for example RESOURCE_EXHAUSTED); Interactions uses snake_case error.code values such as rate_limit_exceeded. Use the reference for that endpoint. The Gemini app feed cannot establish developer API or AI Studio availability.

For direct REST requests or custom retry logic, retry only failures identified as transient, with exponential backoff, jitter and a retry cap. A 429 caused by an exhausted daily quota or spend limit is not a reason to retry immediately. Errors such as 400, 402 and 403 require the documented request, billing or access checks.

Give retries a budget

As an application design choice, set both a maximum attempt count and a total time budget. Account for retries already performed by your SDK. Use a delay with exponential backoff and jitter for errors the provider identifies as transient, and respect applicable retry headers.

Before replaying an interrupted request, check whether it may already have produced output, a charge or a downstream action. Retrying a model request and repeating an agent’s tool action are separate decisions. Preserve request IDs for troubleshooting and stop automatic retries when the permitted budget is exhausted.

Official SDKs can retry before your code sees an error. Claude’s official SDKs retry connection errors, rate limits and 5xx server errors twice by default with exponential backoff and honor retry-after when present. Gemini’s Python SDK retries timeouts, network issues, 429 and 5xx responses up to four times, with an initial delay of about 1 second and a maximum delay of 60 seconds.

Troubleshoot a specific response

Use a dedicated guide for the error returned by your request. These pages explain request failures; they do not provide account-limit monitoring.

Related service pages

Each entry shows its own collection coverage. A linked service is not necessarily automatically collected.

Editorial review date applies to this guide. Live report collection times appear on the service pages.

Cookie preferences

With your permission, we use Google Analytics and Umami to understand service queries. These tools use cookies or browser storage. Optional analytics stay off until you accept.

Cookies and storage details