Back to home

Guide

Compatible Endpoint

Virouter exposes one OpenAI-compatible base URL for both OpenAI and Anthropic models. Point your existing client athttps://virouter.com and authenticate with your Virouter API key.

Base URL and auth

Virouter keys start with the vr_sk_ prefix. Generate them under the Dashboard and treat them like any other secret: keep them in environment variables only.

cURL example

The OpenAI Chat Completions JSON shape works as-is. The same structure routes to Anthropic models when you pass a Claude model id.

curl https://virouter.com/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer vr_sk_xxxxxxxxxxxx" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      { "role": "user", "content": "Summarize what Virouter does." }
    ]
  }'

OpenAI SDK example

Set baseURL on the OpenAI client. No other code changes are required.

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.VIROUTER_API_KEY,
  baseURL: "https://virouter.com/api/v1",
});

const reply = await client.chat.completions.create({
  model: "claude-sonnet-4-6",
  messages: [{ role: "user", content: "Hello Virouter" }],
});