| 1 |
# Claude SDK for Python |
| 2 |
|
| 3 |
[](https://pypi.org/project/anthropic/) |
| 4 |
|
| 5 |
The Claude SDK for Python provides access to the [Claude API](https://docs.anthropic.com/en/api/) from Python applications. |
| 6 |
|
| 7 |
## Documentation |
| 8 |
|
| 9 |
Full documentation is available at **[platform.claude.com/docs/en/api/sdks/python](https://platform.claude.com/docs/en/api/sdks/python)**. |
| 10 |
|
| 11 |
## Installation |
| 12 |
|
| 13 |
```sh |
| 14 |
pip install anthropic |
| 15 |
``` |
| 16 |
|
| 17 |
Upgrading from a `0.x` release? See the [v1 migration guide](MIGRATION.md). |
| 18 |
|
| 19 |
## Getting started |
| 20 |
|
| 21 |
```python |
| 22 |
import os |
| 23 |
from anthropic import Anthropic |
| 24 |
|
| 25 |
client = Anthropic( |
| 26 |
api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted |
| 27 |
) |
| 28 |
|
| 29 |
message = client.messages.create( |
| 30 |
max_tokens=1024, |
| 31 |
messages=[ |
| 32 |
{ |
| 33 |
"role": "user", |
| 34 |
"content": "Hello, Claude", |
| 35 |
} |
| 36 |
], |
| 37 |
|
| 38 |
model="claude-opus-5-5", |
| 39 |
) |
| 40 |
|
| 41 |
print(message.content) |
| 42 |
``` |
| 43 |
|
| 44 |
|
| 45 |
## Requirements |
| 46 |
|
| 47 |
Python 3.10+ |
| 48 |
|
| 49 |
## Contributing |
| 50 |
|
| 51 |
See [CONTRIBUTING.md](./CONTRIBUTING.md). |
| 52 |
|
| 53 |
## License |
| 54 |
|
| 55 |
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |