Anthropic Python SDK 发布 v2.12.0 版本
作者:anthropic-sdks-releaser[bot]原标题:v2.12.0
38AI 研判分
Anthropic 发布 Python SDK v2.12.0,为 Python 应用提供 Claude API 的官方接入能力,要求 Python 3.10 及以上版本。该版本属于例行小版本更新,文档与安装方式保持不变,示例中默认模型指向 claude-opus-5-5。
报道正文
本文目录4 个章节
Anthropic SDK for Python
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 anthropicUpgrading 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+