Claude 4 API 410 Error — Complete Fix Guide
Your Claude 4 API calls are failing with 410 Gone errors. Here's exactly why, and how to fix it in every language — with code you can copy-paste.
HTTP/1.1 410 Gone
Content-Type: application/json
{
"error": {
"type": "gone",
"message": "The model 'claude-4-opus-20250615' has been
retired. Please migrate to claude-opus-4-8 or
visit https://anthropic.com/models for alternatives."
}
}
What Happened?
On June 15, 2026, Anthropic permanently retired claude-4-opus and claude-sonnet-4.
All API calls to these model IDs now return HTTP 410 Gone. This is not a temporary outage —
the models have been replaced by newer versions.
The good news: the fix takes 1 line of code. If you stay with Anthropic, you don't even need a new API key. Just change the model name and you're back online.
Model ID Mapping: What to Change
Find your current model ID and replace it with the new one:
| Old Model ID (Retired) | New Model ID | Price (Input/Output per 1M) | Savings |
|---|---|---|---|
claude-4-opus |
claude-opus-4-8 |
$5.00 / $25.00 | 67% cheaper |
claude-4-opus-20250615 |
claude-opus-4-8 |
$5.00 / $25.00 | 67% cheaper |
claude-sonnet-4 |
claude-sonnet-4-6 |
$3.00 / $15.00 | 80% cheaper |
claude-sonnet-4-20250514 |
claude-sonnet-4-6 |
$3.00 / $15.00 | 80% cheaper |
claude-4-haiku |
claude-haiku-4-5 |
$0.80 / $4.00 | 87% cheaper |
Fix It in Your Language
Select your language below and copy-paste the fix:
import anthropic client = anthropic.Anthropic(api_key="your-key") response = client.messages.create( model="claude-4-opus", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}] )
import anthropic client = anthropic.Anthropic(api_key="your-key") response = client.messages.create( model="claude-opus-4-8", # ← Changed this line max_tokens=1024, messages=[{"role": "user", "content": "Hello"}] )
💡 Same pip install anthropic. Same API key. Same SDK. Just change the model name.
import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: 'your-key' }); const response = await client.messages.create({ model: 'claude-4-opus', max_tokens: 1024, messages: [{ role: 'user', content: 'Hello' }] });
import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: 'your-key' }); const response = await client.messages.create({ model: 'claude-opus-4-8', // ← Changed this line max_tokens: 1024, messages: [{ role: 'user', content: 'Hello' }] });
💡 Same npm install @anthropic-ai/sdk. Same API key. Same SDK.
curl https://api.anthropic.com/v1/messages \ -H "x-api-key: your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-4-opus", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}] }'
curl https://api.anthropic.com/v1/messages \ -H "x-api-key: your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-8", // ← Changed this line "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}] }'
import "github.com/anthropics/anthropic-sdk-go" client := anthropic.NewClient() message, err := client.Messages.New(ctx, anthropic.MessageNewParams{ Model: "claude-4-opus", MaxTokens: 1024, Messages: []anthropic.MessageParam{{ Role: anthropic.MessageParamRoleUser, Content: []anthropic.ContentBlockParam{{...}}, }}, })
import "github.com/anthropics/anthropic-sdk-go" client := anthropic.NewClient() message, err := client.Messages.New(ctx, anthropic.MessageNewParams{ Model: "claude-opus-4-8", // ← Changed this line MaxTokens: 1024, Messages: []anthropic.MessageParam{{ Role: anthropic.MessageParamRoleUser, Content: []anthropic.ContentBlockParam{{...}}, }}, })
💡 go get github.com/anthropics/anthropic-sdk-go. Same API key. Same SDK.
require 'anthropic' client = Anthropic::Client.new(api_key: 'your-key') response = client.messages.create( model: 'claude-4-opus', max_tokens: 1024, messages: [{ role: 'user', content: 'Hello' }] )
require 'anthropic' client = Anthropic::Client.new(api_key: 'your-key') response = client.messages.create( model: 'claude-opus-4-8', # ← Changed this line max_tokens: 1024, messages: [{ role: 'user', content: 'Hello' }] )
💡 gem install anthropic. Same API key. Same gem.
Want to Save More Than 67%?
Staying with Anthropic (Claude Opus 4.8) saves 67%. But if you're open to switching providers, you can save much more:
| Model | Provider | Input / Output (per 1M tokens) | Savings vs Claude 4 Opus |
|---|---|---|---|
| Claude Opus 4.8 | Anthropic | $5.00 / $25.00 | 67% cheaper |
| GPT-5 | OpenAI | $2.50 / $10.00 | 87% cheaper |
| Gemini 2.5 Pro | $1.25 / $5.00 | 93% cheaper | |
| DeepSeek V4 Pro | DeepSeek | $0.44 / $0.87 | 97% cheaper |
| DeepSeek V4 Flash CHEAPEST | DeepSeek | $0.14 / $0.28 | 99% cheaper |
Use our Cost Calculator to find the cheapest model for YOUR specific token usage. Enter your monthly input/output tokens and see exact costs for all 42 models.
Common Mistakes to Avoid
claude-4-opus-20250615 won't work even though it looks like a version number. Use claude-opus-4-8.
Your existing API key works with Claude Opus 4.8. Save yourself a step — just change the model name.
The Anthropic endpoint stays the same: https://api.anthropic.com/v1. Only change it if switching providers.
Check your .env file. If you hardcoded the model name in multiple places, search your entire codebase.
Search Your Codebase for Old Model IDs
Run these commands to find every instance of the old model IDs:
🚀 Calculate Your Exact Migration Costs
Don't guess. Know exactly what you'll pay with each provider based on YOUR token usage.
- ✓ Save & compare up to 10 migration scenarios
- ✓ Export PDF cost reports for your team
- ✓ Get personalized optimization recommendations
- ✓ Cost alerts when provider prices change
14-day money-back guarantee · No subscription — ever
Built by APIpulse — Know your AI API costs before you commit.
42 models · 10 providers · 82 tools · Always up-to-date pricing data