Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Heuristic:Anthropics Anthropic sdk python Model Deprecation Awareness

From Leeroopedia
Knowledge Sources
Domains API_Client, Debugging
Last Updated 2026-02-15 12:00 GMT

Overview

The SDK emits DeprecationWarning for deprecated models and UserWarning for suboptimal thinking configurations, helping developers proactively migrate.

Description

The Anthropic Python SDK maintains a hardcoded dictionary of deprecated model identifiers and their end-of-life dates. When a deprecated model is used in messages.create() or messages.stream(), the SDK issues a DeprecationWarning with the EOL date and a migration link. Additionally, using thinking.type=enabled with Claude Opus 4.6 triggers a UserWarning recommending thinking.type=adaptive for better performance.

Usage

Monitor your application for DeprecationWarning output. In Python, deprecation warnings are silenced by default in production but visible in test/development environments. Use the warnings module to ensure they are captured in production logging. Proactively check the DEPRECATED_MODELS dictionary in the SDK source when planning model migrations.

The Insight (Rule of Thumb)

  • Action: Regularly audit which model identifiers your application uses against the SDK's deprecated models list.
  • Value: Current deprecated models and their EOL dates (as of SDK v0.79.0):
    • claude-3-opus-20240229 EOL: January 5th, 2026
    • claude-3-sonnet-20240229 EOL: July 21st, 2025
    • claude-2.1, claude-2.0 EOL: July 21st, 2025
    • claude-3-7-sonnet-latest, claude-3-7-sonnet-20250219 EOL: February 19th, 2026
    • claude-3-5-haiku-latest, claude-3-5-haiku-20241022 EOL: February 19th, 2026
    • claude-1.x and claude-instant-1.x already past EOL
  • Trade-off: Migrating models may require adjusting prompts, max_tokens, and testing for behavioral differences.

Reasoning

Deprecated models eventually become unavailable, causing hard failures in production. The SDK provides early warnings so developers can plan migrations. The warning includes the exact EOL date and a documentation link, reducing the research burden. The separate UserWarning for Opus 4.6 thinking configuration reflects empirical testing showing adaptive thinking produces better results than always-on thinking for that model.

Code Evidence

Deprecated models dictionary from messages.py:58-72:

DEPRECATED_MODELS = {
    "claude-1.3": "November 6th, 2024",
    "claude-1.3-100k": "November 6th, 2024",
    "claude-instant-1.1": "November 6th, 2024",
    "claude-instant-1.1-100k": "November 6th, 2024",
    "claude-instant-1.2": "November 6th, 2024",
    "claude-3-sonnet-20240229": "July 21st, 2025",
    "claude-3-opus-20240229": "January 5th, 2026",
    "claude-2.1": "July 21st, 2025",
    "claude-2.0": "July 21st, 2025",
    "claude-3-7-sonnet-latest": "February 19th, 2026",
    "claude-3-7-sonnet-20250219": "February 19th, 2026",
    "claude-3-5-haiku-latest": "February 19th, 2026",
    "claude-3-5-haiku-20241022": "February 19th, 2026",
}

Deprecation warning logic from messages.py:958-970:

if model in DEPRECATED_MODELS:
    warnings.warn(
        f"The model '{model}' is deprecated and will reach end-of-life on "
        f"{DEPRECATED_MODELS[model]}.\nPlease migrate to a newer model. "
        f"Visit https://docs.anthropic.com/en/docs/resources/model-deprecations "
        f"for more information.",
        DeprecationWarning,
        stacklevel=3,
    )

if model in MODELS_TO_WARN_WITH_THINKING_ENABLED and thinking and thinking["type"] == "enabled":
    warnings.warn(
        f"Using Claude with {model} and 'thinking.type=enabled' is deprecated. "
        f"Use 'thinking.type=adaptive' instead which results in better model "
        f"performance in our testing: ...",
        UserWarning,
        stacklevel=3,
    )

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment