Repository navigation
Description
Current scope — October 15, 2026
Keep the original problem. Reference prices are maintained by hand in cost-pricing.ts and drift: against official pricing pages, main is wrong for Claude Sonnet 5, Opus 4.5–4.7, Haiku 4.5, and DeepSeek V4, while models.dev is right. Every new preset (for example #593) also needs a manual price entry. Prices are the only model metadata Mosoo maintains by hand today; presets store no capabilities, limits, or lifecycle status.
Minimal outcome:
- Reference prices come from a checked-in models.dev subset for Mosoo's priced providers. A small script refreshes it, and the change is reviewed as a git diff.
- A short list of reviewed Mosoo overrides covers models that models.dev does not list.
- Context tiers use
cost.tiers. Reasoning tokens bill at the output rate, and audio rates are ignored. An omitted cache rate bills those tokens at the input rate. A model without a published price stays unknown. - Recorded usage keeps its persisted cost. There is no price history and no price selection by Run creation time.
Done when every cost-managed preset is priced at the current time (the existing guard tests run without a pinned date), the existing model-ID normalization still applies, and pkgs/runtime-catalog is unchanged.
Out of scope until something consumes it: display names, capabilities, modalities, limits, lifecycle status, protocol inference from npm, and OpenCode Go (#684). Limits and modalities can come back in their own issue once a consumer exists, such as the typed model connection in #671.
Original proposal and acceptance criteria — current scope above
Area
Runtime catalog / model metadata / cost pricing
Problem
Mosoo maintains model presets in pkgs/runtime-catalog/src/catalog.ts and provider/model pricing schedules in apps/api/src/modules/cost/domain/cost-pricing.ts. Adding models and keeping their capabilities, limits, and prices current requires repeated manual edits. The model-support request in #593 illustrates this maintenance gap.
Models.dev provides provider-specific model data and provider-independent model metadata through public JSON endpoints. Its current provider catalog includes separate OpenCode Zen and OpenCode Go identities and model-level SDK overrides, which matter when a provider serves models through different protocols.
Proposal
Use models.dev as an upstream model metadata source, with a validated, versioned snapshot and Mosoo-owned compatibility rules.
- Import provider/model identities, display names, capabilities, modalities, context/output limits, lifecycle status, and provider-specific prices where supported by Mosoo's contracts.
- Preserve provider-specific model IDs and model-level serving overrides. Canonical model IDs may link metadata, but must not collapse distinct providers, endpoints, credentials, or pricing.
- Define an explicit adapter from upstream serving metadata to Mosoo's model protocols. Missing or ambiguous protocol information requires a reviewed override; importing a model does not establish runtime compatibility or authorize its execution.
- Keep a validated last-known-good snapshot available offline. Refreshes must be bounded, schema-checked, and atomic; upstream failure or invalid data must retain the previous snapshot. Do not put a remote metadata request on each model-call path.
- Retain documented Mosoo overrides for verified compatibility, defaults, and upstream omissions. Define refresh cadence, provenance, precedence, and review/rollback behavior.
- Version imported pricing by provider/model and applicable time. Refreshing prices must not silently reprice historical usage. Preserve unknown pricing explicitly; distinguish missing data from a validated zero rate. Handle cache/token/context tiers only where Mosoo can represent their semantics.
- Keep existing Session model identity, protocol, and configuration stable across refreshes; do not silently substitute another model or change a default for existing Sessions.
Acceptance criteria
- The upstream schema, selected fields, provider/model mapping, and override precedence are documented and fixture-tested.
- A valid snapshot supplies model-selection metadata without requiring manual duplication of imported fields in the current catalog.
- OpenCode Go and Zen remain separate, including model-level SDK/protocol differences and credential isolation.
- Tests cover malformed/partial data, timeout/unavailability, an interrupted refresh, upstream model removal/deprecation, and recovery using the last-known-good snapshot.
- Existing configured Sessions remain usable with their original identities and protocol after a metadata refresh or model removal.
- Pricing tests cover provider-specific identity, unknown versus zero prices, supported cache/context tiers, and unchanged historical cost calculations after a refresh.
- Runtime admission remains explicit and verified; catalog presence alone cannot enable an unsupported runtime/model/protocol combination.
- Relevant repository checks pass. Hosted refresh/fallback behavior is verified separately before claiming deployed support; real inference compatibility requires separate runtime/model acceptance.
Boundaries and related work
This issue concerns metadata ingestion and maintenance. Model inference, subscription management, quota accounting, and managed model supply remain separate work.
- feat(runtime): support Claude Fable 5.1 #593: specific model support and pricing; metadata availability does not close its inference acceptance requirements.
- fix(cost): correct model usage accounting across runtimes #331: usage normalization and persistence; a new price source does not repair incorrect usage accounting.
- feat(subscription): needs support opencode Go #531 and feat(providers): support opencode go subscriptions #684: OpenCode Go integration. Keep this metadata integration separately scoped; it does not block publishing or reviewing that draft PR.
- feat(platform): plan managed model supply and usage billing #636: managed model supply and billing.
No production deployment, historical data rewrite, or model/provider expansion is implied by opening this issue.
References
Contribution
I can help implement and validate this integration.
Checklist
- Searched existing open and closed issues for models.dev and related catalog/model/pricing requests.
- Kept this request focused on one improvement.
- Distinguished model metadata from runtime compatibility and deployed acceptance.
Activity
Yevanchen commentedon Oct 12, 2026
Hi @FradSer, I've known about models.dev for a while, and I think it's a great external reference source. Would you be interested in taking this on? If so, can I assign this issue to you?
FradSer commentedon Oct 12, 2026
yes
fix(runtime): preserve cancellation recovery