API v1 — OpenAI Compatible

Keep your client.
Change the endpoint.

Drop-in OpenAI-compatible API. Route across 1000+ models, 30+ providers with automatic failover, load balancing, and usage tracking. Zero client code changes.

REQUEST PATH
/v1/chat/completions
AUTH
Bearer vr-***
MODEL
gpt-4o
STREAM
true / false

01 Quickstart

Get from zero to your first API call in under a minute.

1

Create a key

Sign up and grab your API key from the dashboard. No credit card required.

vr-••••••••••••••••
2

Set your base URL

Point any OpenAI-compatible client at VRouter. Zero code changes needed.

Base URL
https://vrouter.my.id/v1
3

Send your first request

Pick your language. The API is fully OpenAI-compatible.

# cURL
curl https://vrouter.my.id/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer *** \
  -d '{
    "model": 'nemotron-3.5-lite',
    "messages": [
      {"role": "user", "content": "Hello, world!"}
    ]
  }'
# pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://vrouter.my.id/v1",
    api_key="***",
)

response = client.chat.completions.create(
    model='nemotron-3.5-lite',
    messages=[{"role": "user", "content": "Hello, world!"}]
)

print(response.choices[0].message.content)
// npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://vrouter.my.id/v1",
  apiKey: "***",
});

const res = await client.chat.completions.create({
  model: 'nemotron-3.5-lite',
  messages: [{ role: "user", content: "Hello, world!" }],
});

console.log(res.choices[0].message.content);

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": 'nemotron-3.5-lite',
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "Hello! How can I help?" },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 12, "completion_tokens": 8, "total_tokens": 20 }
}

02 Authentication & Keys

Every request requires a valid API key in the Authorization header.

Key format

VRouter keys follow the vr- prefix convention.

# Include in every request header
Authorization: Bearer vr-...here
from openai import OpenAI

client = OpenAI(
    base_url="https://vrouter.my.id/v1",
    api_key="***",  # set automatically as Bearer
)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://vrouter.my.id/v1",
  apiKey: "***",  // auto-injected as Bearer
});

Header reference

Header Type Required Description
Authorization string Required Bearer token — your VRouter API key
Content-Type string Required Must be application/json
⚠

Key rotation

Rotate keys regularly from your dashboard. Old keys are revoked instantly. Never expose keys in client-side code or public repositories.

03 Routes

Complete API endpoint reference. All routes are prefixed with /v1.

GET /v1/models No auth required

List all available models across all providers.

Response
{
  "object": "list",
  "total": 127,
  "data": [
    { "id": 'nemotron-3.5-lite', "name": "GPT 4O", "provider": "openai" },
    { "id": "claude-3-5-sonnet", "name": "CLAUDE 3 5 SONNET", "provider": "anthropic" },
    { "id": "google/gemini-2.0-flash", "name": "GEMINI 2 0 FLASH", "provider": "google" }
  ]
}
POST /v1/chat/completions Auth required

Create a model response for the given chat conversation. Fully OpenAI-compatible.

Request body
Parameter Type Required Description
model string Yes Model ID, e.g. gpt-4o or anthropic/claude-3-5-sonnet
messages array Yes Chat messages with role and content
stream boolean No Enable SSE streaming. Default: false
temperature number No Sampling temperature 0–2. Default: 1
max_tokens integer No Maximum tokens to generate
top_p number No Nucleus sampling. Default: 1
💡

Use provider/model syntax for explicit routing: openai/gpt-4o, anthropic/claude-3-5-sonnet. Or bare gpt-4o for smart auto-routing.

GET /v1/usage Auth required

Retrieve your usage stats: total requests, token counts, and per-model breakdown for the last 24 hours.

04 Streaming

Receive responses token-by-token via Server-Sent Events (SSE). Ideal for real-time UIs.

curl https://vrouter.my.id/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer *** \
  -d '{
    "model": 'nemotron-3.5-lite',
    "messages": [{"role": "user", "content": "Count to 5"}],
    "stream": true
  }' --no-buffer
from openai import OpenAI

client = OpenAI(
    base_url="https://vrouter.my.id/v1",
    api_key="***",
)

with client.chat.completions.create(
    model='nemotron-3.5-lite',
    messages=[{"role": "user", "content": "Count to 5"}],
    stream=True,
) as response:
    for chunk in response:
        delta = chunk.choices[0].delta.content
        if delta:
            print(delta, end="", flush=True)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://vrouter.my.id/v1",
  apiKey: "***",
});

const stream = await client.chat.completions.create({
  model: 'nemotron-3.5-lite',
  messages: [{ role: "user", content: "Count to 5" }],
  stream: true,
});

for await (const chunk of stream) {
  const text = chunk.choices[0]?.delta?.content;
  if (text) process.stdout.write(text);
}

SSE event format

Each chunk is a data: line. The stream ends with data: [DONE].

