> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from OpenRouter

> Migrate your existing OpenRouter workflows to Inworld Inference

To migrate from OpenRouter, update your authentication, base URL, and model settings as shown below. Inworld Inference is designed as a drop-in replacement for OpenAI-compatible endpoints, with added reliability and cost controls.

## Key Differences

| Feature | OpenRouter | Inworld Inference |
| :--- | :--- | :--- |
| **Authentication** | API key (`Authorization: Bearer`) | Base64 API credential (`Authorization: Basic`) |
| **Base URL** | `https://openrouter.ai/api/v1` | `https://api.inworld.ai/v1` |
| **Model Names** | `provider/model` | `provider/model` (e.g., `openai/gpt-5.4`) |
| **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 and send with Basic auth. Don't encode it again.

**OpenRouter:**
```bash
Authorization: Bearer $OPENROUTER_API_KEY
```

**Inworld:**
```bash
Authorization: Basic $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](https://docs.inworld.ai/router/openai-compatibility.md) for the supported endpoints.

### 3. Map Your Models
Inworld supports the same `provider/model` syntax you're used to.

- `openai/gpt-5.4` → `openai/gpt-5.4`
- `anthropic/claude-opus-4-6` → `anthropic/claude-opus-4-6`
- `google-ai-studio/gemini-2.5-flash` → `google-ai-studio/gemini-2.5-flash`

### 4. Enable Intelligent Routing
Instead of manually picking models, you can now use our routing engine.

```json
{
  "model": "auto",
  "extra_body": {
    "sort": ["price", "latency"]
  }
}
```

## Why Migrate?

1. **Enterprise Reliability**: Built-in automatic fallbacks across providers.
2. **Cost Optimization**: Dynamic tiering to reduce bills by up to 70%.
3. **Unified Observability**: Detailed logs and performance metrics across all models.
4. **Privacy Controls**: Regional routing and PII detection.

## Support
Need help with a complex migration? [Contact our engineering team](mailto:support@inworld.ai).
