Repository navigation
fix(core): let configured provider baseURL override catalog model endpoints - #57810
Conversation
There was a problem hiding this comment.
Looks correct. I ran the PR's new test against the base code: the catalog models you didn't list in config kept their catalog baseURL. With the change they use the configured provider baseURL, and a per-model baseURL set in config still wins. I also resolved the PR's test model that uses the Anthropic SDK through ModelResolver, and its request goes to the configured gateway. In packages/core, the related config, plugin, provider and model tests (762) and typecheck pass. I couldn't send a real request from the running app to a local server: the CLI from source didn't start in this environment, and the test driver forces its simulated model.
Public API: no keys are added or removed. The existing providers.<id>.settings.baseURL setting now also replaces the catalog's per-model endpoints for that provider's models, not just the models listed in config. This is backwards compatible for gateway users. One setup changes: anyone who sets a provider baseURL and relied on catalog models keeping their own endpoints will now send every model to that one base address. That's what the docs describe.
Also note: #56069, an open community PR, makes the same fix for the same issue, so one of the two should be closed.
Fixes #56064
Summary
A provider-level
settings.baseURLin config no longer reached most catalog models. models.dev v2 now gives everyopencode/opencode-gomodel its ownprovider.api, which core materializes asmodel.settings.baseURL; model settings overlay provider settings, so the catalog endpoint won and gateway users had to repeatbaseURLfor every model.Configured provider
baseURLnow strips the catalog per-modelbaseURLfrom every model of that provider, not only models redefined in config. Each request format still appends its own path (/chat/completions,/responses,/messages,/models/<id>:streamGenerateContent), so a gateway can route on the suffix, matching the earlier provider-override behavior. A per-modelsettings.baseURLin config is applied later and still wins.Fixes #56064
Testing
bun test test/config/provider.test.ts(new test fails without the change)bun test test/config test/plugin test/provider* test/model*bun run typecheckinpackages/coreRequested by: @Tarquinen (dan via Slack)