Anthropic SDK

Anthropic SDK

LivRouter is compatible with the Anthropic SDK. To use it, simply set the base_url to https://api.livrouter.com (without a /v1 suffix — the SDK appends /v1/messages itself) and use your LivRouter API key.

python
import anthropic client = anthropic.Anthropic(    base_url="https://api.livrouter.com/",    api_key="your-livrouter-api-key") message = client.messages.create(    model="claude-sonnet-4-6",    max_tokens=1024,    messages=[        {"role": "user", "content": "Hello, Claude"}    ]) print(message.content[0].text)