Repository navigation
feat(providers): take model capability data from models.dev - #294
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Model capability data (context window, output limit, thinking mode and effort levels, image and PDF input) now comes from models.dev instead of our hand-maintained table and per-provider discovery.
src/server/config/modelsDev.json, generated from models.dev on 2026-11-20 (324 providers, 10,028 models, 1.89 MB, 117 KB gzipped). It stores only the fields we read, one model per line.scripts/update-models-dev.tsrefreshes it, andscripts/release.tsnow refreshes it as part of a release; the release step fails if the fetch fails.src/server/services/modelsDev/modelsDevRefresh.tsloads whichever is newer, the on-disk cache or the snapshot, then fetches models.dev once an hour with the cached ETag (a 304 only bumps the timestamp). The app keeps working from the last copy offline. The refresh lives apart frommodelsDevStore.tsso the CLI, which loads the rules resolver, does not pull in the network settings chain.deepseek-v3.2does not fall back todeepseek-v3; our own table and the site entries still cut at dots, because their prefixes name families (kimi-k2coverskimi-k2.6).modelsDev) → corrections (sourcemodel) → site → discovered → user override. The model table keeps only what models.dev lacks:structuredOutput, our write format and native search for Claude, and five models models.dev does not list.correctionsinmodelRules.jsonholds 8 Anthropic entries where models.dev lists thinking that cannot be turned off but Anthropic's docs say it can (Haiku/Sonnet 4.5, Opus 4.5 through Opus 5). Each entry needs a vendor doc URL and links the upstream fix, fix(anthropic): add the thinking toggle to Claude models that can turn thinking off anomalyco/models.dev#14144. Corrections match the models.dev id actually hit, so dated or suffixed ids that land on that model get the fix too.anthropic_adaptive, per https://openrouter.ai/docs/use-cases/reasoning-tokens.src/server/upstream/contextWindows/{openrouter,deepseek,qwen}.ts) and thereasoningfields they fed.docs/features/harness/model-rules.md, the provider preset tutorial (en + zh),PRIVACY.md(the app now requests models.dev periodically),THIRD_PARTY_NOTICES.md(models.dev is MIT), and a CHANGELOG entry.Why
The hand-maintained table covered a few dozen models and went stale with each release, and the three discovery sources each parsed a different provider API for the same facts. models.dev publishes these values for about 10,000 models across 324 providers under MIT.
How it was tested
bun test(full, after rebasing on main): 3325 pass, 0 fail (233 files)cd desktop && bun run lint: passes (tsc, electron tsc, oxlint)cd desktop && bun run test -- --run: 3139 pass, 4 skipped, 0 fail (238 files)modelsDev-catalog.test.ts), the refresh with cache, ETag and 304 (modelsDev-refresh.test.ts), the bundled snapshot and the 8 corrections (modelRules-builtin.test.ts), layer order, prefix and dot behavior inmodelRules-resolve.test.ts, the release step (scripts/release.test.ts,scripts/update-models-dev.test.ts), and the source label (ProviderFormModal.test.tsx). No test touches the network; model-specific tests swap in a test catalog and restore it after each test.Not done
Closes #291