Anthropic Python SDK

Route the Anthropic SDK through HiWay via base_url.

The Anthropic Python SDK doesn't natively support arbitrary base URLs, but it does expose base_url in the Anthropic() constructor. Since HiWay speaks OpenAI chat-completions (not the Messages API), you'll want the OpenAI SDK with `base_url` override rather than the Anthropic SDK itself — this is the cleanest path today.

Different wire format

HiWay exposes the OpenAI /v1/chat/completions wire format. If you have existing code using the Anthropic Messages API, you'll need to migrate it to the OpenAI format (or we can talk about a native Anthropic-format adapter — open a ticket).

Recommended: OpenAI SDK targeting a Claude tier

python
from openai import OpenAI

client = OpenAI(
    base_url="https://www.hiway2llm.com/v1",
    api_key="hwy_YOUR_KEY",
)

response = client.chat.completions.create(
    # Pin directly to a Claude tier — HiWay routes to the right model
    model="claude-sonnet",
    messages=[{"role": "user", "content": "Summarize Hegel in one paragraph"}],
)

print(response.choices[0].message.content)