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)
- Anthropic (TypeScript)
- LangChain
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"}],
)
Anthropic (TypeScript)
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
baseURL: 'http://<gateway>:8787',
apiKey: '<your-gateway-key>',
defaultHeaders: { 'x-anyray-provider': 'anthropic' },
});
LangChain
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(
base_url="http://<gateway>:8787",
api_key="<your-gateway-key>",
model="claude-sonnet-5",
default_headers={"x-anyray-provider": "anthropic"},
)