Realtime TTS-2 is live. Built for realtime conversation that feels human. Read the Realtime TTS-2 announcement

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

FeatureOpenRouterInworld Inference
AuthenticationAPI key (Authorization: Bearer)Base64 API credential, as Authorization: Basic or Bearer
Base URLhttps://openrouter.ai/api/v1https://api.inworld.ai/v1
Model IDsprovider/modelprovider/model, with Inworld's provider and model names (see step 3)
RoutingHandled via model stringHandled 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:

bash
Authorization: Bearer $OPENROUTER_API_KEY

Inworld:

bash
Authorization: Basic $INWORLD_API_KEY
# or
Authorization: Bearer $INWORLD_API_KEY

2. 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:

python
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 are google-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, not claude-opus-4.6). OpenRouter suffixes such as :free or :batch are 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.

json
{
  "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.

OpenRouterInworld Inference
models (fallback list)models: fallbacks tried in order. See request-level routing
provider.order, provider.allow_fallbacksSame fields, for a bare model name only. Inworld tries only the providers listed in order. See provider routing
provider.sortTop-level sort, for example ["price"] or ["latency"]. It orders providers for a bare model name, and models for auto or a models list
provider.ignoreTop-level ignore, which takes model IDs or provider names
Other provider fields, transforms, route, pluginsIgnored
HTTP-Referer and X-Title headersIgnored

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?

  1. Fallbacks: fallback models and providers per request or in a saved router. See request-level routing.
  2. Cost control: rank models by price, or send simpler requests to cheaper models with conditional routing.
  3. 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.
  4. 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.