Integration guide
Configure the OpenAI SDK to call Virouter instead of the default OpenAI host. One base URL lets you route GPT and Claude requests through one Virouter API key.
OpenAI SDK baseURL / Python base_url
https://api.virouter.com/v1Keep your API key in a server-side environment variable such as VIROUTER_API_KEY. Never expose it in frontend code.
Use the standard OpenAI package and change only the API key and baseURL.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.VIROUTER_API_KEY,
baseURL: "https://api.virouter.com/v1",
});
const response = await client.chat.completions.create({
model: "gpt-5.5",
messages: [{ role: "user", content: "Hello from Virouter" }],
});
console.log(response.choices[0]?.message?.content);The Python SDK uses base_url.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["VIROUTER_API_KEY"],
base_url="https://api.virouter.com/v1",
)
response = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Summarize this in one paragraph."}],
)
print(response.choices[0].message.content)Use cURL to confirm the endpoint, key, and model id before wiring the SDK into your app.
curl https://api.virouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VIROUTER_API_KEY" \
-d '{
"model": "gpt-5.5",
"messages": [{"role":"user","content":"Say ok"}]
}'Keep the same client and request shape. Change the model value to a Claude id and Virouter routes the request to Anthropic.
await client.chat.completions.create({
model: "claude-opus-4-7",
messages: [{ role: "user", content: "Review this design." }],
});Check Authorization: Bearer vr_sk_... and make sure the key is active in your Virouter dashboard.
Use https://api.virouter.com/v1 as baseURL/base_url. Do not use https://virouter.com/api/v1 for SDK integrations.
Your wallet does not have enough Billing USD Quota for the estimated request. Top up or reduce max output.
No healthy upstream lane is available for that model. Retry later or choose another active model id.