Migrate from OpenRouter

Complete guide for migrating from OpenRouter to BitRouter

Migrating from OpenRouter to BitRouter

This guide walks you through migrating your existing OpenRouter integration to BitRouter, highlighting key differences and advantages.

Why Migrate?

BitRouter offers several advantages over OpenRouter for agent workloads:

FeatureOpenRouterBitRouter
DeploymentCloud-only (closed-source)Self-host or cloud (Apache 2.0)
Platform Fee5.5% via Stripe2% via stablecoins · 5% via Stripe
Agent FeaturesBasic routingHeadless CLI, agentic payment, MCP/ACP gateway
AccessAccount registration requiredNo registration required

Migration Path

Step 1: Get your BitRouter API key

Option A: Headless CLI (recommended)

Install the CLI and sign in — bitrouter auth login runs the RFC 8628 device-code flow, opens an approval URL in your browser, and persists the resulting OAuth credential (auto-refreshed) under $XDG_DATA_HOME/bitrouter/account-credentials.json. After that, every request through the bitrouter provider is authenticated automatically — no API key in your config:

npm install -g bitrouter
bitrouter auth login

Inspect the local session with bitrouter auth whoami, and manage account-level resources (API keys, usage, billing, policies, BYOK, OAuth clients) with bitrouter cloud --help.

Option B: Dashboard

Sign up at cloud.bitrouter.ai and copy your API key from the dashboard.

Step 2: Update base URL and API key

That's the full migration. Replace your OpenRouter endpoint and key with BitRouter's:

# Before (OpenRouter)
client = openai.OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key=OPENROUTER_API_KEY,
)

# After (BitRouter)
client = openai.OpenAI(
    base_url="https://api.bitrouter.ai/v1",
    api_key=BITROUTER_API_KEY,
)
// Before (OpenRouter)
const client = new OpenAI({
  baseURL: 'https://openrouter.ai/api/v1',
  apiKey: OPENROUTER_API_KEY,
});

// After (BitRouter)
const client = new OpenAI({
  baseURL: 'https://api.bitrouter.ai/v1',
  apiKey: BITROUTER_API_KEY,
});
# Before (OpenRouter)
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'

# After (BitRouter)
curl https://api.bitrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $BITROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'

Headers to Remove

If your OpenRouter integration sets any of these headers, you can safely drop them:

OpenRouter headerStatus in BitRouter
HTTP-RefererNot used
X-TitleNot used
transformsNot used — guardrails are configured server-side
routeNot used — provider routing is configured in the dashboard

Next Steps

Need Help?

How is this guide?

Last updated on

On this page