fix(model-prices): prioritize official pricing sources - #460
Merged
Conversation
Read models.dev catalog metadata and select canonical first-party prices before ordered LiteLLM and OpenRouter fallbacks. Keep ambiguous and fuzzy matches out of automatic persistence while preserving candidates from every source. Reject incomplete catalogs and retain cache metadata so third-party entries cannot silently become official prices.
Switch production model-price synchronization from the legacy api.json endpoint to catalog.json. The catalog exposes canonical model identities required for official-price selection. Legacy payload decoding remains supported for compatibility.
Key candidate selections by source and model ID instead of model ID alone. Group confirmation options by provider so identical IDs from multiple sources remain selectable. This only changes unresolved-price confirmation behavior.
Document models.dev, LiteLLM, and OpenRouter precedence in the Chinese and English manuals. Clarify official catalog selection, ambiguity fallback, and source-separated confirmation. No runtime behavior changes are included in this commit.
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.
Summary
Use canonical model metadata from the models.dev catalog to select first-party prices before falling back to LiteLLM and OpenRouter.
Keep ambiguous or fuzzy matches in the manual confirmation flow and preserve candidates from every source.
Scope
Changes
catalog.jsonand retain canonical model metadata through ETag cache reuse.User Impact
Official first-party models.dev prices are selected automatically when available. Ambiguous sources now fall through in priority order, while unresolved models show source-separated confirmation options instead of losing same-ID alternatives.
Compatibility / Runtime Notes
api.jsontocatalog.json; legacy payload decoding remains supported.Data / Security Notes
N/A. This change does not alter the SQLite schema, credentials, management keys, logs, raw usage data, or plugin behavior. Existing stored prices are only changed when the user triggers synchronization or confirms a candidate.
Risk / Rollback
Risk level: Medium
Rollback notes: Revert the four commits in this PR to restore the previous endpoint and matching behavior. Existing model prices remain intact unless a synchronization was explicitly triggered.
Verification
Commands / evidence:
The frontend suite passed 1,214 tests across 131 files. The focused candidate model test passed 10/10.
Screenshots / Recordings
N/A. No screenshot was captured; the visible change is limited to grouping native select options by price source, with candidate identity and grouping covered by focused tests.
Docs
Docs decision: Updated the Chinese and English model-price manuals. Existing navigation already links to these pages and required no code change.
Related
N/A