Claude 4 Stopped Working? Here's Exactly What to Do
Your Claude 4 API calls are failing. model not found. deprecated model. Your app is down. Here's the fastest path to fixing it โ and saving up to 99% on API costs while you're at it.
TL;DR: Claude 4 Opus and Sonnet 4 retire on June 15, 2026. After that date, every API call to these models fails. The fix: replace claude-4-opus with claude-opus-4-8 or claude-sonnet-4 with claude-sonnet-4-6. Same API key, same SDK, 5-minute fix.
Step 1: Identify the Error
When Claude 4 is deprecated, you'll see one of these error responses:
{
"type": "error",
"error": {
"type": "not_found_error",
"message": "model 'claude-4-opus' not found"
}
}
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "model 'claude-sonnet-4' is deprecated and no longer available"
}
}
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "model 'claude-4-opus' has been retired. Use 'claude-opus-4-8' instead"
}
}
All three errors mean the same thing: the model name you're using no longer works. The fix is identical regardless of which error you see.
Step 2: Apply the Quick Fix
Find the model name in your code and replace it. That's it.
| Retired Model | Replace With | Cost Change |
|---|---|---|
| claude-4-opus | claude-opus-4-8 | 67% cheaper ($15/$75 โ $5/$25) |
| claude-sonnet-4 | claude-sonnet-4-6 | Same price ($3/$15) |
Python
# Before (broken)
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-4-opus", # โ THIS IS THE PROBLEM
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
# After (fixed)
message = client.messages.create(
model="claude-opus-4-8", # โ FIXED
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
Node.js
// Before (broken)
const message = await anthropic.messages.create({
model: 'claude-4-opus', // โ THIS IS THE PROBLEM
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }]
});
// After (fixed)
const message = await anthropic.messages.create({
model: 'claude-opus-4-8', // โ FIXED
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }]
});
cURL
# Before (broken)
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-d '{"model": "claude-4-opus", ...}' # โ PROBLEM
# After (fixed)
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-d '{"model": "claude-opus-4-8", ...}' # โ FIXED
Search your entire codebase for these strings:
claude-4-opusโclaude-opus-4-8claude-sonnet-4โclaude-sonnet-4-6
Also check: .env files, config files, environment variables, and any hardcoded model names in database records.
No API key changes needed. Your existing Anthropic API key works with all current models. Same key, same endpoint, same SDK โ just a different model name string.
Step 3: Save Money While You're At It
You're already fixing the error โ might as well cut your bill. Claude Opus 4.8 is the direct replacement, but there are 34 cheaper alternatives.
| Model | Input Cost | Output Cost | Savings vs Claude 4 Opus |
|---|---|---|---|
| Claude 4 Opus (retired) | $15.00 | $75.00 | โ |
| Claude Opus 4.8 (direct upgrade) | $5.00 | $25.00 | 67% cheaper |
| GPT-5.5 | $2.50 | $10.00 | 87% cheaper |
| Gemini 3.1 Pro | $1.25 | $5.00 | 93% cheaper |
| DeepSeek V4 Pro | $0.435 | $0.87 | 97% cheaper |
| DeepSeek V4 Flash | $0.14 | $0.28 | 99% cheaper |
For a typical workload of 10M input + 2M output tokens per month:
- Claude 4 Opus: $300/month
- Claude Opus 4.8: $100/month (save $200)
- GPT-5.5: $45/month (save $255)
- DeepSeek V4 Pro: $6.09/month (save $294)
Calculate your exact savings
Enter your token usage and see exactly how much you'll save by switching from Claude 4.
Deprecation Calculator โ Migration Tool โ Migration Cheat Sheet Cheapest LLM APIsStep 4: If It's Still Not Working
If you've changed the model name and it's still failing, check these common issues:
1. Check your .env file
If you're using an environment variable for the model name, update it there too:
# .env
ANTHROPIC_MODEL=claude-opus-4-8 # NOT claude-4-opus
2. Check your config files
Look in config.json, settings.py, application.yml, or any other configuration file that might store the model name.
3. Check database records
If you store model names in a database (e.g., user preferences, saved configurations), update those records too:
-- Find stored Claude 4 references
SELECT * FROM configurations WHERE model LIKE '%claude-4%';
-- Update them
UPDATE configurations SET model = 'claude-opus-4-8' WHERE model = 'claude-4-opus';
UPDATE configurations SET model = 'claude-sonnet-4-6' WHERE model = 'claude-sonnet-4';
4. Clear your SDK cache
Some SDKs cache model lists. Restart your application or clear any cached model data.
5. Check rate limits
New model IDs may have different rate limits. If you're getting 429 errors after switching, check the rate limits documentation.
Still stuck? Our complete error guide covers every possible Claude 4 error code with detailed fix instructions. Our migration tool can also compare all alternatives with your exact usage pattern.
Complete Fix Checklist
Search your codebase
Run grep -r "claude-4-opus" . and grep -r "claude-sonnet-4" . to find every reference.
Replace model names
claude-4-opus โ claude-opus-4-8 and claude-sonnet-4 โ claude-sonnet-4-6.
Check config files and .env
Update any environment variables or config files that reference the old model names.
Update database records
If model names are stored in a database, run the UPDATE queries above.
Test and deploy
Test with a single API call, then deploy. No infrastructure changes needed.
Calculate your savings
While you're at it, see if a cheaper model fits your use case. Use our calculator โ
June 15 deadline: See all 34 alternatives, calculate your savings, and get migration code on our Claude 4 Deprecation Hub.
Related Resources
- Claude Deprecation Calculator โ Calculate your exact migration cost and savings
- Claude 4 Migration Tool โ Compare all 34 alternatives with your exact usage
- Claude 4 API Errors โ Every error code and how to fix it
- Claude 4 Deprecation Checklist โ Complete 8-step migration checklist
- Claude 4 Migration Guide โ Detailed code examples in Python, Node.js, and REST
- Claude 4 Deprecation FAQ โ Every question answered about the deprecation
- Best Claude 4 Alternatives โ Detailed comparison of all replacement options
Don't just fix the error โ optimize your costs
You're already migrating. Take 2 minutes to see if a cheaper model works for your use case. Most developers save 60-99%.
Calculate Savings โ Compare All Models โ