Skip to content

Anthropic Python SDK from NordRouter

Installation:

bash
pip install anthropic

For Anthropic SDK Base URL is specified without /v1:

python
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["NORDROUTER_API_KEY"],
    base_url="https://nordrouter.com",
)

response = client.messages.create(
    model="anthropic/claude-sonnet-4.6",
    max_tokens=256,
    messages=[{"role": "user", "content": "Ответь: работает"}],
)

print(response.content[0].text)

Asynchronous AsyncAnthropic receives the same api_key and base_url; the call to messages.create is made via await.

Official SDK:anthropics/anthropic-sdk-python.

All programs