🔴 HTTP 410 GONE

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.

❌ This is what you're seeing:
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."
  }
}
This error is permanent. Claude 4 was retired on June 15, 2026.
Fix in 5 minutes Same API key (Anthropic) 1 line of code Save 67-97%

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:

🐍 Python
💚 Node.js
📡 cURL
🔵 Go
💎 Ruby
❌ Before (broken)
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"}]
)
⬇️ Change ONE line ⬇️
✅ After (fixed)
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.

❌ Before (broken)
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' }]
});
⬇️ Change ONE line ⬇️
✅ After (fixed)
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.

❌ Before (broken)
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"}]
  }'
⬇️ Change ONE line ⬇️
✅ After (fixed)
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"}]
  }'
❌ Before (broken)
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{{...}},
    }},
})
⬇️ Change ONE line ⬇️
✅ After (fixed)
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.

❌ Before (broken)
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' }]
)
⬇️ Change ONE line ⬇️
✅ After (fixed)
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 Google $1.25 / $5.00 93% cheaper
DeepSeek V4 Pro DeepSeek $0.44 / $0.87 97% 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

❌ Don't: Use the old model ID with a new version

claude-4-opus-20250615 won't work even though it looks like a version number. Use claude-opus-4-8.

❌ Don't: Create a new API key first

Your existing API key works with Claude Opus 4.8. Save yourself a step — just change the model name.

❌ Don't: Change the API base URL (Anthropic)

The Anthropic endpoint stays the same: https://api.anthropic.com/v1. Only change it if switching providers.

❌ Don't: Forget your environment variables

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:

# Find all Claude 4 model references in your codebase
grep -rn "claude-4-opus\|claude-sonnet-4\|claude-4-haiku" --include="*.py" --include="*.js" --include="*.ts" --include="*.go" --include="*.rb" .
# Also check config files and environment variables
grep -rn "claude-4" --include="*.env" --include="*.yaml" --include="*.yml" --include="*.json" --include="*.toml" .

🚀 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
$29 one-time · lifetime
Get Pro — Lifetime Access

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