Claude API · Setup and first request
Send your first message (Python)
Create a client and send one message. The response content is a list of blocks, so check each block's type.
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
for block in response.content:
if block.type == "text":
print(block.text)
Official Claude API documentation
More setup and first request commands
- Install the Python SDK
- Install the TypeScript SDK
- Set your API key
- Send your first message (TypeScript)
- Send your first message (curl)
- Pick a model
All setup and first request commands · Claude API cheatsheet