Anthropic SDK Compatibility
Siraya Model Router provides a compatibility API that allows you to use the Anthropic SDK with Siraya Model Router models. This is useful if you are already using the Anthropic SDK and want to switch to Siraya Model Router models.
Quick Start Guide
This guide demonstrates how to use the Anthropic SDK with the Siraya Model Router models step by step.
1. Install the Anthropic SDK
2. Initialize the Client
The Anthropic SDKs are designed to pull the API key and base URL from the environmental variables: ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL. Also, you can supply the parameters to the Anthropic client when initializing it.
- Using Environment Variables
- Set the parameters while initializing the Anthropic client
import anthropic
client = anthropic.Anthropic(
base_url="https://llm.siraya.ai",
api_key="<API_KEY>"
)
message = client.messages.create(
model="claude-sonnet-4.5",
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)