Skip to main content

Anthropic-native clients

The Anthropic SDKs and LangChain's ChatAnthropic speak the Messages API. Give them the bare origin; the SDK appends /v1/messages itself. Base URLs, client keys, and attribution headers are on SDKs & frameworks.

Anthropic (Python)
from anthropic import Anthropic

client = Anthropic(
base_url="http://<gateway>:8787",
api_key="<your-gateway-key>",
default_headers={"x-anyray-provider": "anthropic"},
)

client.messages.create(
model="claude-sonnet-5",
max_tokens=256,
messages=[{"role": "user", "content": "ping"}],
)