Official Python SDK for the Anthropic API, providing typed access to Claude models and streaming.
The Claude 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
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-4-6",
)
print(message.content)
Python 3.9+
See CONTRIBUTING.md.
This project is licensed under the MIT License. See the LICENSE file for details.
Preview
Markdown
[](https://attestry.ai/models/github-anthropics-anthropic-sdk-python)HTML
<a href="https://attestry.ai/models/github-anthropics-anthropic-sdk-python"><img src="https://regseal.ai/api/v1/registry/badge/github-anthropics-anthropic-sdk-python" alt="RegSeal Verification Status" /></a>