anomalyco / anomalyco/opencode

/provider rebuilds and re-compresses a ~5.5MB payload on every web UI page load

Open
#44,180 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. opencode serve with the web UI enabled and a populated models.dev cache
  2. Open the web UI, watch GET /provider in the browser network tab across page reloads
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.