In this categoryTroubleshooting ยท 27
- How to Fix an OpenAI 401 'Invalid API Key' ErrorStart
- How to Fix OpenAI 429 Rate Limit Errors With Backoff
- How to Fix Anthropic Claude API 401 Authentication Errors
- How to Fix Google Gemini 'API Key Not Valid' Errors
- How to Fix an API Key That Loads as Undefined
- How to Handle Anthropic 529 'Overloaded' Errors
- How to Fix Rate Limit Errors from an AI API
- How to Fix CORS Errors When Calling an AI API From the Browser
- How to Fix 'Model Not Found' and Deprecated Model Errors
- How to Rotate a Leaked API Key Without Downtime
- How to Fix SSL Certificate Errors When Calling AI APIs
- How to count tokens before sending a prompt to Claude
- How to Fix 'Context Length Exceeded' Token Limit Errors
- How to fix a context length exceeded error in the Claude API
- How to fix a Claude response that gets cut off mid-sentence
- How to reduce Claude hallucinations by grounding answers in your documents
- How to keep a long Claude conversation under the context limit
- How to stop Claude from calling tools when it should not
- How to handle a Claude Fable 5 refusal with a fallback model
- How to choose the right Claude model for cost and quality
- How to cut Claude API costs with prompt caching
- How to halve Claude costs for bulk jobs with the Batch API
- How to cap spend on a Claude agent with a task budget
- How to Debug an MCP Server That Will Not Connect
- How to Ask an Agent to Explain a Bug Before Fixing It
- How to Roll Back a Bad Deploy Quickly
- How to Fix Cursor Not Indexing Your Codebase
How to Fix 'Model Not Found' and Deprecated Model Errors
Resolve model_not_found errors caused by typos, retired models, or access your account lacks.
A model_not_found error means the model id you sent is not one the API will serve to your account right now. The three common causes are a typo in the id, a model that was retired or renamed, and a model your account does not yet have access to. Each has a quick check.
- Your API key
- curl or your SDK
- The provider's current model list page
Step 1: List the models your key can use
Do not trust a model id from an old blog post. Ask the API which models your key can actually call, then copy an exact id from that list.
Step 2: Check for typos and version drift
Model ids are exact strings. A missing suffix or a dated snapshot that no longer exists will fail. Compare your id character by character against the list from step 1.
Step 3: Handle deprecated models
Providers retire old models on a schedule. If your id worked last year but fails now, it was likely deprecated. Read the deprecation notice for the recommended replacement and swap the id.
Step 4: Request access if needed
Some new or specialized models require you to be on a paid tier or to request access. If the id is correct and current but still not found, check whether your account tier includes it.
Result
After listing available models and copying the exact id into a single config constant, the call succeeds. A developer whose app broke overnight discovered their pinned dated snapshot had been retired, and switching to the current alias fixed every call at once.
Watch related tutorials
2:14
23:41
15:30
12:38
14:09
17:53New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.