not_found_error

HTTP 404 Wrong Model ID Not Retryable

The requested resource doesn't exist — usually a deprecated model ID or a typo in the endpoint URL. Update to a current model string.

Current model IDs (2026)

# Claude 4 family (current)
claude-opus-4-7
claude-sonnet-4-6           # recommended for most tasks
claude-haiku-4-5-20251001   # fast and cheap

# Aliases (always point to latest)
claude-3-5-sonnet-latest    # legacy alias, may still work
claude-3-5-haiku-latest
Model IDs change with each release. Always check docs.anthropic.com/en/docs/models-overview for the latest list.

Common deprecated IDs (update these!)

Old (deprecated) Replace with
claude-2 claude-sonnet-4-6
claude-instant-1 claude-haiku-4-5-20251001
claude-3-opus-20240229 claude-opus-4-7
claude-3-5-sonnet-20241022 claude-sonnet-4-6

Fix: Version-stable model selection

import anthropic

client = anthropic.Anthropic()

# Pin to a specific known-good model ID
DEFAULT_MODEL = "claude-sonnet-4-6"

# Or use a tiered fallback:
MODELS = [
    "claude-sonnet-4-6",
    "claude-haiku-4-5-20251001",
]

def call_with_fallback(messages):
    for model in MODELS:
        try:
            return client.messages.create(
                model=model, max_tokens=1024, messages=messages
            )
        except anthropic.NotFoundError:
            continue   # try next model
    raise RuntimeError("No available models")