data: {"choices": [{"delta": {"content": "1"}}]}
data: {"choices": [{"delta": {"content": " "}}]}
data: {"choices": [{"delta": {"content": "2"}}]}
data: {"choices": [{"delta": {"content": " "}}]}
data: {"choices": [{"delta": {"content": "3"}}]}
data: [DONE]

05 Models

VRouter provides access to 1000+ models across 30+ providers. Use the model ID directly or prefix with provider for explicit routing.

Model routing syntax

Syntax Behavior Example
model-name Auto-route across providers gpt-4o
provider/model Force specific provider openai/gpt-4o
provider/alias Provider alias resolution anthropic/claude-3-5-sonnet

Popular models

gpt-4o
OpenAI · Flagship
gpt-4o-mini
OpenAI · Fast & affordable
claude-3-5-sonnet
Anthropic · Reasoning
claude-3-haiku
Anthropic · Fast
gemini-2.0-flash
Google · Multimodal
llama-3.1-405b
Meta · Open-source
ℹ

Run GET /v1/models for the complete, up-to-date list of all available models.

06 Errors

VRouter uses standard HTTP status codes. All errors return a consistent JSON structure.

Error response format
{
  "error": {
    "message": "Human-readable error description",
    "type": "error_type",
    "code": "machine_readable_code"
  }
}
400 Bad Request

Missing or invalid parameters.

{"error": {"message": "Missing required parameter: model", "type": "invalid_request_error"}}
401 Unauthorized

Invalid or missing API key.

{"error": {"message": "Invalid API key", "type": "authentication_error"}}
403 Forbidden

Account deactivated or key lacks permission.

429 Rate Limited

Too many requests. Implement exponential backoff.

{"error": {"message": "Rate limit exceeded", "type": "rate_limit_error", "code": "rate_limit"}}
503 Service Unavailable

Backend provider temporarily unreachable. VRouter will retry with failover.

07 TypeScript

Full type support via the official OpenAI SDK. VRouter is a drop-in replacement — just change the base URL.

// install: npm install openai
import OpenAI, type { ChatCompletion } from "openai";

const client = new OpenAI({
  baseURL: "https://vrouter.my.id/v1",
  apiKey: process.env.VROUTER_API_KEY,
});

const completion: ChatCompletion = await client.chat.completions.create({
  model: 'nemotron-3.5-lite',
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user",   content: "What is the capital of France?" },
  ],
  temperature: 0.7,
});

console.log(completion.choices[0].message.content);
// Fully typed — IDE autocomplete works on every field
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://vrouter.my.id/v1",
  apiKey: process.env.VROUTER_API_KEY,
});

const stream = await client.chat.completions.create({
  model: 'nemotron-3.5-lite',
  messages: [{ role: "user", content: "Write a haiku about code" }],
  stream: true,
});

for await (const chunk of stream) {
  const content = chunk.choices[0]?.delta?.content;
  if (content) process.stdout.write(content);
}
import OpenAI from "openai";
import type {
  ChatCompletionMessageParam,
  ChatCompletionCreateParams,
} from "openai/resources";

const client = new OpenAI({
  baseURL: "https://vrouter.my.id/v1",
  apiKey: process.env.VROUTER_API_KEY,
});

// Typed helper function
async function chat(
  messages: ChatCompletionMessageParam[],
  model: string = 'nemotron-3.5-lite'
): Promise<string> {
  const res = await client.chat.completions.create({
    model,
    messages,
  });
  return res.choices[0].message.content ?? "";
}

// Usage
const reply = await chat([
  { role: "user", content: "Hello!" },
]);
console.log(reply);

08 IDE Integrations

Use VRouter as a drop-in backend for your favorite AI coding tools. Just point them at our endpoint.

⚡

Cursor

AI code editor

Settings → Models → Add custom model endpoint:

Base URL:  https://vrouter.my.id/v1
API Key:   ***
Model:     gpt-4o
🔄

Continue

VS Code / JetBrains extension

Edit ~/.continue/config.json:

{
  "models": [{
    "title": "VRouter GPT-4o",
    "provider": "openai",
    "model": 'nemotron-3.5-lite',
    "apiBase": "https://vrouter.my.id/v1",
    "apiKey": "***"
  }]
}
🤖

Cline (formerly Claude Dev)

VS Code extension

Extension settings → API Provider → OpenAI Compatible:

Base URL:  https://vrouter.my.id/v1
API Key:   ***
Model ID:  gpt-4o
🌐

Open WebUI

Self-hosted ChatGPT interface

Admin → Settings → Connections → OpenAI API:

OPENAI_API_BASE_URLS:  https://vrouter.my.id/v1
OPENAI_API_KEYS:       ***

09 Status

Check system health and availability.

GET /health No auth required

Returns system health, user count, uptime, and total requests.

{
  "status": "ok",
  "vrouter": "online",
  "users": 1247,
  "uptime": 864291,
  "total_requests": 52841
}