Anthropic SDK Compatibility
Use Anthropic SDK with Infron AI models
Quick Start Guide
1. Install the Anthropic SDK
pip install anthropic2. Initialize the Client
export ANTHROPIC_BASE_URL="https://llm.onerouter.pro"
export ANTHROPIC_API_KEY="<<Your API Key>>"import anthropic
client = anthropic.Anthropic(
base_url="https://llm.onerouter.pro",
api_key="<<Your API Key>>"
)
message = client.messages.create(
model="claude-sonnet-4@20250514",
max_tokens=1000,
temperature=1,
system=[
{
"type": "text",
"text": "You are a world-class poet. Respond only with short poems."
}
],
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Why is the ocean salty?"
}
]
}
]
)
print(message.content)Last updated