From OpenRouter

Migrate from OpenRouter

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

Published · Updated

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.

PassingRight 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.

If Stripe's acquisition of OpenRouter (announced August 19, 2026) is what brought you here: 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.

Quick Migration

Change your base URL and API key:

1- const baseURL = "https://openrouter.ai/api/v1";2- const apiKey = process.env.OPENROUTER_API_KEY;3+ const baseURL = "https://api.passingright.io/v1";4+ const apiKey = process.env.LLM_GATEWAY_API_KEY;

Migration Steps

1. Get Your PassingRight API Key

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

2. Update Environment Variables

1# Remove OpenRouter credentials2# OPENROUTER_API_KEY=sk-or-...3
4# Add PassingRight credentials5LLM_GATEWAY_API_KEY=llmgtwy_your_key_here

3. Update Your Code

Using fetch/axios

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

1// Before (OpenRouter)2const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {3  method: "POST",4  headers: {5    Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`,6    "HTTP-Referer": "https://example.com",7    "X-Title": "My App",8    "Content-Type": "application/json",9  },10  body: JSON.stringify({11    model: "openai/gpt-6-astra",12    messages: [{ role: "user", content: "Hello!" }],13  }),14});15
16// After (PassingRight)17const response = await fetch("https://api.passingright.io/v1/chat/completions", {18  method: "POST",19  headers: {20    Authorization: `Bearer ${process.env.LLM_GATEWAY_API_KEY}`,21    "Content-Type": "application/json",22  },23  body: JSON.stringify({24    model: "openai/gpt-6-astra",25    messages: [{ role: "user", content: "Hello!" }],26  }),27});

Using OpenAI SDK

1import OpenAI from "openai";2
3// Before (OpenRouter)4const client = new OpenAI({5  baseURL: "https://openrouter.ai/api/v1",6  apiKey: process.env.OPENROUTER_API_KEY,7});8
9// After (PassingRight)10const client = new OpenAI({11  baseURL: "https://api.passingright.io/v1",12  apiKey: process.env.LLM_GATEWAY_API_KEY,13});14
15// Usage remains the same16const completion = await client.chat.completions.create({17  model: "anthropic/claude-sonnet-5",18  messages: [{ role: "user", content: "Hello!" }],19});

Using Vercel AI SDK

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

1import { generateText } from "ai";2
3// Before (OpenRouter AI SDK Provider)4import { createOpenRouter } from "@openrouter/ai-sdk-provider";5
6const openrouter = createOpenRouter({7  apiKey: process.env.OPENROUTER_API_KEY,8});9
10const { text } = await generateText({11  model: openrouter("openai/gpt-6-astra"),12  prompt: "Hello!",13});14
15// After (PassingRight AI SDK Provider)16import { createLLMGateway } from "@llmgateway/ai-sdk-provider";17
18const llmgateway = createLLMGateway({19  apiKey: process.env.LLM_GATEWAY_API_KEY,20});21
22const { text } = await generateText({23  model: llmgateway("openai/gpt-6-astra"),24  prompt: "Hello!",25});

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 Model PassingRight Model
openai/gpt-6-astra gpt-6-astra or openai/gpt-6-astra
anthropic/claude-sonnet-5 claude-sonnet-5 or anthropic/claude-sonnet-5
anthropic/claude-opus-4.8 claude-opus-4-8 or anthropic/claude-opus-4-8
google/gemini-3.1-pro-preview gemini-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. PassingRight puts that choice in the model ID and a header:

OpenRouter PassingRight
No provider object Bare 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 entries A dynamic route whose providers list is the same ordered fallback preference
provider.allow_fallbacks: false Add the x-no-fallback: true header to fail instead of retrying elsewhere
Your own provider keys (BYOK) Add keys under Settings > Provider Keys — 0% gateway fee at any monthly volume

See the routing and dynamic routes documentation for the details.

Streaming Support

PassingRight supports streaming responses identically to OpenRouter:

1const stream = await client.chat.completions.create({2  model: "anthropic/claude-sonnet-5",3  messages: [{ role: "user", content: "Write a story" }],4  stream: true,5});6
7for await (const chunk of stream) {8  process.stdout.write(chunk.choices[0]?.delta?.content || "");9}

Full Comparison

Want to see a detailed breakdown of all features? Check out our PassingRight vs OpenRouter comparison page, or the best OpenRouter alternatives in 2026 if you are still weighing options.

Need Help?