GeezerVison is showing github.com — Add OpenAI-compatible `/v1/models` endpoint to OpenCode Zen for automatic model discovery · Issue #2901 · anomalyco/opencode
Add OpenAI-compatible /v1/models endpoint to OpenCode Zen for automatic model discovery #2901Descriptionproblem
opencode zen currently doesn't expose a /v1/models endpoint, which prevents openai-compatible clients (like openwebui) from automatically discovering available models.
this forces users to manually add each model id to their client configuration, which is:
- time-consuming (11+ models to add manually)
- error-prone (typos in model ids)
- not future-proof (requires manual updates when new models are added)
proposed solution
implement a /v1/models endpoint that returns an openai-compatible response listing all available opencode zen models.
endpoint: get /v1/models
response format (openai-compatible):
{
"object": "list",
"data": [
{
"id": "claude-3-5-haiku",
"object": "model",
"created": 1234567890,
"owned_by": "anthropic"
},
{
"id": "claude-sonnet-4",
"object": "model",
"created": 1234567890,
"owned_by": "anthropic"
}
]
}
the model data is already available at https://models.dev/api.json under .opencode.models, making implementation straightforward:
# current model list (11 models)
curl https://models.dev/api.json -s | jq '.opencode.models | keys'
use cases
this would enable openwebui and other openai-compatible clients to:
- ✅ automatically discover available opencode zen models on startup
- ✅ dynamically refresh model lists when new models are added
- ✅ provide better ux without manual configuration
- ✅ reduce support burden for integration issues
current workaround
building a local proxy server that:
- intercepts
/v1/models requests
- fetches from
models.dev/api.json
- transforms to openai-compatible format
- forwards all other requests to opencode
however, native support in opencode would be cleaner and more maintainable.
references
Activityrekram1-node commented on Oct 1, 2025 makes sense, thanks for raising Reacted by Daniel Levy Moreno danilevy1212 commented on Nov 2, 2025 Looks like it works now!
curl -s https://opencode.ai/zen/v1/models | jq
{
"object": "list",
"data": [
{
"id": "claude-opus-4-1",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "claude-sonnet-4",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "claude-sonnet-4-5",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "claude-3-5-haiku",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "claude-haiku-4-5",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "gpt-5",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "gpt-5-codex",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "qwen3-coder",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "glm-4.6",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "big-pickle",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "an-gbt",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "kimi-k2",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "minimax-m2",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
},
{
"id": "grok-code",
"object": "model",
"created": 1762047082,
"owned_by": "opencode"
}
]
}dhruvkej9 commented on Apr 25, 2026 @rekram1-node Also can there be a config option config.json similar to this which handles the models using the v1/models? for any link?
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|