Skip to main content

Migrating from OpenRouter

Both Primex and OpenRouter are OpenAI-compatible aggregators, so migrating is a base-URL and key swap plus a model-name mapping.

1. Change base URL + key​

from openai import OpenAI

client = OpenAI(
base_url="https://gateway.primexos.com/v1", # was https://openrouter.ai/api/v1
api_key="prx-YOUR_KEY", # your Primex key
)

2. Map model names​

Primex uses plain model IDs (e.g. from the catalogue), not OpenRouter's vendor/model slugs. Fetch the live list and map your models:

curl https://gateway.primexos.com/v1/models -H "Authorization: Bearer prx-YOUR_KEY"

See Models and Live Catalogue.

3. Header and routing differences​

  • App-attribution headers. OpenRouter's HTTP-Referer / X-Title headers have no effect on Primex; you can drop them.
  • Provider routing preferences. OpenRouter's provider routing/fallback object does not apply. Primex resolves routing itself; the auto-router is available as a model. See Smart Router.
  • Auth. Use your prx- key; both Authorization: Bearer and x-api-key work.

4. What's the same​

  • OpenAI-compatible /v1/chat/completions, /v1/responses, /v1/embeddings, and more.
  • Streaming, tool calling, and structured outputs: see Guides.

5. Billing​

Billing is post-paid per request from your Primex balance. Failed requests aren't billed; successfully delivered usage is metered. See Billing & Credits and Errors & Limits. Availability and pricing are dynamic. Read the live catalogue rather than caching a model list.