Anthropic
Claude 4 Sonnet
anthropic/claude-4-sonnet
Claude Sonnet 4 significantly improves on Sonnet 3.7's industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations. While not matching Opus 4 in most domains, it delivers an optimal mix of capability and practicality.
Capability
Vision Support
Tools
Function Calling
Context Window
200,000
Max Output Tokens
8,192
Using Claude 4 Sonnet with Python API
Using Claude 4 Sonnet with OpenAI compatible API
import openai
client = openai.Client(
api_key= '{your_api_key}',
base_url="https://api.model.box/v1",
)
response = client.chat.completions.create(
model="anthropic/claude-4-sonnet",
messages: [
{
role: 'user',
content:
'introduce your self',
},
]
)
print(response)