anthropic
The official Python library for the anthropic API
Decision gist · record as of 2026-08-14
Yes. The package is the official, actively maintained SDK for Claude API access, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. Install it if you need to call Claude from Python; it is the standard way to do so.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a valid ANTHROPIC_API_KEY environment variable or explicit API key passed to the Anthropic constructor to authenticate with the Claude API.
- Low friction installation with a pure-wheel distribution.
- Actively maintained with a release 1 day old and recent commits.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects without copyleft obligations.
last release 2026-08-13 (1 days) · last repo commit 2026-08-13 · 3,819 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 185,027,807 downloads/mo, #224 on PyPI
Alternatives
Verify before relying
pip install anthropic
import os
from anthropic import Anthropic
client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))
message = client.messages.create(
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
model="claude-opus-4-6"
)
print(message.content)- Whether the package handles rate limiting or retry logic automatically, or if the caller must implement these.
- Whether streaming responses are supported and how they differ from the shown synchronous example.
- What happens when the ANTHROPIC_API_KEY environment variable is not set or invalid.
What it is and what it does
The anthropic package is the official Python SDK for accessing Anthropic's Claude API. It wraps HTTP communication with Claude's remote models, handling authentication, request serialization, and response parsing so that Python code can send messages and receive completions without managing raw HTTP calls. The package depends on httpx for networking, pydantic for data validation, and several utility libraries (anyio, sniffio, jiter, docstring-parser, distro, typing-extensions) to handle async I/O, JSON parsing, and type hints across Python versions.
Typical usage involves instantiating an Anthropic client with an API key, then calling client.messages.create() with a model name, token limit, and message history. The package handles the details of formatting requests and parsing responses into structured objects. It requires Python 3.9 or later and is actively maintained with support for current Python versions through 3.14.
Use it for
- Building chatbots or conversational agents that delegate reasoning to Claude models without running local inference.
- Integrating Claude into data processing pipelines to generate summaries, classifications, or analyses of text.
- Creating content generation applications (documentation, code, creative writing) that call Claude on demand.
- Prototyping AI features in production applications where API-based access is preferred over self-hosted models.
- Automating customer support or Q&A workflows by routing queries to Claude and formatting responses.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is the official, actively maintained SDK for Claude API access, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. Install it if you need to call Claude from Python; it is the standard way to do so.
Install
anthropic on PyPI
Before you install
Low friction installation with a pure-wheel distribution. Actively maintained with a release 1 day old and recent commits. Depends on common, well-established libraries (httpx, pydantic, anyio) with no compiled dependencies.
Requires a valid ANTHROPIC_API_KEY environment variable or explicit API key passed to the Anthropic constructor to authenticate with the Claude API.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects without copyleft obligations.
Quickstart
pip install anthropic
import os
from anthropic import Anthropic
client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))
message = client.messages.create(
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
model="claude-opus-4-6"
)
print(message.content)
Verify before relying
- Whether the package handles rate limiting or retry logic automatically, or if the caller must implement these.
- Whether streaming responses are supported and how they differ from the shown synchronous example.
- What happens when the ANTHROPIC_API_KEY environment variable is not set or invalid.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 8 packagesanyiodistrodocstring-parserhttpxjiterpydanticsniffiotyping-extensions |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 185,027,807 / month, #224 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: anthropic-0.122.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “claude api python client”
- anthropicProvides Python bindings to the Claude API, enabling applications to…
- llama-index-llms-anthropicIntegrates Anthropic's Claude language models into LlamaIndex…
- pagerduty-mcpAn MCP (Model Context Protocol) server that connects AI assistants in…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also claude-tap · llama-index-llms-anthropic · llm-anthropic · opentelemetry-instrumentation-anthropic · claude-code-sdk · claude-agent-sdk · any-llm-sdk · openinference-instrumentation-anthropic · together · xinference-client