SDKs
ModelPilot is a drop-in proxy, so there's no new client library to learn — you use the official Claude SDK and change one line: the base URL. We ship a tiny helper to make that a one-liner.
modelpilot-client on :8400). Your
Anthropic key stays local; only a task category + token counts ever reach ModelPilot.Python
Use the official anthropic SDK with the base URL pointed at the proxy:
# plain — official Anthropic SDK, one changed line from anthropic import Anthropic client = Anthropic(base_url="http://127.0.0.1:8400") msg = client.messages.create( model="claude-opus-4-8", max_tokens=512, messages=[{"role": "user", "content": "Summarize this ticket…"}], )
Or with the bundled helper — it reads MODELPILOT_PROXY_URL (default :8400) and
ANTHROPIC_API_KEY for you:
# one-liner helper (ships with modelpilot-client) from modelpilot import anthropic_client client = anthropic_client() # configured Anthropic() # async, and overrides, work too: from modelpilot import async_anthropic_client aclient = async_anthropic_client(proxy="http://127.0.0.1:8400", timeout=30)
Everything else — streaming, tools, structured outputs — is unchanged; you're talking to the real Claude Messages API through the proxy.
TypeScript / JavaScript
Same idea with @anthropic-ai/sdk — set baseURL:
// npm i @anthropic-ai/sdk import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ baseURL: process.env.MODELPILOT_PROXY_URL ?? "http://127.0.0.1:8400", apiKey: process.env.ANTHROPIC_API_KEY, // stays local }); const msg = await client.messages.create({ model: "claude-opus-4-8", max_tokens: 512, messages: [{ role: "user", content: "Classify this review…" }], });
Prefer a one-liner? Drop this helper in your project:
// modelpilot.ts import Anthropic from "@anthropic-ai/sdk"; export const modelpilot = (opts: ConstructorParameters<typeof Anthropic>[0] = {}) => new Anthropic({ baseURL: process.env.MODELPILOT_PROXY_URL ?? "http://127.0.0.1:8400", apiKey: process.env.ANTHROPIC_API_KEY, ...opts, });
curl / other languages
Any language works — point requests at the proxy instead of api.anthropic.com:
curl http://127.0.0.1:8400/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{"model":"claude-opus-4-8","max_tokens":512, "messages":[{"role":"user","content":"hello"}]}'
The response includes x-modelpilot-decision and
x-modelpilot-routed headers so you can see what was routed.
© 2026 ModelPilot · krethikram@gmail.com