๐Ÿ“ฆ anthropics / anthropic-sdk-python

โ˜… 2.9k stars โ‘‚ 488 forks ๐Ÿ‘ 2.9k watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/anthropics/anthropic-sdk-python.git
HTTPS git clone https://github.com/anthropics/anthropic-sdk-python.git
SSH git clone git@github.com:anthropics/anthropic-sdk-python.git
CLI gh repo clone anthropics/anthropic-sdk-python
stainless-app[bot] stainless-app[bot] release: 0.84.0 49d639a 5 days ago ๐Ÿ“ History
๐Ÿ“‚ 49d639a671cb0ac30c767e8e1e68fdd5925205d5 View all commits โ†’
๐Ÿ“ .devcontainer
๐Ÿ“ .github
๐Ÿ“ .inline-snapshot
๐Ÿ“ .vscode
๐Ÿ“ bin
๐Ÿ“ examples
๐Ÿ“ scripts
๐Ÿ“ src
๐Ÿ“ tests
๐Ÿ“„ .gitignore
๐Ÿ“„ .python-version
๐Ÿ“„ .stats.yml
๐Ÿ“„ api.md
๐Ÿ“„ Brewfile
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ CONTRIBUTING.md
๐Ÿ“„ helpers.md
๐Ÿ“„ LICENSE
๐Ÿ“„ pyproject.toml
๐Ÿ“„ README.md
๐Ÿ“„ SECURITY.md
๐Ÿ“„ tools.md
๐Ÿ“„ uv.lock
๐Ÿ“„ README.md

Claude SDK for Python

PyPI version

The Claude SDK for Python provides access to the Claude API from Python applications.

Documentation

Full documentation is available at platform.claude.com/docs/en/api/sdks/python.

Installation

pip install anthropic

Getting started

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)

Requirements

Python 3.9+

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.