Source model list from /provider/v1/models API instead of scraping CLI bundle - #4
Closed
KRoperUK wants to merge 1 commit into
Closed
Source model list from /provider/v1/models API instead of scraping CLI bundle#4KRoperUK wants to merge 1 commit into
KRoperUK wants to merge 1 commit into
Conversation
…I bundle
The model list was extracted by parsing the minified command-code CLI bundle
with fragile string anchors (e.g. 'SONNET_4_6:{id:"claude-sonnet-4-6"'), which
drifted out of date: models.json had 21 models while Command Code now serves 30
(missing mimo, claude-opus-4-8, claude-fable-5, nemotron, and others).
Use the public OpenAI-compatible endpoint https://api.commandcode.ai/provider/v1/models
as the source of truth for which models exist, their names, and context windows.
The CLI bundle is still downloaded, but now only to enrich entries with pricing
(the endpoint does not expose cost). Fields the endpoint lacks (reasoning,
tool_call) come from a small MODEL_META overrides map with sensible defaults.
Models without bundle pricing are kept with zeroed cost and a warning rather than
being silently dropped, so newly released models appear immediately.
- Remove brittle catalog scraping (extractModelCatalog, extractSpecConstants,
HARDCODED_EXTRAS, provider-based TIER_MAP); derive tier from id namespace.
- Regenerate models.json (21 -> 30) and README table.
- Add tests/unit/models-json.test.ts to guard the models.json shape.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
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.
Problem
The model list in
models.jsonis generated byscripts/sync-models.ts, which downloads thecommand-codenpm tarball and parses the minified JS bundle using fragile string anchors (e.g.'SONNET_4_6:{id:"claude-sonnet-4-6"'). This drifts out of date as the bundle changes:models.jsoncurrently has 21 models, while Command Code now serves 30.Missing models include
xiaomi/mimo-v2.5-pro,xiaomi/mimo-v2.5,claude-opus-4-8,claude-fable-5,moonshotai/Kimi-K2.7-Code,MiniMaxAI/MiniMax-M3,Qwen/Qwen3.7-Plus,stepfun/Step-3.7-Flash, andnvidia/nemotron-3-ultra-550b-a55b.Change
Use the public, OpenAI-compatible endpoint
GET https://api.commandcode.ai/provider/v1/modelsas the source of truth for which models exist, their display names, and context windows.reasoning,tool_call) come from a smallMODEL_METAoverrides map with sensible defaults (reasoning: true,tool_call: true).TIER_MAPwhich can't work since the endpoint reportsowned_by: "command-code"for everything.FALLBACK_COSTScan be populated as pricing becomes known.)Removed
Brittle catalog scraping:
extractModelCatalog,extractSpecConstants,HARDCODED_EXTRAS, and the provider-basedTIER_MAP.Artifacts
models.json(21 → 30 models) and the README table.tests/unit/models-json.test.tsto guard themodels.jsonshape (id/name/tier/cost/limit, unique ids).Verification
bun run synclists 30 models includingxiaomi/mimo-v2.5-pro(1M context); no anchor/parse exceptions.bun run generate-readmeupdates the table.bun test tests/unit/→ 76 pass, 0 fail.Notes / open questions
FALLBACK_COSTS/overrides file and dropping bundle parsing entirely. Happy to do that here or separately — flagging since it changes the maintenance model.🤖 Generated with Claude Code