Fix OpenRouter routing compat for custom providers

closes #5347
This commit is contained in:
Mario Zechner
2026-06-04 23:49:46 +02:00
parent 2808fc03f4
commit b9bfa7ed46
3 changed files with 6 additions and 2 deletions

View File

@@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed OpenRouter routing preferences on OpenAI-compatible custom providers to send `compat.openRouterRouting` even when `baseUrl` does not point directly at OpenRouter ([#5347](https://github.com/earendil-works/pi/issues/5347)).
## [0.78.1] - 2026-06-04
### Added

View File

@@ -610,7 +610,7 @@ function buildParams(
}
// OpenRouter provider routing preferences
if (model.baseUrl.includes("openrouter.ai") && model.compat?.openRouterRouting) {
if (model.compat?.openRouterRouting) {
(params as any).provider = model.compat.openRouterRouting;
}

View File

@@ -403,7 +403,7 @@ export interface OpenAICompletionsCompat {
| "qwen-chat-template"
| "string-thinking"
| "ant-ling";
/** OpenRouter-specific routing preferences. Only used when baseUrl points to OpenRouter. */
/** OpenRouter-compatible routing preferences sent as the `provider` request field. */
openRouterRouting?: OpenRouterRouting;
/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */
vercelGatewayRouting?: VercelGatewayRouting;