Skip to content
TokenCenter Get API key

Docs › Migrate from OpenRouter

Migrate from OpenRouter

Change two lines: the base URL and the key. Model IDs stay the same.

The change

Both APIs are OpenAI-compatible and use the same model IDs, so most apps only need a new base URL and key.

Config
# Before: OpenRouter
base_url = "https://openrouter.ai/api/v1"
api_key  = "sk-or-v1-…"
model    = "mistralai/ministral-3b-2512"

# After: TokenCenter
base_url = "https://api.tokenctr.com/v1"
api_key  = "ck_…"          # from tokenctr.com/start.html
model    = "mistralai/ministral-3b-2512"   # same model IDs
Python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokenctr.com/v1",   # was https://openrouter.ai/api/v1
    api_key=os.environ["TOKENCENTER_API_KEY"],
)
JavaScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.tokenctr.com/v1",   // was https://openrouter.ai/api/v1
  apiKey: process.env.TOKENCENTER_API_KEY,
});
curl
curl https://api.tokenctr.com/v1/chat/completions \
  -H "Authorization: Bearer $TOKENCENTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/ministral-3b-2512",
    "messages": [{"role": "user", "content": "Say hello in five words."}],
    "max_tokens": 100
  }'

What’s different

TokenCenter
StreamingNot available yet. Turn streaming off in your tool or send "stream": false.
Models284 OpenRouter models with fixed per-token prices. Models with variable pricing and :free variants aren’t offered. Check GET /v1/models for the exact list.
PricesThe same input and output prices OpenRouter lists, with zero markup. If the provider reports a higher actual cost for a call, that cost is charged.
CreditSeparate prepaid balance bought on Pricing. OpenRouter credit doesn’t carry over.
HeadersOpenRouter’s HTTP-Referer and X-Title headers aren’t needed and have no effect.
Request fieldsYour request body is passed through unchanged, so fields like tools, response_format, reasoning and provider behave as they do on OpenRouter.
BalanceEach response includes x-cosmos-credit-balance with your remaining credit.
Limits60 requests per minute per key, 120 per IP address.

Checklist

  1. Get a key and save it.
  2. Add credit to it.
  3. Change the base URL and API key in your app.
  4. Turn off streaming.
  5. Set max_tokens so the hold on your balance stays small.
  6. Make one test call and check the x-cosmos-credit-balance header.