Anthropic TypeScript SDK with MagmaRouter

The TypeScript Anthropic SDK mirrors the Python one: a configurable baseURL and an authToken that goes out as a bearer header.
- Base URL
- https://api.magmarouter.com
- API key
- Get one, starts sk-mr-
- Example model
- glm-5.3-xploded
baseURL and authToken
TypeScript
// npm install @anthropic-ai/sdk import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ baseURL: "https://api.magmarouter.com", authToken: "sk-mr-...", }); const msg = await client.messages.create({ model: "glm-5.3-xploded", max_tokens: 1024, messages: [{ role: "user", content: "Hello" }], }); console.log(msg.content[0].text);
Use baseURL: "https://api.magmarouter.com" (no /v1) and authToken for the key. The SDK can also read ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment if you prefer not to pass them in code.