You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stats: use llm-prices for current model rates - #420
cortex stats prices any opus-4 id at $15/$75, so Opus 4.5 and later show 3x their real cost ($5/$25). o3 shows $15/$60 against a list price of $2/$8.
This looks up the model id in llm-prices before the existing contains() table. CORTEX_PRICING_* overrides still take priority, and unknown ids still fall back to the current defaults.
Adds llm-prices = "1.8.0", which has no dependencies and carries dated, source-cited rates. I'm Matthew Busel and I maintain llm-prices.
Summary by CodeRabbit
New Features
CLI usage cost estimates can now use dated, source-cited pricing for supported models when both input and output rates are available.
Custom pricing continues to take precedence, and existing fallback pricing remains in effect when complete model pricing is unavailable.
Added coverage confirming cost estimates for Claude Opus 4.5 and o3.
No actionable comments were generated in the recent review.
Walkthrough
The CLI adds llm-prices and checks its model rates after custom environment pricing. It uses catalog rates only when both input and output prices are available; otherwise, it retains the existing hard-coded fallback.
Changes: Model Pricing
Layer / File(s)
Summary
Catalog pricing lookup and validation src/cortex-cli/Cargo.toml, src/cortex-cli/src/stats_cmd.rs
The CLI adds llm-prices version 1.8.0. get_model_pricing uses catalog rates when both prices are available and otherwise continues to hard-coded rates. Tests assert costs for claude-opus-4-5 and o3 with one million input and output tokens.
The change makes cortex stats use catalog prices for known models, which corrects the pricing of Opus 4.5 and later models and of o3. Custom pricing overrides and the existing defaults for unknown models are unchanged. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "stats: use llm-prices for current model rates" matches the main change. The PR makes get_model_pricing in stats_cmd.rs check the llm_prices list before the hard-coded fallback, and it…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "stats: use llm-prices for current model rates" matches the main change. The PR makes get_model_pricing in stats_cmd.rs check the llm_prices list before the hard-coded fallback, and it adds the llm-prices 1.8.0 dependency. The title is specific, short, and free of noise. It covers the core change without listing every detail, which is acceptable.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: c355e976-88b2-43e1-8a5b-7bb1922deade
Commits
Reviewing files that changed from the base of the PR and between 7954d02 and 4cea9ec.
Files ignored due to path filters: 1
Cargo.lock is excluded by !**/*.lock
Files selected for processing: 2
src/cortex-cli/Cargo.toml
src/cortex-cli/src/stats_cmd.rs
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
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
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.
cortex statsprices any opus-4 id at $15/$75, so Opus 4.5 and later show 3x their real cost ($5/$25). o3 shows $15/$60 against a list price of $2/$8.This looks up the model id in llm-prices before the existing
contains()table.CORTEX_PRICING_*overrides still take priority, and unknown ids still fall back to the current defaults.Adds
llm-prices = "1.8.0", which has no dependencies and carries dated, source-cited rates. I'm Matthew Busel and I maintain llm-prices.Summary by CodeRabbit