Agent Frameworks

What is the Anthropic SDK for Python and how do you install it?

QUICK ANSWER

The Anthropic Python SDK is the official package for interacting with Claude. Install it using pip: 'pip install anthropic'.

Installation Command

pip install anthropic

Quick Usage

from anthropic import Anthropic

client = Anthropic(api_key="your-api-key")
message = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude!"}]
)
print(message.content[0].text)
Verified against: Anthropic Python SDK v0.39.0