Integration guide
Virouter lets you call Claude models with the OpenAI SDK chat completions shape. Change the baseURL, keep one Virouter API key, and choose a Claude model id.
Use the Virouter OpenAI-compatible endpoint as your SDK base URL. Store the key server-side in VIROUTER_API_KEY.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.VIROUTER_API_KEY,
baseURL: "https://api.virouter.com/v1",
});Keep the OpenAI chat completions method and pass a Claude model id. Virouter routes the request to the Anthropic lane behind the scenes.
const response = await client.chat.completions.create({
model: "claude-opus-4-7",
messages: [
{ role: "system", content: "You are concise and practical." },
{ role: "user", content: "Review this API design." },
],
});
console.log(response.choices[0]?.message?.content);Your app can use the same client and wallet for both provider families. Change only the model field.
await client.chat.completions.create({
model: "gpt-5.5",
messages,
});
await client.chat.completions.create({
model: "claude-sonnet-4-6",
messages,
});Available models depend on active provider channels and your key allowlist. Use GET /v1/models for the current list.
| Model id | Use case |
|---|---|
| claude-opus-4-7 | High-quality reasoning lane when available. |
| claude-opus-4-6 | Opus tier for deep analysis and long-context work. |
| claude-sonnet-4-6 | Balanced Claude model for product workloads. |
| claude-fable-5-20260612 | Claude Fable 5 lane at $10 / $50 per M input/output tokens when enabled. |
Claude calls through the OpenAI SDK still return Virouter gateway headers for cost and quota tracking.
x-virouter-cost-usdBilling USD cost for the completed Claude request.
x-virouter-remaining-usdRemaining Billing USD Quota.
x-virouter-input-tokensInput tokens.
x-virouter-output-tokensOutput tokens.
The model id is not currently active for your key or provider channel. Call /v1/models or check model access docs.
The Virouter key is missing, invalid, revoked, or not sent as Authorization: Bearer vr_sk_...
Your Billing USD Quota is too low for the estimated request. Top up or lower max output.
No healthy Anthropic lane is available for that Claude model. Retry or choose another active model.