Your Claude 4 API calls are failing right now. Thousands of developers are seeing 410 errors this morning. This is not a drill โ Claude 4 Opus and Sonnet 4 have been permanently retired. But here's the good news: you can fix this in under 15 minutes, and you'll likely save 67-97% on your API costs in the process.
This is your emergency action plan. Follow it step by step.
What Happened?
On June 15, 2026, Anthropic completed the shutdown of Claude 4 Opus and Claude 4 Sonnet. This was announced weeks in advance, but if you missed the deadline, here's the timeline:
Step 1: Diagnose the Error (2 minutes)
First, confirm that your issue is the Claude 4 shutdown. Check your logs for one of these error patterns:
# Python error
anthropic.NotFoundError: Error code: 410 -
{'type': 'error', 'error': {'type': 'not_found_error',
'message': 'claude-4-opus has been retired. Please upgrade to
claude-opus-4-8. See https://docs.anthropic.com/docs/deprecations'}}
# Node.js error
Error: 410 model_not_found
"claude-4-sonnet is no longer available. Use claude-sonnet-4-6."
# curl response
HTTP/1.1 410 Gone
{"type":"error","error":{"type":"not_found_error","message":"claude-4-opus has been retired"}}
Key identifier: HTTP 410 (not 404, not 500). The "Gone" status means the resource is permanently removed. Your API key still works โ only the model name is retired.
Step 2: Find Every Claude 4 Reference (3 minutes)
Run this command in your project root to find every file that needs updating:
# Find all Claude 4 references in your codebase
grep -r "claude-4-opus\|claude-4-sonnet\|claude-4" \
--include="*.js" --include="*.ts" --include="*.py" \
--include="*.json" --include="*.env" --include="*.yaml" \
--include="*.yml" --include="*.toml" --include="*.cfg" .
# Also check for model IDs in config files
grep -r "model.*claude-4\|claude-4.*model" --include="*.json" --include="*.env" .
Don't miss these common locations:
- Source code โ Any file with
model="claude-4-opus"ormodel="claude-4-sonnet" - Environment variables โ
.envfiles withANTHROPIC_MODEL=claude-4-opus - Config files โ JSON, YAML, TOML config files with model settings
- CI/CD pipelines โ GitHub Actions, GitLab CI, or deployment scripts that set model IDs
- Documentation โ README files or docs that reference the old model names
Step 3: Update Model IDs (5 minutes)
Replace the deprecated model names with their official successors. This is the ONLY code change needed:
For Claude 4 Opus โ Claude Opus 4.8
# Python
# Before (returns 410 Gone)
client.messages.create(model="claude-4-opus", ...)
# After (official successor, 67% cheaper)
client.messages.create(model="claude-opus-4-8", ...)
# Node.js
// Before
{ model: "claude-4-opus" }
// After
{ model: "claude-opus-4-8" }
# Environment variable
ANTHROPIC_MODEL=claude-opus-4-8
For Claude 4 Sonnet โ Claude Sonnet 4.6
# Python
# Before (returns 410 Gone)
client.messages.create(model="claude-4-sonnet", ...)
# After (official successor, 50% cheaper)
client.messages.create(model="claude-sonnet-4-6", ...)
# Node.js
// Before
{ model: "claude-4-sonnet" }
// After
{ model: "claude-sonnet-4-6" }
# Environment variable
ANTHROPIC_MODEL=claude-sonnet-4-6
That's it. Same API, same SDK, same key, same parameters. Just change the model name string. No other code changes required.
Calculate your new costs in 30 seconds
See exactly what you'll pay with Claude Opus 4.8, Sonnet 4.6, or any alternative. Free calculator โ upgrade for alerts.
Step 4: Test and Deploy (5 minutes)
Before deploying to production, verify the new model works:
# Quick test (Python)
import anthropic
client = anthropic.Anthropic() # Uses ANTHROPIC_API_KEY env var
response = client.messages.create(
model="claude-opus-4-8", # or claude-sonnet-4-6
max_tokens=100,
messages=[{"role": "user", "content": "Say 'migration successful'"}]
)
print(response.content[0].text)
# Should output: "migration successful"
# Quick test (Node.js)
const response = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 100,
messages: [{ role: "user", content: "Say 'migration successful'" }]
});
console.log(response.content[0].text);
// Should output: "migration successful"
If the test succeeds, deploy. Your app is back online.
The Cost Breakdown: What You Were Paying vs What You'll Pay
Here's the silver lining of the Claude 4 shutdown: every replacement is cheaper.
Beyond the Official Successor: 9 Cheaper Alternatives
If you want to save even more than the 67% from Opus 4.8, here are the top alternatives ranked by cost-effectiveness:
Want to see all 42 alternatives with live pricing and migration code? Check our Claude 4 Migration Hub โ it has 18 head-to-head comparisons, migration calculators, and code snippets for every alternative.
Choose Your Migration Path
Not sure which alternative is right for you? Here's a quick decision guide:
- โWant zero code changes? โ Use
claude-opus-4-8orclaude-sonnet-4-6(official Anthropic successors, same API) - โWant maximum savings? โ Use DeepSeek V4 Flash ($0.14/$0.28 โ 99% cheaper)
- โWant best quality-per-dollar? โ Use DeepSeek V4 Pro ($0.44/$0.87 โ near-Opus quality at 97% less)
- โNeed largest context window? โ Use Gemini 3.1 Pro (1M tokens) or Llama 4 Maverick (1M tokens)
- โNeed EU/GDPR compliance? โ Use Mistral Medium 3.5 (EU data sovereignty)
- โWant OpenAI ecosystem? โ Use GPT-5 or GPT-5.5 Pro (largest AI ecosystem)
- โWant open source? โ Use Llama 4 Maverick (fully open, self-hostable)
Calculate Your Exact Savings
See what you'll pay with each alternative based on your actual usage. Compare Claude Opus 4.8, DeepSeek, GPT-5, Gemini, and more โ all with real-time pricing.
Open Cost Calculator โMigration Code Snippets
Here are ready-to-use code snippets for the most popular alternatives:
Option A: Stick with Anthropic (easiest)
# Python โ Just change the model name
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-8", # was claude-4-opus
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
# Node.js
const response = await client.messages.create({
model: "claude-sonnet-4-6", // was claude-4-sonnet
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }]
});
Option B: Switch to DeepSeek (cheapest)
# Python โ pip install openai
from openai import OpenAI
client = OpenAI(
api_key="your-deepseek-key",
base_url="https://api.deepseek.com/v1"
)
response = client.chat.completions.create(
model="deepseek-v4-pro", # or deepseek-v4-flash for even cheaper
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
# Node.js
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'your-deepseek-key',
baseURL: 'https://api.deepseek.com/v1'
});
const response = await client.chat.completions.create({
model: 'deepseek-v4-pro',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }]
});
Option C: Switch to GPT-5 (OpenAI ecosystem)
# Python โ pip install openai
from openai import OpenAI
client = OpenAI() # Uses OPENAI_API_KEY env var
response = client.chat.completions.create(
model="gpt-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
# Node.js
import OpenAI from 'openai';
const client = new OpenAI();
const response = await client.chat.completions.create({
model: 'gpt-5',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }]
});
Option D: Switch to Gemini (1M context)
# Python โ pip install google-genai
from google import genai
client = genai.Client() # Uses GEMINI_API_KEY env var
response = client.models.generate_content(
model="gemini-3.1-pro",
contents="Hello"
)
print(response.text)
# Node.js
import { GoogleGenAI } from '@google/genai';
const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const response = await client.models.generateContent({
model: 'gemini-3.1-pro',
contents: 'Hello'
});
console.log(response.text);
Don't just migrate โ optimize
Most devs pick the first replacement. Pro users get personalized routing: cheap models for 80% of tasks, premium for 20%. Save an extra 40%.
Key Questions on Shutdown Day
Is Claude 4 really gone forever?
Yes. The shutdown is permanent and complete. Anthropic has fully transitioned to the 4.x generation. The model IDs claude-4-opus and claude-4-sonnet will never return. There is no grace period, no extension, and no way to restore access.
Does my API key still work?
Yes, if you're staying with Anthropic. Your existing API key works with Claude Opus 4.8 and Sonnet 4.6 โ just change the model name string. If you're switching to DeepSeek, OpenAI, Google, or another provider, you'll need a new API key from that provider.
What if I'm still seeing errors after updating the model name?
Check these common issues: (1) You missed a reference โ run the grep command above to find all occurrences. (2) Your config file wasn't redeployed โ clear your build cache. (3) Your API key has insufficient credits โ check your Anthropic dashboard. (4) You're using a framework that caches model names โ restart your app server.
Can I use Claude 4 through a third-party proxy?
No. The shutdown is at Anthropic's API level. All proxies, gateways, and aggregators that route to Anthropic will also return 410 errors for Claude 4 model IDs. There is no workaround.
What's the best alternative for my use case?
It depends on your priorities. Use our 167 head-to-head comparisons or cost calculator to find the best fit. Quick guide: Opus 4.8 for easiest migration, DeepSeek V4 Pro for best value, GPT-5 for OpenAI ecosystem, Gemini 3.1 Pro for largest context window.
Get Notified When Prices Change
Join 1,200+ developers who get weekly AI pricing updates. Know instantly when providers change prices or new models launch.