Repository navigation
Conversation
The models catalog now gives every opencode and opencode-go model its own endpoint, and a model's settings win over its provider's when a model is resolved. A provider-level settings.baseURL from config was only stripped from models listed under that provider's models, so for everything else the catalog endpoint won and the configured gateway never saw a request. Drop the catalog endpoint from every model of a provider whose config sets baseURL. A baseURL configured on a model still wins.
There was a problem hiding this comment.
This fixes #56064. I ran the bot's reproduction from source with a local gateway that logs requests. On the base, deepseek-v4.1-flash, minimax-m3 and gpt-5.6-luna from opencode-go all went to opencode.ai (Invalid credential) and the gateway got nothing. With this PR, all three reach the gateway on /v1/chat/completions, /v1/messages and /v1/responses. test/config/provider.test.ts passes and typecheck in packages/core is clean.
Public API: unchanged. Only the behaviour of the existing provider settings.baseURL config key changes.
One concern before merge (inline): stripping the catalog baseURL from every model reaches further than the zenmux/ofox/azure case in the description. In the bundled catalog, azure and azure-cognitive-services have no provider-level endpoint and give their Claude and partner models per-model endpoints (.../anthropic/v1, .../models). amazon-bedrock does the same for its bedrock-mantle models, and google-vertex for its partner models. Setting a provider baseURL on these is a common, documented setup: an Azure OpenAI endpoint, or a Bedrock VPC endpoint. With this change, those models would also go to that base, which is likely the wrong API for them. I'd narrow the rule so it still fixes #56064 but leaves those setups alone.
…r's origin Models on another origin, or under a provider with no catalog baseURL (Azure, Bedrock, Vertex partner models), keep their own endpoint when the config sets a provider baseURL.

Issue for this PR
Closes #56064
Type of change
What does this PR do?
The bot's guess on the issue is right. The models catalog now gives every
opencodeandopencode-gomodel its ownprovider.api(.../openai/v1,.../anthropic/v1,.../google/v1beta).models-dev.tsturns that into the model'ssettings.baseURL, andModelResolverlays model settings over provider settings, so the catalog endpoint wins.ConfigProviderPluginalready strips the model'sbaseURLwhen the config sets one on the provider, but only for models listed under that provider'smodels. Every other model kept the catalog endpoint, so the configured gateway never got a request.The fix strips the catalog
baseURLfrom every model of a provider whose config setssettings.baseURL. AbaseURLset on a model in config is applied later and still wins.One trade-off to decide on. With this, one provider
baseURLsends every model to the same base, whatever API shape the model uses. For a gateway that mirrors the upstream (my test below), Claude-shaped models hit<baseURL>/messagesand OpenAI ones<baseURL>/responsesor/chat/completions. That matches the docs ("customize the base URL for any provider") and what listed models already do. Before the per-model endpoints,opencode-goworked this way too. It does change one setup, though: someone who sets a providerbaseURLon a catalog with per-shape endpoints (zenmux,ofox,azure) and relies on the Claude-shaped models still using the catalog's/anthropic/v1. They would need a model-levelbaseURLfor those models. If you'd rather keep per-shape endpoints, I can narrow this to models that use the provider's own package. That only half fixes the report, though:minimax-m3andgpt-5.6-lunafrom the issue would still skip the gateway.How did you verify your code works?
packages/core/test/config/provider.test.ts: a catalog model with its ownbaseURLresolves to the configured providerbaseURL, and a model with a configuredbaseURLkeeps it. It fails ondev(Received: "https://catalog.example/v1").127.0.0.1that logs requests:dev: all three models fail withgetaddrinfo ETIMEOUT opencode.ai, and the gateway sees nothing.deepseek-v4.1-flash,minimax-m3andgpt-5.6-lunaall reach the gateway (POST /v1/chat/completions,/v1/messages,/v1/responses).bun testinpackages/core: 6284 pass, 24 fail. The same 24 fail on cleandevin my container (ripgrep and search tools, plus the env isolation test).tsgo -binpackages/coreis clean. Prettier is clean on the changed lines.Checklist
Added by the opencode bot (AI-generated).
Related: #54833, #55984