Anthropic SDK
Use the official Anthropic SDK unchanged. Set the base URL to the Gateway (no /v1 — the SDK appends /v1/messages itself), pass a project API key, and call any model returned by GET /v1/models.
Configure the client#
Send a first request#
from anthropic import Anthropic
client = Anthropic(base_url="https://api.atptoken.ai", api_key="atp-...")
msg = client.messages.create(
model="<model from GET /v1/models>",
max_tokens=256,
messages=[{"role": "user", "content": "hi"}],
)
print(msg.content[0].text)Streaming and the system prompt#
Set stream=True for SSE streaming — see Anthropic SSE. The top-level system field accepts a string or an array of text blocks.
Next steps
Was this page helpful?