feat(opencode): discover abacus models from /v1/models endpoint - #34563
feat(opencode): discover abacus models from /v1/models endpoint#34563neo-clon wants to merge 4 commits into
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Add dynamic model discovery for the Abacus provider via the standard OpenAI-compatible /v1/models endpoint. Filters to text_generation models only (excludes image, video, audio). Also generalizes the discoveryLoaders execution loop to support any provider with a discoverModels function, replacing the gitlab-specific hardcoded path.
d2f739b to
76fba4b
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
Requesting reopen — still relevant, and the branch is now rebased and conflict-free. Rebased onto current The gap this closes is still open today. Checked against both sources just now:
Without discovery those models are simply unreachable from opencode unless the user hand-maintains a local models database and points The second half of the PR is provider-agnostic. It replaces the hardcoded Happy to split this into two PRs — the generic |
Issue for this PR
Fixes #41318
Type of change
What does this PR do?
Adds dynamic model discovery for the Abacus provider by querying the standard OpenAI-compatible
/v1/modelsendpoint.Problem: the Abacus catalog in
models.devdrifts behind what the vendor actually serves, and it drifts again every few weeks. Measured today:models.devlists 95 Abacus models, while the Abacus API returns 153 models — 74 of themtext_generation, of which 12 are absent frommodels.dev(claude-opus-5,moonshotai/Kimi-K3,moonshotai/Kimi-K2.7-Code,gemini-3.6-flash,deepseek-ai/DeepSeek-V4-Flash-0731,thinkingmachines/Inklingand others). Those models are unreachable from opencode even though the user's key can already call them.Changes:
discoverModelsfor Abacus — fetchesGET /v1/modelsfrom the Abacus API (https://routellm.abacus.ai/v1). Filters bymodel_type === "text_generation"to exclude image/video/audio models. Models already inmodels.devare never overwritten, since their metadata is richer. New models get cost derived from the API's token rates, capabilities inferred from the reported modalities, and context/output limits from the response.Generalized
discoveryLoadersloop — this is required, not incidental.provider.tsalready registersdiscoverModelsintodiscoveryLoadersfor any provider, but the invocation is hardcoded togitlab, so a loader registered by any other provider is never called. Replacing that branch with a loop overdiscoveryLoadersmakes the existing mechanism reachable for every provider. No behavior change for gitlab: it is still discovered, now through the generic path.How did you verify your code works?
dev(fe82a1b) with no conflicts; the three earlier merge commits are flattened into one feature committsgo --noEmitis clean forpackages/opencode, the only package this PR touches and the check that.github/workflows/typecheck.ymlrunsmodel_typebreakdown 74text_generation/ 34image_generation/ 34video_generation/ 11audio_generationmodels.devare preserved and not overwritten by discoveryChecklist