Anthropic Python SDK

Anthropic Python SDK

โ˜… 3.8 ๐Ÿ”– 1200 saves ๐Ÿ’ฐ Free GitHub

The Anthropic Python SDK is the official client library for the Anthropic API, maintained by Anthropic on GitHub where it has about 4,000 stars. It gives Python developers a typed, idiomatic way to call Claude models for messages, streaming, tool use and the rest of the platform’s features.

Overview

The SDK wraps the Anthropic REST API with both synchronous and asynchronous clients, full type annotations for requests and responses, and automatic handling of retries, timeouts and pagination. It supports streaming responses token by token, structured tool use and function calling, extended thinking, batch processing and file uploads, and it tracks new API capabilities closely as they ship. Because it is generated from the API specification with hand-written convenience layers, it stays current while still feeling like a native Python library, complete with Pydantic models and httpx-based transport that can be customized or mocked in tests.

Key Features

  • Official, fully typed Python client for the Anthropic API
  • Sync and async clients with streaming support
  • Tool use, extended thinking, batches and files APIs covered
  • Automatic retries, configurable timeouts and error handling
  • Pydantic response models for safe, structured parsing
  • Customizable HTTP transport for proxies and testing

๐Ÿ’ณ Pricing

The SDK itself is free and open source under the MIT license. Using it requires an Anthropic API key, and API calls to Claude models are billed by Anthropic according to their standard usage pricing.

Who Is It For

This SDK is for Python developers building applications on Claude, from chatbots and agents to data pipelines, who want the supported, type-safe way to integrate the Anthropic API.

๐Ÿš€ Visit Anthropic Python SDK Official Site

๐Ÿšฉ Report an issue