anomalyco / anomalyco/opencode
/provider rebuilds and re-compresses a ~5.5MB payload on every web UI page load
@kitlangton is already working on this.
Since Aug 22, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Every web UI page load calls GET /provider. The handler walks the whole models.dev catalog through deep clones + per-model schema validation, then JSON.stringifys ~5.5MB and gzips it — every single request. Measured ~700ms p50, 2s+ p95 under load; profiling showed ~33% of server CPU in schema validation and 13% in JSON.stringify. Under concurrent load this starves unrelated endpoints (p95 up to 11.7s elsewhere while /provider churned).
The four inputs (config, models.dev catalog, connected providers, credentials) are reference-stable between reloads, so the encoded payload could be memoized on input identity and invalidated when a reload swaps any input. Same for gzip/deflate of identical response bodies.
With such a patch I measured p50 726ms → 22ms and ~5 → ~205 req/s. Happy to send it.
Plugins
None
OpenCode version
1.18.21
Steps to reproduce
opencode servewith the web UI enabled and a populated models.dev cache- Open the web UI, watch
GET /providerin the browser network tab across page reloads - Server re-validates and re-serializes the full catalog on every request; under concurrent load other endpoints slow down noticeably
Screenshot and/or share link
N/A
Operating System
Windows 11
Terminal
Windows Terminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.