Registry / llm-agents / anthropic

anthropic

JSON →
library0.84.0pypypi✓ verified 53d ago

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).

llm-agentsai-ml
pip install anthropic
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
musl
glibc
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
py 3.9
5/10 runs
5/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)
Debug
Known issues
breakinganthropic.Client() is removed. Use anthropic.Anthropic() instead.
fix
client = Anthropic(api_key=os.environ.get('ANTHROPIC_API_KEY'))
affects: < 0.3.0
gotchaSDK releases weekly. Pin your version in production or expect frequent behaviour changes.
fix
Pin with anthropic==0.84.0 in requirements.txt
affects: all
gotchamessage.content is a list, not a string. Access text via message.content[0].text.
fix
print(message.content[0].text) not print(message.content)
affects: all
gotchamax_tokens is required. No default value. Omitting raises a validation error.
fix
Always pass max_tokens=1024 or appropriate value
affects: all
deprecatedclaude-agent-sdk-python no longer requires Claude Code to be installed separately. It is bundled.
fix
Remove any separate Claude Code install steps from your setup.
affects: all
breakingThe package `claude-agent-sdk` is not a valid PyPI package and cannot be found. If you are trying to install the main Anthropic SDK, use `anthropic`. If you are looking for an agent-specific SDK, you might be looking for `claude-agent-sdk-python`.
fix
Replace `claude-agent-sdk` with `anthropic` or `claude-agent-sdk-python` in your requirements/install commands.
affects: all
breakingFailed to authenticate due to missing API key. Ensure `api_key` is passed during client initialization or set the `ANTHROPIC_API_KEY` environment variable.
fix
client = Anthropic(api_key=os.environ.get('ANTHROPIC_API_KEY'))
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'anthropic'
The 'anthropic' package is not installed in the Python environment.
fix
Install 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.
fix
Use 'from anthropic import AnthropicClient' instead.
AttributeError: module 'anthropic' has no attribute 'Anthropic'
The 'Anthropic' class does not exist in the 'anthropic' module.
fix
Instantiate 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.
fix
Initialize with 'client = anthropic.AnthropicClient(api_key="your_api_key")'.
ValueError: Invalid API key provided
The provided API key is incorrect or malformed.
fix
Ensure the API key is correct and properly formatted.
Upgrade
Version history
0.107.1latest on PyPI
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.
Agent activity
113 hits · last 30 days
node
26
petalbot
5
seranking-bot
4
ahrefsbot
2
bingbot
1
amazonbot
1
bytedance
1
Google (AI)
1
Resources