Skip to main content

Anthropic SDK for Python

PyPI version

The Anthropic 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

Upgrading from a 0.x release? See the v1 migration guide.

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-5-5",
)
print(message.content)

Requirements

Python 3.10+

Contributing

See CONTRIBUTING.md.

License

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.

Metadata

Release files for anthropic 2.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anthropic 2.12.0
File Size Uploaded Provenance Actions
anthropic-2.12.0.tar.gz 2.0 MB Without provenance Details for anthropic-2.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anthropic 2.12.0
File Interpreter ABI Platform Actions
anthropic-2.12.0-py3-none-any.whl Python 3 none any Details for anthropic-2.12.0-py3-none-any.whl

Total release size: 4.6 MB

Release files / anthropic-2.12.0.tar.gz

Download URL anthropic-2.12.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
571e6d250bcd6bbaf5fd5f3c764b8e11af9901ad2e44b025f8e773c6cc7a7173
BLAKE2b-256 checksum
How to use checksums
2605fdf767b3da8fc8e2d78eef15c98a5ead03be2753b4e9cfcda58f0995f0b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / anthropic-2.12.0-py3-none-any.whl

Download URL anthropic-2.12.0-py3-none-any.whl
Size 2.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8631e3880ee18b0f87ce61d5d08e67804200463cf27c4182024715e232c99ba6
BLAKE2b-256 checksum
How to use checksums
4aa61cde7a75d1be07582f6b3c2dd12ddba9d1fb278f5b9685f30dbf6b39dc2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for anthropic 2.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.12.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page