What happened
I use an OpenRouter key restricted to the EU data region (Business plan, allowed_data_regions: ["europe"]) and point the provider at the in-region endpoint:
{
"providers": {
"openrouter": { "settings": { "baseURL": "https://eu.openrouter.ai/api/v1" } }
}
}
Requests do go to the EU endpoint, but the model list stays global. opencode models and GET /api/model report 372 OpenRouter models, including ones with no EU endpoint; choosing one fails at request time with 404 No endpoints found supporting your data region, and OpenRouter has no cross-region fallback by design.
The in-region endpoint already publishes the correct list, unauthenticated:
curl -s https://eu.openrouter.ai/api/v1/models | jq '.data | length' # 67
curl -s https://openrouter.ai/api/v1/models | jq '.data | length' # 468
Related: provider.<id>.whitelist / blacklist are still documented on https://opencode.ai/docs/providers under "Hiding models", but V2 ignores them (packages/core/src/config/normalize.ts lists them in unsupportedProvider, and migrate-v1.mdx says ignoring them is intentional). Following that page does nothing, silently.
Steps to reproduce
- Connect an OpenRouter key allowed only in the EU region.
- Set
providers.openrouter.settings.baseURL to https://eu.openrouter.ai/api/v1.
opencode models | grep -c '^openrouter/' → 372.
- Select a model without an EU endpoint (several Gemini entries, DeepSeek chat, …) →
404 No endpoints found supporting your data region.
Root cause
The catalog is models.dev based and has no region metadata:
packages/core/src/models-dev.ts loads https://models.opencode.ai/api.json; the openrouter entry hardcodes "api": "https://openrouter.ai/api/v1" and carries no region information.
packages/core/src/plugin/models-dev.ts filters deprecated, non-text and retired provider IDs plus a hardcoded Bedrock profile-only list. Nothing region related.
packages/core/src/plugin/provider/openrouter.ts only adds HTTP-Referer/X-Title and disables two OpenAI chat aliases. It never queries the provider endpoint.
So baseURL is applied to inference only. Other providers do endpoint discovery from their own plugin: plugin/provider/github-copilot.ts (GET ${baseURL}/models), plugin/provider/azure.ts, plugin/provider/vllm.ts, plugin/provider/digitalocean.ts.
Proposal
In OpenRouterPlugin, when settings.baseURL is set and differs from the default https://openrouter.ai/api/v1, fetch ${baseURL}/models during catalog load and remove (or mark disabled) the models it does not return. Cache the result, and fail open when the request fails, so a network blip cannot hide every model.
Current workaround
I ship a standalone plugin that does exactly that for anyone blocked today: https://github.com/jesuswasrasta/opencode-openrouter-eu — it reads the in-region catalog in setup and removes the rest through ctx.model.transform. It works, but it duplicates logic that belongs in the built-in provider plugin.
Happy to send a PR against plugin/provider/openrouter.ts with tests if the approach looks right.
Environment
- OpenCode 2.1.2, CLI, installed from the official installer
- Fedora Linux 43 (x86_64), zsh
- Plugins:
@tarquinen/opencode-dcp@latest, github:jesuswasrasta/opencode-openrouter-eu