Migrate from OpenRouter to Railwail
Migration Guides

Migrate from OpenRouter to Railwail

Compare OpenRouter and Railwail. Both unify multiple AI models behind one API. Railwail adds EU hosting, EUR billing, and direct provider relationships for better SLAs.

Railwail Team· Developer Relations8 min readMay 16, 2026

TL;DR — Switch in Under 5 Minutes

  • Both APIs are OpenAI-compatible — change baseURL and key
  • Railwail mirrors all major models OpenRouter offers (GPT-4o, Claude, Gemini, Llama, Mistral, DeepSeek)
  • Railwail is EU-hosted with EUR billing — OpenRouter is US-default with USD
  • Railwail has direct provider contracts (vs OpenRouter's mixed credit-pool approach)
  • Cleaner pricing — per-model line items, no per-request overhead beyond FX

Why Move Off OpenRouter?

OpenRouter is one of the original AI aggregators. It works well for personal projects and US-based teams. The gaps for EU production teams: USD billing without VAT receipts, US-default routing, opaque pricing on some models (markup is applied silently), and no EU-only routing guarantee. Railwail addresses each of these — same OpenAI-compatible surface, but with EU residency, EUR invoices, and transparent per-token pricing.

Step 1 — Get a Railwail API Key

Sign up at railwail.com and generate a key.

Sponsored

Access 100+ AI Models with One API Key

GPT-4o, Claude, Gemini, Llama, Flux, DALL-E and more — all through a single, OpenAI-compatible endpoint. No more juggling multiple providers.

Step 2 — Change Base URL

TypeScript / JavaScript

Before (OpenRouter):

import OpenAI from "openai";

const or = new OpenAI({
  apiKey: process.env.OPENROUTER_API_KEY,
  baseURL: "https://openrouter.ai/api/v1",
  defaultHeaders: {
    "HTTP-Referer": "https://your-app.com",
    "X-Title": "My App",
  },
});

const res = await or.chat.completions.create({
  model: "anthropic/claude-3.5-sonnet",
  messages: [{ role: "user", content: "Hello" }],
});
After (Railwail):
import OpenAI from "openai";

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

const res = await client.chat.completions.create({
  model: "claude-sonnet-4-6",
  messages: [{ role: "user", content: "Hello" }],
});
The OpenRouter-specific HTTP-Referer and X-Title headers are not needed — Railwail tracks usage per API key in the dashboard.

Python

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["RAILWAIL_API_KEY"],
    base_url="https://api.railwail.com/v1",
)

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

cURL

curl https://api.railwail.com/v1/chat/completions \
  -H "Authorization: Bearer $RAILWAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

API Endpoint Mapping

OpenRouter endpoint → Railwail equivalent

OpenRouterRailwailNotes
POST /api/v1/chat/completionsPOST /v1/chat/completionsIdentical
POST /api/v1/completionsPOST /v1/completionsLegacy
GET /api/v1/modelsGET /v1/models275+ models
GET /api/v1/auth/keyGET /v1/keys/currentKey metadata
GET /api/v1/generation/{id}GET /v1/usage/{id}Per-call cost lookup

Model Mapping

OpenRouter slug → Railwail slug

OpenRouterRailwailNotes
openai/gpt-4ogpt-4oSame OpenAI model
openai/gpt-4o-minigpt-4o-miniSame
anthropic/claude-3.5-sonnetclaude-sonnet-4-6Latest Sonnet
anthropic/claude-3.5-haikuclaude-haiku-4-6Latest Haiku
google/gemini-2.5-progemini-2.5-proSame
meta-llama/llama-3.3-70b-instructllama-3.3-70b-instructSame
mistralai/mistral-largemistral-large-2411Same
deepseek/deepseek-chatdeepseek-v3Same
deepseek/deepseek-r1deepseek-r1Same
x-ai/grok-2grok-2Same

Sponsored

Test Any AI Model Instantly

Our built-in playground lets you compare models side by side. Find the perfect model for your use case in minutes, not days.

Pricing Comparison (per 1M tokens, May 2026)

Same upstream model, Railwail in EUR vs OpenRouter in USD

ModelOpenRouter (USD)Railwail (EUR)Notes
gpt-4o input$2.50EUR 2.30OpenAI passthrough on both
claude-sonnet-4-6 input$3.00EUR 2.76Anthropic passthrough on both
claude-sonnet-4-6 output$15.00EUR 13.80Same
gemini-2.5-pro input$1.25EUR 1.15Google passthrough on both
llama-3.3-70b-instruct$0.59EUR 0.54Open-source pricing parity
deepseek-v3 input$0.49EUR 0.45Same

Both aggregators charge close to the upstream provider's list price. Railwail's EUR billing eliminates the 1.5-2% FX margin many EU customers pay on USD invoices via their bank.

Why Railwail Over OpenRouter

  • EU hosting with Frankfurt-region inference for low EU latency
  • EUR billing with VAT receipts — clean accounting for EU entities
  • Direct provider contracts on Anthropic, OpenAI, Google (vs OpenRouter's mixed routing)
  • No required HTTP-Referer or X-Title headers
  • Transparent per-token pricing — no hidden markup on rare models
  • Built-in playground for model A/B testing in browser
  • Spend caps, per-key rate limits, audit logs

FAQ

Is the model catalog the same?

OpenRouter has ~250 models, Railwail has ~275. The major frontier models are mirrored on both. Long-tail community fine-tunes may only be on one or the other — check railwail.com/models?search=<model> first.

What about OpenRouter's auto-routing and fallback?

Railwail supports explicit fallback rules in the dashboard (e.g. 'route Claude → GPT-4o on 5xx'). Auto-routing across providers based on cost/latency is on the roadmap; for now you pick the model per call.

Can I keep my OpenRouter credits?

OpenRouter credits are non-transferable. Run both providers in parallel during the migration — use up your OpenRouter balance while ramping up Railwail traffic.

Are usage statistics exportable?

Yes. Railwail dashboard exports per-model, per-key usage as CSV or via the /v1/usage API.

What about prompt caching?

Anthropic prompt caching (cache_control) and OpenAI prompt caching are both forwarded transparently. You get the same discount upstream.

Does it support structured output (json_schema)?

Yes. response_format with json_schema works for any model that supports it upstream (GPT-4o, Claude, Gemini, Llama 3.3).

Sponsored

Pay Only for What You Use

Transparent per-token pricing with no monthly minimums. Start with free credits and scale as you grow.

Next Steps

  • Sign up at railwail.com
  • Generate an API key
  • Update baseURL to https://api.railwail.com/v1
  • Translate slugs (drop the provider/ prefix)
  • Read the reference at railwail.com/docs
  • Browse models at railwail.com/models
  • Compare pricing at railwail.com/pricing
  • View providers at railwail.com/providers

Railwail Team

Developer Relations

The Railwail team writes integration guides for developers migrating from single-provider AI APIs to a unified multi-model platform.

Tags:
OpenRouter
Migration
Multi-Model
API
Aggregator