AIgateway speaks the Anthropic Messages API too. Set the base URL to our Anthropic-shape endpoint and the official anthropic SDK works unchanged — Opus 4.7, Sonnet 4.6, Haiku 4.5, plus tool calling, vision, and streaming.
Same SDK, different host.
import anthropic
client = anthropic.Anthropic(
base_url="https://api.aigateway.sh/anthropic",
api_key="sk-aig-...",
)
msg = client.messages.create(
model="claude-opus-4.7",
max_tokens=1024,
messages=[{"role":"user","content":"hi"}],
)Same on the JS side.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.aigateway.sh/anthropic",
apiKey: process.env.AIGATEWAY_API_KEY,
});