Integrations
Migrate from OpenRouter
Migrate your existing OpenRouter workflows to Inworld Inference
To migrate from OpenRouter, update your authentication, base URL, and model IDs as shown below. Inworld Inference serves OpenAI-compatible chat completions, Responses, and moderations endpoints, so code that uses those through the OpenAI SDK keeps working. To list models, call the List Models API instead of a /models endpoint. To generate images, send a chat completions request with modalities: ["text", "image"] instead of calling an images endpoint; see Image generation.
Key Differences
| Feature | OpenRouter | Inworld Inference |
|---|---|---|
| Authentication | API key (Authorization: Bearer) | Base64 API credential, as Authorization: Basic or Bearer |
| Base URL | https://openrouter.ai/api/v1 | https://api.inworld.ai/v1 |
| Model IDs | provider/model | provider/model, with Inworld's provider and model names (see step 3) |
| Routing | Handled via model string | Handled via model: "auto" or custom Routers |
Migration Steps
1. Update Authentication
OpenRouter uses a single API key with Bearer auth. Inworld uses a key/secret pair, delivered as one Base64 credential that you copy from Portal or the CLI. Don't encode it again. Inworld accepts it as Basic or Bearer, so code that sends a Bearer header only needs the new credential. These docs use Basic in examples.
OpenRouter:
Authorization: Bearer $OPENROUTER_API_KEYInworld:
Authorization: Basic $INWORLD_API_KEY
# or
Authorization: Bearer $INWORLD_API_KEY2. Update the Base URL
Change your client configuration to point to our endpoint. With the OpenAI SDK, the examples also set the Basic authorization header. The SDK sends api_key as a Bearer token, which Inworld Inference also accepts, but the examples use Basic throughout:
import os
from openai import OpenAI
api_key = os.environ["INWORLD_API_KEY"]
client = OpenAI(
# From:
# base_url="https://openrouter.ai/api/v1"
# To:
base_url="https://api.inworld.ai/v1",
api_key=api_key,
default_headers={"Authorization": f"Basic {api_key}"},
)See OpenAI compatibility for the supported endpoints.
3. Map Your Models
Inworld model IDs use the same provider/model shape, but the parts can differ from OpenRouter's:
- Provider: the provider that serves the model on Inworld, which is not always the model's maker. For example, OpenRouter's
google/...models aregoogle-ai-studio/...on Inworld. - Model: the provider's own model name. For example, Anthropic names use hyphens where OpenRouter uses dots (
claude-opus-4-6, notclaude-opus-4.6). OpenRouter suffixes such as:freeor:batchare not portable: use the exact Inworld catalog ID, which can have its own suffix.
To get the exact ID, find the model in the model catalog or call the List Models API and copy the model's id. Send it as model unchanged.
4. Enable Intelligent Routing
Instead of manually picking models, you can now use our routing engine.
{
"model": "auto",
"extra_body": {
"sort": ["price", "latency"]
}
}5. Move OpenRouter routing parameters
On chat completions, Inworld reads some routing fields with the same names as OpenRouter's, and ignores the rest without an error.
Provider preferences apply only to a bare model name, such as gpt-5.4, which Inworld can serve through several providers. A provider/model ID always runs on that one provider, so provider.order, provider.allow_fallbacks and a provider sort have no effect on it. OpenRouter IDs always carry a prefix: if you relied on its provider preferences, send the bare model name instead.
| OpenRouter | Inworld Inference |
|---|---|
models (fallback list) | models: fallbacks tried in order. See request-level routing |
provider.order, provider.allow_fallbacks | Same fields, for a bare model name only. Inworld tries only the providers listed in order. See provider routing |
provider.sort | Top-level sort, for example ["price"] or ["latency"]. It orders providers for a bare model name, and models for auto or a models list |
provider.ignore | Top-level ignore, which takes model IDs or provider names |
Other provider fields, transforms, route, plugins | Ignored |
HTTP-Referer and X-Title headers | Ignored |
With the OpenAI Python SDK, send these fields in extra_body, as with OpenRouter. In a raw JSON body, put them at the top level or inside an extra_body object, as in the example above. The Responses API is stricter: it refuses unknown keys inside extra_body and forwards unknown top-level keys to the provider, so remove OpenRouter-only fields there.
Why Migrate?
- Fallbacks: fallback models and providers per request or in a saved router. See request-level routing.
- Cost control: rank models by price, or send simpler requests to cheaper models with conditional routing.
- Usage and performance: per-model usage in Usage, with estimated cost when your account shows costs (Enterprise accounts may see usage without costs), and latency and errors in Performance on the Builder plan and above.
- Saved routers: conditions, variants and traffic splits that you change without redeploying your code. See routing.
Support
Need help with a complex migration? Contact our engineering team.