GeezerVison is showing github.com — [FEATURE]: Auto-discover models from OpenAI-compatible providers · Issue #27553 · anomalyco/opencode
[FEATURE]: Auto-discover models from OpenAI-compatible providers #27553DescriptionDescribe the enhancement you want to request
OpenAI-compatible providers configured with a baseURL (e.g. llama-swap, Ollama, LM Studio) serve a /v1/models endpoint that lists their available models. Right now you have to list every model manually in opencode.json, which means the config goes stale every time you swap a model on the backend.
This PR adds auto-discovery: on startup, OpenCode calls GET /v1/models for each @ai-sdk/openai-compatible provider that has a baseURL and no statically configured models. It reads id, name, context_length/max_context_length, and max_output_tokens from the response. Manually configured models always win (non-destructive merge), and opt-out is discoverModels: false in the provider config.
Discovery runs in parallel across providers with a 2-second timeout per request, so offline servers don't slow startup. Errors are swallowed silently.
- I have verified this feature I'm about to request hasn't been suggested before.
Reacted by Tim, Joost R., Quino Terrasa, Kevin Cox, MeIchthys, Arman, 2048khz-gachi-rmx, MrPandir, abhineetgupta, xiuc and 3 more Reacted by MeIchthys Activitychanged the title [-]feat: auto-discover models from openai-compatible providers[/-] [+][FEATURE]: Auto-discover models from OpenAI-compatible providers[/+] on May 14, 2026github-actions commented on May 14, 2026 Thanks for updating the issue! It now meets our contributing guidelines. We appreciate you taking the time to fix it. MohammadMD1383 commented on Jun 17, 2026 Logicwax commented on Aug 14, 2026 yuhp commented on Sep 11, 2026 This use case is already supported by the community plugin:
https://github.com/yuhp/opencode-models-discovery
The plugin discovers models from /v1/models for configured @ai-sdk/openai-compatible providers and injects them into provider.<name>.models during the config hook.
It supports provider-specific endpoints, timeouts, model filtering, OpenCode /connect credentials, optional persisted caching, and provider-specific metadata enrichment. Explicitly configured models are preserved and take precedence over discovered values.
Example:
{
"plugin": ["opencode-models-discovery@latest"],
"provider": {
"my-provider": {
"npm": "@ai-sdk/openai-compatible",
"name": "My Provider",
"options": {
"baseURL": "http://127.0.0.1:1234/v1",
"modelsDiscovery": {
"enabled": true
}
}
}
}
}neriousy commented on Oct 1, 2026 Closing as a duplicate of #6231, which tracks discovering models automatically from OpenAI-compatible /v1/models endpoints. Please add your use case and 👍 there.
In OpenCode v2, LM Studio, Ollama and vLLM already discover their models automatically (#42607 added LM Studio). Generic OpenAI-compatible providers don't yet.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|