pythonimport anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude!"}]
)
print(message.content[0].text)modelsVisit Site ↗
Claude Sonnet 4
Anthropic's balanced model offering strong reasoning and coding capabilities with excellent safety alignment.
Pricing
$3
Input ($/million tokens)
$15
Output ($/million tokens)