Repository navigation
Labels
P1Should have - HighShould have - HighperformancePerformance optimizationPerformance optimizationtech-debtTechnical debt cleanupTechnical debt cleanup
Description
Context
The CLI currently fetches all model/provider metadata from https://models.dev/api.json at startup and on a 60-minute interval. Our harness will never use this external API — we control which models we support. This adds unnecessary network dependency, a 1.3MB test fixture, and build-time fetching for a snapshot file.
Proposal
Replace the ModelsDev integration with a static TypeScript model registry that we maintain directly.
What to delete
packages/cli/src/provider/models.ts— the entireModelsDevnamespace (~133 lines)models-snapshot.tsgeneration block inpackages/cli/script/build.ts(~20 lines)- 3 flags in
packages/cli/src/flag/flag.ts:AICTRL_MODELS_URL,AICTRL_MODELS_PATH,AICTRL_DISABLE_MODELS_FETCH models --refreshCLI option inpackages/cli/src/cli/cmd/models.tspackages/cli/test/tool/fixtures/models-api.json(1.3MB test fixture)models-snapshot.tsfrom.gitignore- Related env vars from
turbo.jsonpassthrough (MODELS_DEV_API_JSON,AICTRL_MODELS_URL)
What to rewrite
| File | Change |
|---|---|
packages/cli/src/provider/provider.ts |
Replace ModelsDev.get() + fromModelsDevProvider/fromModelsDevModel in state() with a static import. CUSTOM_LOADERS, config merging, and auth logic stay as-is. |
packages/cli/src/config/config.ts (lines ~932-953) |
Config.Provider extends ModelsDev.Provider.partial() — replace with a standalone Zod schema |
packages/cli/src/cli/cmd/auth.ts (3 calls) |
Replace ModelsDev.get() with Provider.list() for provider name display in CLI pickers |
packages/cli/src/cli/cmd/github.ts (1 call) |
Same — replace with Provider.list() |
packages/cli/test/preload.ts |
Remove AICTRL_MODELS_PATH injection, provide static test data |
What stays untouched
packages/cli/src/provider/transform.ts— operates onProvider.Model, noModelsDevdependency- Session, plugin, bus, and all other subsystems — no direct imports
Replacement
A static TypeScript file exporting Record<string, Provider.Info> with only the models we support. This becomes the single source of truth instead of an external API.
Metadata
Metadata
Assignees
Labels
P1Should have - HighShould have - HighperformancePerformance optimizationPerformance optimizationtech-debtTechnical debt cleanupTechnical debt cleanup
Activity
byapparov commentedon Oct 17, 2026
Additional scope found while auditing the headless run path. Tracked under the headless optimisation epic.
Not in the lists above:
provider/transform.ts:6,10importsModelsDevtypes (theModalityenum), so it is not untouched.cli/cmd/run.ts:118-124(attachedContextLimit) readslimit.contextstraight from the raw ModelsDev data.config/config.ts:37: theModelId$refpoints athttps://models.dev/model-schema.json. The generated SDKProviderConfig(packages/sdk/src/gen/types.gen.ts) carries models.dev field names, so the standalone config schema must stay field-compatible or user configs break.cli/cmd/github.tsdoesdelete p["github-copilot"]on the shared cached object.turbo.json(MODELS_DEV_API_JSON,AICTRL_MODELS_URL),nix/opencode.nix,CONTRIBUTING.md:30(says to add providers upstream at models.dev) andEVENTS.md:229.test/preload.tsdoesn't setAICTRL_DISABLE_MODELS_FETCH, so the test suite makes real network calls today.Problems the removal also fixes:
models-snapshot.tsis gitignored and regenerated on every build: 3.9 MB, 192 providers, 6,841 models. Releases are not reproducible.aictrlprovider is missing from the snapshot, so itsCUSTOM_LOADERSentry logs "Provider does not exist" on every start, and its priority and hint in the auth picker are dead code.??=(GLM-5.3,gpt-5.3-codex) are overridden by models.dev data once upstream lists them. GPT-5.6 exists only because models.dev has it.~/.cache/aictrl/models.jsontakes precedence over the bundled snapshot, so a stale or tampered cache wins.Decision needed:
CUSTOM_LOADERSproviders, plusaictrland the codex/GLM models. Everything else is defined throughconfig.provider(openai-compatible).Provider.Modelshape, which removesfromModelsDevProvider/fromModelsDevModel.byapparov commentedon Oct 17, 2026
Decision (2026-10-17): the curated catalog covers the 21
CUSTOM_LOADERSproviders, theaictrlprovider and the codex/GLM models. Any other provider has to be defined inconfig.provider(openai-compatible). This is a behaviour change, so it ships as a minor version bump.feat(provider)!: replace models.dev with a static model catalog (#40)
fix(acp): make the no-provider default-model error actionable (#40 re…
fix(provider): explain a missing base URL for config-only providers (#40
feat(provider)!: replace models.dev with a static model catalog (#40)
fix(acp): make the no-provider default-model error actionable (#40 re…
fix(provider): explain a missing base URL for config-only providers (#40
test: declare alibaba in config for tests added on main (#40)
feat(provider)!: replace models.dev with a static model catalog (#40)
test(provider): cover GLM variants and isolate the no-network test (#40…
fix(provider): explain a missing base URL for config-only providers (#40
test: declare alibaba in config for tests added on main (#40)
test: drop the removed models-fetch flag from tests added on main (#40)
Merge pull request #202 from aictrl-dev/feat/issue-40-static-model-ca…