AI APIs 49
Errors and limits you hit when calling the OpenAI, Claude and Gemini APIs directly — the exact error body, what it means, and what to change.
- Claude Opus 4.5 retires from the Claude API on Jan 22, 2027
claude-opus-4-5-20251101 and the undated claude-opus-4-5 retire Jan 22, 2027. What changes in requests and responses when you move to claude-opus-5-5.
Ubuntu 24.04 (Docker) · GNU grep 3.11 · Anthropic official Model deprecations and Opus 5.5 migration guide · 2026-12 - Gemini 2.5 Pro and Flash Now Route to Newer Models
From Dec 1, 2026, gemini-2.5-pro requests route to gemini-3.8-flash and gemini-2.5-flash to gemini-3.5-flash-lite, billed at the new model's rates.
Debian 12.15 (Docker) · GNU grep 3.8 · Gemini API official docs · 2026-12 - OpenAI gpt-5, gpt-5-mini and o3 shut down Dec 11, 2026
OpenAI shuts down gpt-5 and o3 models on Dec 11, 2026. See the new gpt-6.2-sol, gpt-6.1-terra and gpt-6-luna replacements, their limits, and a grep.
Ubuntu 24.04 (Docker) · GNU grep 3.11 · OpenAI official docs · 2026-12 - Claude Sonnet 4.5 retired on Nov 30, 2026: how to migrate
Claude Sonnet 4.5 was retired on Nov 30, 2026, including the undated claude-sonnet-4-5. Find where you use it and move to claude-sonnet-5-5.
Ubuntu 24.04 (Docker) · GNU grep 3.11 · Anthropic official docs · 2026-12 - OpenAI gpt-image-1.5 and gpt-image-1-mini shut down Dec 1, 2026
OpenAI shut down gpt-image-1-mini, gpt-image-1.5 and chatgpt-image-latest on Dec 1, 2026. Move to gpt-image-2.6 and check complexity, size and quality.
Ubuntu 24.04 (Docker) · GNU grep 3.11 · OpenAI official deprecations and Image generation docs · 2026-12 - OpenAI reusable prompts (pmpt_ IDs) shut down on Nov 30, 2026
The OpenAI v1/prompts API and reusable prompts (pmpt_ IDs) were shut down Nov 30, 2026. Find pmpt_ in your code and rebuild prompts if only the ID is left.
Ubuntu 24.04 (Docker) · GNU grep 3.11 · OpenAI official deprecations and prompt object migration docs · 2026-12 - Gemini API 402 payment_required: Prepay Credits Depleted
Gemini API 402 payment_required means your Prepay credit balance is $0. Don't retry: add credits in AI Studio, and set a monthly limit if you use auto-reload.
Gemini API docs (API errors, Billing) · 2026-11 - Migrate from Gemini 3.8 Flash to Gemini 4 Hydrogen
Moving from gemini-3.8-flash to gemini-4-hydrogen: default thinking level becomes high, xhigh is new, minimal is rejected, and output price changes.
Gemini API docs · 2026-11-12 GA - Migrate to Gemini 4 Carbon: 4 request changes to make
A new model name is not enough. Raise a max_output_tokens set below 32,768, drop explicit caches, remove temperature, and plan for prices that double on Dec 1.
Gemini API official docs · GA 2026-11-10 - OpenAI API 500 "The server had an error": retry and fix
OpenAI API 500 "The server had an error" is OpenAI-side. The SDK retries twice, quits in a second, so raise retries, check status, then contact support.
openai-python 3.49.0 · Python 3.12 (Docker) · local mock server · OpenAI official docs · 2026-11 - Gemini TTS and Live preview shutdown dates: TTS on Dec 18, 2026
Three Gemini TTS previews now shut down Dec 18, 2026, not Nov 17. Native audio is Mar 31, 2027, and 3.1 Flash Live has no announced date.
Ubuntu 24.04 (Docker) · GNU grep 3.11 · Gemini API and Vertex AI official docs · 2026-12 - Claude API 403 permission_error: causes and fixes
Claude API 403 permission_error: the key authenticated but may not use that resource. Check workspace, key type and scopes, and organization access.
curl · Claude API official docs · 2026-10 - Fix Claude API "thinking.type.disabled" is not supported
Claude API 400 "thinking.type.disabled is not supported for this model": thinking is always on for that model. Remove the field; Sonnet 5.5 needs between_tools.
Claude API official docs · 2026-11 - Claude API 409 conflict_error: causes and how to retry
Claude API 409 conflict_error: the request clashed with a resource's state. Tell concurrent edits, duplicates and a stale version apart, re-read, then retry.
Claude API official docs · 2026-11 - Fix Claude API 504 timeout_error on long requests
Claude API 504 timeout_error means the request timed out while processing. Move long requests to streaming or Message Batches, and check SDK retries.
Python 3.12.16 (Docker) · anthropic 2.3.0 · Claude API official docs · 2026-10 - OpenAI WebSocket mode "previous_response_not_found": fix
previous_response_not_found in Responses API WebSocket mode means the ID is not in the connection's cache. Retry with previous_response_id null and full input.
Python 3.12 sample JSON test · OpenAI API official docs · 2026-10 - Claude API 404 not_found_error: wrong path, ID or model
Claude API 404 not_found_error means the resource was not found. Check the endpoint path (a doubled /v1), resource IDs in the URL, and the model name.
Python 3.12.16 (Docker) · anthropic 2.3.0 · curl · Claude API official docs · 2026-12 - Gemini API finishReason "RECITATION": why output stops
Gemini API returns finishReason RECITATION when output may resemble existing data. Make the prompt more unique and read citationMetadata to find the span.
Python 3.12 sample JSON test · Gemini API official docs · 2026-10 - Lock Gemini's response to a JSON schema
Send a mime_type and a JSON schema with the Gemini API request to get a fixed JSON shape back. Covers supported keywords, limits, and checking the result.
Gemini API official docs · 2026-10 · responses checked with jsonschema 4.10.3 - Gemini 4 and 3.6+ ignore temperature, top_p, top_k: remove them
Gemini 4 and 3.6+ ignore custom temperature, top_p, top_k and send a deprecation warning header; a 400 is planned later. Remove all three now.
Gemini API official docs · 2026-10 - Claude API: thinking block is bound to a different conversation
Claude API 400 Invalid signature in thinking block: earlier history was edited. Make history append-only; use drop_block with the beta header as a stopgap.
Claude API official docs · 2026-10 - Fix OpenAI "Unsupported parameter: 'max_tokens'" (400)
OpenAI 400 'max_tokens' is not supported: reasoning models reject the old key. Use max_completion_tokens (or max_output_tokens in Responses) and allow room.
OpenAI API official docs · 2026-10 - Fix OpenAI "Unsupported value: 'temperature'" (reasoning)
OpenAI 400 Unsupported value: 'temperature' means a reasoning model only accepts the default 1. Remove temperature, top_p and top_logprobs from the request.
OpenAI API official docs · 2026-10 - Claude API: tool_choice "tool" and "any" are not supported
Claude API 400 tool_choice "tool" and "any" are not supported: Opus 5.5 and others reject forced tool use. Use auto with strict tools or structured outputs.
Claude API official docs · 2026-10 - Fix Gemini 2.5 404 "no longer available to new users"
Gemini 2.5 404 "no longer available to new users" is an access limit. 2.5 Pro and Flash are also deprecated and reroute from Dec 1, so use a newer model.
Gemini API official docs · 2026-12 - OpenAI API 503 server_is_overloaded: Model temporarily overloaded
OpenAI API 503 server_is_overloaded is model capacity, not your limits. Wait for Retry-After and retry; the Python SDK already retries twice.
openai-python 3.39.0 · Python 3.12 · local mock server · OpenAI official docs · 2026-10 - Fix Gemini API 403 "Your project has been denied access"
Gemini API 403 Your project has been denied access blocks the Cloud project, not the key. Read its AI Studio status, then fix billing or a suspension.
Gemini API official docs · 2026-10 - Claude API 529 overloaded_error: retry and back off
Claude API 529 overloaded_error is API-wide overload, not your rate limit. Retry with SDK max_retries and exponential backoff, and log the request-id.
Claude API official docs · curl · 2026-10 - Fix OpenAI API 403 "unsupported_country_region_territory"
OpenAI API 403 unsupported_country_region_territory means your egress IP was placed outside supported countries. Check the server IP; report a misplacement.
OpenAI API official docs · 2026-10 - Fix Claude API "thinking blocks cannot be modified" 400
Claude API 400 thinking or redacted_thinking blocks cannot be modified means the last assistant turn was altered. Send its content back exactly as received.
Python 3.12 · Claude API official docs · 2026-10 - OpenAI: Your organization must be verified to stream this model
OpenAI must be verified to stream this model blocks streaming that model until the org is verified. Try with stream off; after verifying, wait 15 minutes.
OpenAI API error text and OpenAI Help Center article · 2026-10 - Claude API effort 'xhigh' not supported when thinking is disabled
Claude API 400 effort 'xhigh' is not supported when thinking is disabled: xhigh sent with thinking off. Lower effort to high or use adaptive thinking.
Claude API official docs · 2026-10 - Fix OpenAI API 400 "Invalid service_tier argument"
OpenAI API 400 Invalid service_tier argument means the requested service tier is not allowed for the project. Send an allowed tier or change project settings.
openai-python 3.39.0 · local mock server · OpenAI official docs · 2026-10 - Check finishReason when a Gemini response has empty text
When a Gemini API response has no text, read promptFeedback.blockReason, then candidates[0].finishReason, to find the cause. Includes a classifier.
Python 3.12 on sample JSON · Gemini API reference and safety settings docs, 2026-10 - Fix Claude API 413 request_too_large
When the Claude API returns 413 request_too_large or Claude Code stops at "Request too large (max 32MB)", learn what the limit counts and shrink the request.
Python 3.13 · Claude API · Claude Code official docs · 2026-10 - Fix Gemini API 403 "Your API key was reported as leaked"
When the Gemini API returns 403 "reported as leaked", find the blocked key in AI Studio, switch to a new one, then take keys out of code and repositories.
Gemini API official docs · 2026-10 - Fix Claude API 400 "Your credit balance is too low"
When the Claude API or Claude Code fails with "credit balance is too low", tell an empty balance from an API key overriding your subscription, then fix it.
Claude API · Claude Code official docs · 2026-10 - Fix OpenAI API 429 "You exceeded your current quota"
The OpenAI API 429 "You exceeded your current quota" is a credit or spend-limit problem, not a rate limit. Read error.code to find the cause and fix billing.
OpenAI API official docs · 2026-10 - Fix Claude API 400 "thinking.type.enabled is not supported"
After moving to Claude 4.7 or later, a budget_tokens request returns 400. Switch thinking to adaptive and set depth with output_config.effort.
Claude API official docs · 2026-10 - Fix Gemini API 400 "User location is not supported"
When the Gemini API returns 400 "User location is not supported", find where requests leave from and check it against the official regions list.
Gemini API official docs · 2026-10 - Fix OpenAI API 429 "Rate limit reached ... tokens per min"
When the OpenAI API returns 429 with tokens per min (TPM) Limit, Used and Requested, learn to read the numbers, then cut max_tokens, wait, or batch.
OpenAI API official docs · 2026-10 - Fix OpenAI API 401 "Incorrect API key provided"
When the OpenAI API answers 401 Incorrect API key provided, read the masked key in the message and rule out env variables, spaces, wrong project, deleted keys.
curl 8.12 · OpenAI API official docs · 2026-10 - Fix Claude API 400 "tool_use without tool_result"
Fix the 400 "tool_use ids were found without tool_result blocks immediately after": the message pairing rules, and /rewind recovery in Claude Code.
Python 3.13 · Claude Messages API official docs · 2026-10 - Fix Gemini API 404 "models/... is not found for v1beta"
When the Gemini API returns 404 "models/gemini-pro is not found for v1beta", check the name with ListModels, then tell a retired model from an alias.
Gemini API official docs · 2026-10 - Fix Gemini API 503 "The model is overloaded"
When the Gemini API returns 503 "The model is overloaded", tell it from a 429 quota error, then retry with backoff and move non-realtime jobs to the Batch API.
Gemini API official docs · 2026-10 - Fix Claude API 400 "does not support assistant message prefill"
Claude 4.6 and later models return a 400 when messages ends with an assistant turn. Remove it and set the format with structured outputs or a system prompt.
Claude API official docs · 2026-10 - "maximum context length" error but tiktoken says it fits
tiktoken counts 73,878 tokens but the API says 249,114. Estimate the full request offline: system, tools, schema, history and reserved output.
Ubuntu 24.04 · Python 3.12 · tiktoken 0.14.0 · OpenAI docs as of 2026-10 (no API calls) - Retry Gemini API 429 and 503 Errors with Backoff
429 RESOURCE_EXHAUSTED and 503 UNAVAILABLE need different handling. A Python retry function with backoff and jitter, tested on a fake server.
Ubuntu 24.04 · Python 3.12.3 (stdlib) · tested against a local fake server · error classes per Gemini API docs, 2026-10 - Check stop_reason to Tell If a Claude Response Was Cut Off
If json.loads fails on a reply cut off mid-string, read stop_reason first. A Python check for max_tokens truncation, and how to raise the limit or continue.
Python 3.12.3 · Claude Messages API docs as of 2026-10 · checked against sample response JSON