Official Python SDK for the Anthropic API providing access to Claude models. Current version is 0.84.0 (Feb 2026). Releases approximately weekly. Two separate packages exist: anthropic (core SDK) and claude-agent-sdk-python (agent workflows).
Install & Compatibility
Where this runs
tested against v0.107.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
8/10 runs
8/10 runs
py 3.11
8/10 runs
8/10 runs
py 3.12
8/10 runs
8/10 runs
py 3.13
8/10 runs
8/10 runs
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Anthropic
✓ from anthropic import Anthropic
✗ import anthropic; anthropic.Client(api_key=...)
anthropic.Client is the old pre-0.3 API. Removed. Always use Anthropic() class.
AsyncAnthropic
✓ from anthropic import AsyncAnthropic
✗ import anthropic; anthropic.AsyncClient()
Use AsyncAnthropic for async contexts, not the legacy async client.
Minimal message call using the Anthropic SDK 0.84.x.
from anthropic import Anthropic
client = Anthropic() # reads ANTHROPIC_API_KEY from env
message = client.messages.create(
model='claude-opus-4-6',
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude"}
]
)
print(message.content[0].text)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'anthropic'
The 'anthropic' package is not installed in the Python environment.
fixInstall the package using 'pip install anthropic'.
ImportError: cannot import name 'Anthropic' from 'anthropic'
The import statement is incorrect; 'Anthropic' is not a valid import from the 'anthropic' package.
fixUse 'from anthropic import AnthropicClient' instead.
AttributeError: module 'anthropic' has no attribute 'Anthropic'
The 'Anthropic' class does not exist in the 'anthropic' module.
fixInstantiate the client with 'client = anthropic.AnthropicClient()'.
TypeError: __init__() missing 1 required positional argument: 'api_key'
The 'AnthropicClient' class requires an 'api_key' argument during initialization.
fixInitialize with 'client = anthropic.AnthropicClient(api_key="your_api_key")'.
ValueError: Invalid API key provided
The provided API key is incorrect or malformed.
fixEnsure the API key is correct and properly formatted.
Audit
Dependencies
claude-agent-sdkoptionalRequired for multi-agent workflows with Claude. Separate from core anthropic package.
anthropic[bedrock]optionalRequired for AWS Bedrock access.
anthropic[vertex]optionalRequired for Google Vertex AI access.