fix(coding-agent): honor registered model base urls

closes #4063
This commit is contained in:
Mario Zechner
2026-05-01 22:18:49 +02:00
parent f5b6e4fab0
commit ddb8ed0c73
5 changed files with 11 additions and 2 deletions

View File

@@ -2,6 +2,10 @@
## [Unreleased] ## [Unreleased]
### Fixed
- Fixed `pi.registerProvider()` to honor per-model `baseUrl` overrides ([#4063](https://github.com/badlogic/pi-mono/issues/4063)).
## [0.71.1] - 2026-05-01 ## [0.71.1] - 2026-05-01
### Added ### Added

View File

@@ -595,6 +595,9 @@ interface ProviderModelConfig {
/** API type override for this specific model. */ /** API type override for this specific model. */
api?: Api; api?: Api;
/** API endpoint URL override for this specific model. */
baseUrl?: string;
/** Whether the model supports extended thinking. */ /** Whether the model supports extended thinking. */
reasoning: boolean; reasoning: boolean;

View File

@@ -1602,7 +1602,7 @@ pi.registerProvider("corporate-ai", {
- `api` - API type: `"anthropic-messages"`, `"openai-completions"`, `"openai-responses"`, etc. - `api` - API type: `"anthropic-messages"`, `"openai-completions"`, `"openai-responses"`, etc.
- `headers` - Custom headers to include in requests. - `headers` - Custom headers to include in requests.
- `authHeader` - If true, adds `Authorization: Bearer` header automatically. - `authHeader` - If true, adds `Authorization: Bearer` header automatically.
- `models` - Array of model definitions. If provided, replaces all existing models for this provider. - `models` - Array of model definitions. If provided, replaces all existing models for this provider. Model definitions can set `baseUrl` to override the provider endpoint for that model.
- `oauth` - OAuth provider config for `/login` support. When provided, the provider appears in the login menu. - `oauth` - OAuth provider config for `/login` support. When provided, the provider appears in the login menu.
- `streamSimple` - Custom streaming implementation for non-standard APIs. - `streamSimple` - Custom streaming implementation for non-standard APIs.

View File

@@ -1355,6 +1355,8 @@ export interface ProviderModelConfig {
name: string; name: string;
/** API type override for this model. */ /** API type override for this model. */
api?: Api; api?: Api;
/** API endpoint URL override for this model. */
baseUrl?: string;
/** Whether the model supports extended thinking. */ /** Whether the model supports extended thinking. */
reasoning: boolean; reasoning: boolean;
/** Supported input types. */ /** Supported input types. */

View File

@@ -876,7 +876,7 @@ export class ModelRegistry {
name: modelDef.name, name: modelDef.name,
api: api as Api, api: api as Api,
provider: providerName, provider: providerName,
baseUrl: config.baseUrl!, baseUrl: modelDef.baseUrl ?? config.baseUrl!,
reasoning: modelDef.reasoning, reasoning: modelDef.reasoning,
input: modelDef.input as ("text" | "image")[], input: modelDef.input as ("text" | "image")[],
cost: modelDef.cost, cost: modelDef.cost,