Feature hasn't been suggested before.
Describe the enhancement you want to request
Summary
When a user connects an OpenRouter API key to OpenCode, the model list currently comes from the static models.dev snapshot (provider.ts → models.dev). It is not filtered by the user's OpenRouter account settings (provider preferences, privacy settings, guardrails, etc.). This causes OpenCode to display models that users explicitly disabled in their OpenRouter accounts.
OpenRouter provides a dedicated endpoint for this:
Using this endpoint when the user is authenticated with OpenRouter would ensure the model list reflects the user's actual available models.
If this idea is accepted, I may open a PR with the proposed changes mentioned below.
Current behavior
OpenCode shows all OpenRouter models from models.dev regardless of user preferences.
Proposed behavior
When a user has authenticated OpenRouter in OpenCode:
- Call
GET https://openrouter.ai/api/v1/models/user with the stored OpenRouter API key.
- Use the returned model IDs to filter/disable models in the OpenCode OpenRouter provider catalog.
- Keep the rich metadata (capabilities, limits, pricing) from
models.dev.
- Cache the filtered list per API key with a reasonable TTL (e.g. 5–15 minutes) to avoid excessive API calls.
- Gracefully fall back to the full
models.dev OpenRouter list if the request fails.
Why this matters
- Users see models they are actually allowed to use.
- It respects user's privacy/guardrail settings in OepnRouter account.
- It avoids the current mismatch where OpenCode lists models that OpenRouter rejects at request time.
Feature hasn't been suggested before.
Describe the enhancement you want to request
Summary
When a user connects an OpenRouter API key to OpenCode, the model list currently comes from the static
models.devsnapshot (provider.ts→models.dev). It is not filtered by the user's OpenRouter account settings (provider preferences, privacy settings, guardrails, etc.). This causes OpenCode to display models that users explicitly disabled in their OpenRouter accounts.OpenRouter provides a dedicated endpoint for this:
GET https://openrouter.ai/api/v1/models/userUsing this endpoint when the user is authenticated with OpenRouter would ensure the model list reflects the user's actual available models.
If this idea is accepted, I may open a PR with the proposed changes mentioned below.
Current behavior
OpenCode shows all OpenRouter models from
models.devregardless of user preferences.Proposed behavior
When a user has authenticated OpenRouter in OpenCode:
GET https://openrouter.ai/api/v1/models/userwith the stored OpenRouter API key.models.dev.models.devOpenRouter list if the request fails.Why this matters