mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
`/v1/models` only advertised context and token limits for models that OpenCode's capability catalog describes. Everything else fell back to the defaults a discovery client hardcodes (128k context / 16k output), which made every such model look identically small to CLIProxyAPI and Pi. models.dev already publishes `limit.context`, `limit.input` and `limit.output` for the OpenCode providers, and the gateway already fetched that file for pricing and deprecation only. Store those limits in the metadata cache and fill the fields the capability catalog omitted. The capability catalog stays authoritative: capability flags always come from it, and a limit it published is never overwritten. This also merges the other OpenCode provider tiers instead of returning the first provider alone, so models that only one tier describes keep their cost, anonymous eligibility and limits. Clients holding a metadata cache written by an earlier build keep their old data until the next refresh; deleting config.json.models.dev.json forces an immediate refetch.