anomalyco / anomalyco/opencode

App bootstrap fetches the whole models.dev catalog from /provider on every start, once per project

Open
#47,677 0 comments 0 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Sep 6, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

GET /provider always builds the full models.dev catalog. Measured against the HTTP API test
harness on this repo's dev, one call is 4,168,456 bytes and ~1.5 s, while the connected
providers in the same instance amount to 4,468 bytes — the catalog is 99.9% of the response.

The app bootstrap asks for that response even though it does not need the catalog yet:

  • bootstrapGlobal fetches loadProvidersQuery(scope, null, ...) once
    (packages/app/src/context/global-sync/bootstrap.ts),
  • bootstrapDirectory fetches it again for every project directory,
  • and loadProvidersQuery carries no staleTime, so every consumer that mounts before the
    bootstrap has written its result refetches the same payload.

Only the model picker needs the catalog. Everything else on the startup path — rendering the
currently selected model, the composer controls — needs the connected providers alone. On a slow
or unstable connection the catalog is what the startup waits for.

Related, but different: #44180 makes building the same response cheaper on the server
(memoization); this is about not asking for it during startup at all. #35897 asks for a cap or
pagination on the same endpoint, which is another way to cut the same payload.

Plugins

None

OpenCode version

dev (ea2d59d7ca)

Steps to reproduce
  1. Start the app with several projects open.
  2. Watch GET /provider in the server log or a proxy.
  3. Every bootstrap — global plus one per project directory — transfers the full catalog.

Payload sizes can be reproduced without the app:

GET /provider                 -> 4,168,456 bytes
GET /provider?connected=true  -> 4,468 bytes   (with the linked PR applied)
Screenshot and/or share link

N/A

Operating System

Windows 11 (26200)

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.