Skip to content

stats: use llm-prices for current model rates - #420

Open
Matthew Charles Vladislav Busel (Mattbusel) wants to merge 1 commit into
CortexLM:mainfrom
tensorust-ai:deps/llm-prices-stats-pricing
Open

Matthew Charles Vladislav Busel (Mattbusel) wants to merge 1 commit into
CortexLM:mainfrom
tensorust-ai:deps/llm-prices-stats-pricing

Conversation

@Mattbusel

@Mattbusel Matthew Charles Vladislav Busel (Mattbusel) commented Nov 21, 2026 •

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 4cea9

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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant