Registry / llm-agents / anthropic

anthropic

JSON →
library1.0.0pypypi✓ verified 27d 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).

pip install anthropic
INSTALL
IMPORT
SIG · ANTHROPIC
A
anthropic
llm-agentspythonv1.0.0
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · 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
10/12 runs
10/12 runs
py 3.11
10/12 runs
10/12 runs
py 3.12
10/12 runs
10/12 runs
py 3.13
10/12 runs
10/12 runs
py 3.9
6/12 runs
6/12 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
1.0.0latest on PyPI · released Aug 20, 2026
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
84 hits · last 30 days
node
72
Anthropic
1
OpenAI (training)
1
Resources