Vichar
Migrations

Migrate from OpenRouter

Switch to Vichar for built-in analytics, self-hosting options, and free bring-your-own-keys at any volume. Two-line code change.

Vichar works just like OpenRouter—same OpenAI-compatible API, same provider/model naming—with built-in analytics and the option to self-host. Migration takes two lines of code.

Stripe announced its acquisition of OpenRouter on August 19, 2026. OpenRouter says nothing changes for customers, so there is no fire to put out. This guide is for teams that want an open-source gateway they can run themselves, or that want to stop paying 5% on bring-your-own-key traffic above $25,000 a month.

Let your AI agent do the migration

Copy this prompt into Claude Code, Cursor, or any coding agent — it reads our docs and handles the migration from OpenRouter for you.

Quick Migration

Change your base URL and API key:

- const baseURL = "https://openrouter.ai/api/v1";
- const apiKey = process.env.OPENROUTER_API_KEY;
+ const baseURL = "https://api.vichar.io/v1";
+ const apiKey = process.env.LLM_GATEWAY_API_KEY;

Migration Steps

Get Your Vichar API Key

Sign up at app.vichar.io/signup and create an API key from your dashboard.

Update Environment Variables

# Remove OpenRouter credentials
# OPENROUTER_API_KEY=sk-or-...

# Add Vichar credentials
LLM_GATEWAY_API_KEY=vichar_your_key_here

Update Your Code

Using fetch/axios

The OpenRouter-only HTTP-Referer and X-Title headers can go; nothing on Vichar reads them.

// Before (OpenRouter)
const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
	method: "POST",
	headers: {
		Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,
		"HTTP-Referer": "https://example.com",
		"X-Title": "My App",
		"Content-Type": "application/json",
	},
	body: JSON.stringify({
		model: "openai/gpt-6-astra",
		messages: [{ role: "user", content: "Hello!" }],
	}),
});

// After (Vichar)
const response = await fetch("https://api.vichar.io/v1/chat/completions", {
	method: "POST",
	headers: {
		Authorization: `Bearer ${process.env.LLM_GATEWAY_API_KEY}`,
		"Content-Type": "application/json",
	},
	body: JSON.stringify({
		model: "openai/gpt-6-astra",
		messages: [{ role: "user", content: "Hello!" }],
	}),
});

Using OpenAI SDK

import OpenAI from "openai";

// Before (OpenRouter)
const client = new OpenAI({
	baseURL: "https://openrouter.ai/api/v1",
	apiKey: process.env.OPENROUTER_API_KEY,
});

// After (Vichar)
const client = new OpenAI({
	baseURL: "https://api.vichar.io/v1",
	apiKey: process.env.LLM_GATEWAY_API_KEY,
});

// Usage remains the same
const completion = await client.chat.completions.create({
	model: "anthropic/claude-sonnet-5",
	messages: [{ role: "user", content: "Hello!" }],
});

Using Vercel AI SDK

Both OpenRouter and Vichar have native AI SDK providers, making migration straightforward:

import { generateText } from "ai";

// Before (OpenRouter AI SDK Provider)
import { createOpenRouter } from "@openrouter/ai-sdk-provider";

const openrouter = createOpenRouter({
	apiKey: process.env.OPENROUTER_API_KEY,
});

const { text } = await generateText({
	model: openrouter("openai/gpt-6-astra"),
	prompt: "Hello!",
});

// After (Vichar AI SDK Provider)
import { createLLMGateway } from "@llmgateway/ai-sdk-provider";

const llmgateway = createLLMGateway({
	apiKey: process.env.LLM_GATEWAY_API_KEY,
});

const { text } = await generateText({
	model: llmgateway("openai/gpt-6-astra"),
	prompt: "Hello!",
});

Model Name Mapping

Most OpenRouter IDs work unchanged. A bare ID (no prefix) turns on smart routing across every provider that serves the model; a provider/model ID pins one provider. Anthropic versions use dashes instead of OpenRouter's dots.

OpenRouter ModelVichar Model
openai/gpt-6-astragpt-6-astra or openai/gpt-6-astra
anthropic/claude-sonnet-5claude-sonnet-5 or anthropic/claude-sonnet-5
anthropic/claude-opus-4.8claude-opus-4-8 or anthropic/claude-opus-4-8
google/gemini-3.1-pro-previewgemini-3.1-pro-preview or google-ai-studio/gemini-3.1-pro-preview

Check the models page for the full list of available models.

Provider Routing

OpenRouter selects the upstream through a provider object in the request body. Vichar puts that choice in the model ID and a header:

OpenRouterVichar
No provider objectBare model ID — routes on live uptime, throughput, price, and latency
provider.order: ["Anthropic"]anthropic/claude-sonnet-5 — pinned; falls back to the best alternative only if its uptime drops below 90%
provider.order with several entriesProvider routing preferences applied as an ordered fallback list
provider.allow_fallbacks: falseAdd the x-no-fallback: true header to fail instead of retrying elsewhere

See the routing documentation for the details.

Streaming Support

Vichar supports streaming responses identically to OpenRouter:

const stream = await client.chat.completions.create({
	model: "anthropic/claude-sonnet-5",
	messages: [{ role: "user", content: "Write a story" }],
	stream: true,
});

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

Full Comparison

Want to see a detailed breakdown of all features? See Quick Start.

How is this guide?

Last updated on

On this page

Ready for production?

Ship to production with SSO, audit logs, spend controls, and guardrails your security team will approve.

Explore Enterprise