Official Python SDK for the Anthropic API with typed access to Claude models, streaming, and tool use.
The Anthropic SDK for Python provides access to the Claude API from Python applications.
Full documentation is available at platform.claude.com/docs/en/api/sdks/python.
pip install anthropic
Upgrading from a 0.x release? See the v1 migration guide.
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted
)
message = client.messages.create(
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Hello, Claude",
}
],
model="claude-opus-5-5",
)
print(message.content)
Python 3.10+
See CONTRIBUTING.md.
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details. Versions released before the change from the MIT License, and third-party contributions merged before it, remain under the MIT License. See LICENSE-MIT.
Preview
Markdown
[](https://attestry.ai/models/pypi-anthropic)HTML
<a href="https://attestry.ai/models/pypi-anthropic"><img src="https://attestry.ai/api/v1/registry/badge/pypi-anthropic" alt="Attestry Verification Status" /></a>Are you the creator of this entry and want it removed? Request a takedown.