Repository navigation
[FEATURE]: Use models.dev data for custom providers #9311
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Currently, when using preconfigured providers (like Anthropic, OpenAI, etc.) with a whitelist, OpenCode automatically fetches model metadata (pricing, context limits, capabilities) from models.dev:
{
"provider": {
"anthropic": {
"whitelist": [
"claude-sonnet-4-5",
"claude-opus-4-5"
]
}
}
}However, for custom providers, all model metadata must be manually specified:
{
"provider": {
"customprovider": {
"name": "AI Home",
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "{env:AIHOME_API_KEY}",
"baseURL": "https://api.example.com"
},
"models": {
"minimax/minimax-m2.1": {
"limit": { "context": 1000000, "output": 32000 },
"cost": { "input": 0.3, "output": 1.2 },
"temperature": true,
"reasoning": true,
"tool_call": true
}
}
}
}
}This is tedious, error-prone, and requires tracking pricing/limit changes manually.
Proposed Solution
Add a use_models_dev option that allows custom providers to reference model metadata from models.dev:
{
"provider": {
"customprovider": {
"name": "AI Home",
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "{env:API_KEY}",
"baseURL": "https://api.example.com"
},
"models": {
"minimax/minimax-m2.1": {
"use_models_dev": "openrouter/minimax/minimax-m2.1"
}
}
}
}
}This would automatically import:
- Context/input/output limits
- Pricing (input, output, cache read/write)
- Capabilities (tool calls, reasoning, temperature, attachments)
- Modalities (text, image, audio, video, PDF support)
- Variants and other metadata
Benefits
- Less Configuration - No need to manually track pricing and limits
- Auto-Updates - When models.dev updates pricing or limits, OpenCode automatically uses latest values
- Accuracy - Ensures metadata matches the source provider
- Flexibility - Can still override specific fields when needed
User Override Support
Users should be able to override imported metadata:
{
"models": {
"minimax/minimax-m2.1": {
"use_models_dev": "openrouter/minimax/minimax-m2.1",
"limit": {
"context": 500000 // Override imported value
}
}
}
}Merge priority: user config > models.dev import > defaults
Error Handling
If the specified use_models_dev model ID is not found in models.dev:
- Log a warning with the invalid ID
- List available providers to help user find correct ID
- Fall back to any manually specified metadata in config
- Don't crash or fail config loading
Finding Model IDs
Model IDs follow the format: provider/model-name
Examples:
openrouter/minimax/minimax-m2.1openrouter/anthropic/claude-3.7-sonnetanthropic/claude-opus-4-5
Users can find valid IDs at https://models.dev/
Use Cases
- Proxy providers - Using OpenRouter, AI Gateway, or other proxies that support models already in models.dev
- Self-hosted deployments - Running models locally that match commercial offerings
- Testing - Quickly switching between providers without reconfiguring metadata
- Multi-provider setups - Accessing the same model through different endpoints
Example: Real-world scenario
A user wants to access Minimax M2.1 through their self-hosted AI proxy. Instead of manually looking up and copying all the metadata, they can simply reference the OpenRouter version:
{
"provider": {
"my-ai-proxy": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "{env:MY_PROXY_KEY}",
"baseURL": "https://my-proxy.internal/v1"
},
"models": {
"minimax-m2.1": {
"use_models_dev": "openrouter/minimax/minimax-m2.1"
}
}
}
}
}All pricing, limits, and capabilities are automatically imported from models.dev.
Non-Goals
- This feature does NOT add new models to models.dev
- This feature does NOT validate that the provider actually supports the model
- This feature does NOT change how preconfigured providers work.
Activity
github-actions commentedon Jan 18, 2026
This issue might be a duplicate of or related to existing issues. Please check:
Feel free to ignore if none of these address your specific case.
mcowger commentedon Jan 18, 2026
I have a PR prepared for this that works for me, but per the
CONTRIBUTING.mdguidance I'm opening this as a discussion prior to posting the PR.keslerm commentedon Jan 20, 2026
@mcowger this would be really helpful as I use a lot of internal LLM proxies and have to keep manually configuring the prices and passing config files around.
mcowger commentedon Jan 20, 2026
This is the same issue for me. I do have it working so hopefully the team agrees.
mcowger commentedon Jan 22, 2026
Hey @thdxr - any thoughts on if the team is supportive of this idea? If so I do have a PR that implements it and works well for my scenario.
felix-ma commentedon Jan 26, 2026
In the case of intranets, this demand is particularly important. I hope to be satisfied as soon as possible
rh-anocca commentedon Feb 11, 2026
I agree this would be great to have, we use a custom proxy for hosting models and would like to have costing.
github-actions commentedon Apr 13, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
yuhp commentedon Sep 11, 2026
The community plugin already supports enriching custom-provider models from models.dev:
https://github.com/yuhp/opencode-models-discovery
Configure:
{ "plugin": ["opencode-models-discovery@latest"], "provider": { "custom-provider": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://proxy.example.com/v1", "modelsDiscovery": { "enabled": true, "modelInfoFormat": "models.dev" } } } } }The plugin fetches models.dev metadata and applies matching limits, capabilities, modalities, and other supported OpenCode model fields to discovered models. Explicit provider configuration remains authoritative.