diff --git a/docs/providers/openrouter.md b/docs/providers/openrouter.md index b55fc756f..390dd18a8 100644 --- a/docs/providers/openrouter.md +++ b/docs/providers/openrouter.md @@ -33,3 +33,43 @@ moltbot onboard --auth-choice apiKey --token-provider openrouter --token "$OPENR - Model refs are `openrouter//`. - For more model/provider options, see [/concepts/model-providers](/concepts/model-providers). - OpenRouter uses a Bearer token with your API key under the hood. + +## Provider routing + +OpenRouter supports provider routing via the `compat.openRouterRouting` field, which controls which upstream providers handle your requests. Configure this in `agents.defaults.models` for individual models. + +### Configuration options + +- `compat.openRouterRouting.only`: List of provider slugs to exclusively use for this request (e.g., `["anthropic", "openai"]`). +- `compat.openRouterRouting.order`: List of provider slugs to try in sequence (e.g., `["anthropic", "openai"]`). + +### Example + +```json5 +{ + env: { OPENROUTER_API_KEY: "sk-or-..." }, + agents: { + defaults: { + model: { primary: "openrouter/anthropic/claude-sonnet-4-5" }, + models: { + "openrouter/anthropic/claude-sonnet-4-5": { + alias: "Claude Sonnet", + compat: { + openRouterRouting: { + only: ["anthropic"] + } + } + }, + "openrouter/openai/gpt-5.2": { + alias: "GPT-5.2", + compat: { + openRouterRouting: { + order: ["anthropic", "openai"] + } + } + } + } + } + } +} +``` diff --git a/package.json b/package.json index 04322f3af..788b6b726 100644 --- a/package.json +++ b/package.json @@ -164,7 +164,7 @@ "@line/bot-sdk": "^10.6.0", "@lydell/node-pty": "1.2.0-beta.3", "@mariozechner/pi-agent-core": "0.49.3", - "@mariozechner/pi-ai": "0.49.3", + "@mariozechner/pi-ai": "0.50.3", "@mariozechner/pi-coding-agent": "0.49.3", "@mariozechner/pi-tui": "0.49.3", "@mozilla/readability": "^0.6.0",