Skip to content

fix(pricing): resolve Codex log model aliases - #1301

Merged
ryoppippi merged 3 commits into
mainfrom
codex/fix-codex-model-alias-pricing
Jun 12, 2026
Merged

fix(pricing): resolve Codex log model aliases#1301
ryoppippi merged 3 commits into
mainfrom
codex/fix-codex-model-alias-pricing

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Jun 12, 2026

Copy link
Copy Markdown
Member

Adds pricing fallback aliases for Codex log model names that are not published directly by upstream pricing sources.

Codex reports now preserve raw log labels such as codex-auto-review and gpt-5.3-spark while resolving their costs through canonical model pricing keys.

Testing:

  • nix develop --command cargo test --manifest-path rust/Cargo.toml -p ccusage embedded_pricing_resolves_codex
  • nix develop --command cargo fmt --manifest-path rust/crates/ccusage/Cargo.toml --check

Summary by CodeRabbit

  • Bug Fixes

    • Model aliases are now correctly resolved to their canonical versions when looking up pricing information
    • Context limit retrieval for model aliases now works properly through automatic canonical name mapping
    • Previously unrecognized model alias names are now fully supported in pricing queries
  • Tests

    • Added test cases to validate that model aliases correctly map to their pricing entries and context limits

Codex session logs can record codex-auto-review as the model name for review runs, but LiteLLM and the embedded pricing table do not publish that identifier directly.

Resolve the internal review model to the latest embedded Codex pricing so reports keep the raw model label while still calculating cost and avoiding missing-pricing warnings.
Codex logs can contain internal or shortened model identifiers that are not published as pricing keys. Treat these as model-name aliases instead of adding duplicated pricing rows.

The fallback now preserves the raw model label in reports while resolving codex-auto-review to gpt-5.5 and gpt-5.3-spark to the existing gpt-5.3-codex-spark pricing path.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 1629c12 Commit Preview URL

Branch Preview URL
Jun 12 2026, 11:34 AM

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 83bfb258-7440-4f99-a603-56ba1f8ebba4

📥 Commits

Reviewing files that changed from the base of the PR and between 954267f and 1629c12.

📒 Files selected for processing (1)
  • rust/crates/ccusage/src/pricing.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • rust/crates/ccusage/src/pricing.rs

📝 Walkthrough

Walkthrough

Pricing lookup now resolves known model aliases via a new pricing_alias mapping; PricingMap::find and context_limit use alias-aware helpers that retry lookups with canonical model names. Unit tests verify alias resolution for two model names.

Changes

Model Aliasing in Pricing Resolution

Layer / File(s) Summary
Alias mapping definition
rust/crates/ccusage/src/pricing.rs
Added pricing_alias returning static canonical mappings for codex-auto-reviewgpt-5.5 and gpt-5.3-sparkgpt-5.3-codex-spark.
Alias-aware lookup and PricingMap::find
rust/crates/ccusage/src/pricing.rs
Refactored PricingMap::find to use an alias-aware helper that tries direct find_entry then retries with pricing_alias; applied to primary table and both models.dev fallback paths.
Context limit alias fallback
rust/crates/ccusage/src/pricing.rs
Added context_limit_entry_or_alias and updated PricingMap::context_limit to retry using pricing_alias when direct context-limit lookup misses.
Validation tests
rust/crates/ccusage/src/pricing.rs
Added embedded tests asserting codex-auto-review matches gpt-5.5 pricing (and context_limit) and gpt-5.3-spark matches gpt-5.3-codex-spark pricing including fast_multiplier.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • pullfrog

Poem

🐰 I hop through alias maps at play,
Two model names find home today,
Lookups now can twist and bind,
Canonical friends they always find,
A rabbit's cheer for clearer lines!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix(pricing): resolve Codex log model aliases' is concise and clearly summarizes the main change: adding alias resolution for Codex model names in the pricing system.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-codex-model-alias-pricing

Comment @coderabbitai help to get the list of available commands and usage tips.

@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

Please review this PR for the Codex model alias pricing changes.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get PR details
gh pr view 1301 --repo ccusage/ccusage

echo "---FILES CHANGED---"
gh pr diff 1301 --repo ccusage/ccusage

Length of output: 4495


🏁 Script executed:

#!/bin/bash
# Get more context around find_entry, normalized_pricing_key, and surrounding code
rg -n "fn find_entry|fn normalized_pricing_key|fn pricing_alias|fn matches_model_suffix|fn load_embedded" rust/crates/ccusage/src/pricing.rs

echo "---normalized_pricing_key full impl---"
sed -n '1110,1145p' rust/crates/ccusage/src/pricing.rs

echo "---find_entry full impl---"
sed -n '385,420p' rust/crates/ccusage/src/pricing.rs

echo "---matches_model_suffix full impl---"
sed -n '1130,1170p' rust/crates/ccusage/src/pricing.rs

echo "---load_embedded impl---"
rg -n "load_embedded" rust/crates/ccusage/src/pricing.rs

echo "---embedded pricing data for gpt-5.5 and gpt-5.3---"
rg -n "gpt-5.5\|gpt-5.3-codex-spark\|codex-auto-review\|gpt-5.3-spark" rust/crates/ccusage/src/

echo "---Full find() method before and after---"
sed -n '355,400p' rust/crates/ccusage/src/pricing.rs

echo "---pricing_alias location---"
sed -n '1118,1145p' rust/crates/ccusage/src/pricing.rs

Length of output: 9469



@ryoppippi: Here is the review of PR #1301.


Review: fix(pricing): resolve Codex log model aliases

Summary

The change is well-structured and minimal. The new find_entry_or_alias indirection correctly slots into all three resolution paths (find() → primary, network models.dev, embedded models.dev), and the alias table is a clean separation from the fuzzy pricing_key_matches logic.


Issues

1. context_limit() does not benefit from alias resolution (potential inconsistency)

context_limit_entry() still calls find_entry-style logic directly without any alias lookup. If any consumer queries the context window size for codex-auto-review or gpt-5.3-spark, it will get None while find() returns a valid Pricing. This asymmetry can surprise callers.

Consider applying the same alias pattern to context_limit_entry:

fn context_limit_entry_or_alias(&self, model: &str) -> Option<u64> {
    self.context_limit_entry(model)
        .or_else(|| pricing_alias(model).and_then(|alias| self.context_limit_entry(alias)))
}

…and threading it through context_limit() the same way find_entry_or_alias was threaded through find().

2. pricing_alias has no documentation comment

The mapping "codex-auto-review""gpt-5.5" is opaque without context. Future maintainers (and automated agents) will not know why this alias exists, which model version it tracks, or when it should be updated.

/// Hard-coded aliases for Codex log labels that do not appear in any upstream
/// pricing source. Map the raw label emitted by the Codex agent to the
/// canonical model key that carries the correct pricing data.
///
/// Update this table when Codex introduces new internal labels or when the
/// underlying model a label resolves to changes.
fn pricing_alias(model: &str) -> Option<&'static str> {

3. Spurious git push in the PR description's testing section

- `nix develop --command git push -u origin codex/fix-codex-model-alias-pricing`

This is a push command, not a test. It was likely left in by the Codex agent and should be removed from the "Testing" section to avoid confusion.


Nits

  • Tests use .unwrap() without a message. Prefer .expect("codex-auto-review should resolve via alias") etc. to make failures self-describing.
  • The two new test functions have slightly asymmetric naming (…_model suffix on the first, none on the second). Minor, but worth aligning.

Positives

  • The three-level resolution chain (primary → network → embedded) is updated consistently.
  • The alias table deliberately bypasses fuzzy pricing_key_matches; this is the correct choice since codex-auto-review shares no structural similarity with gpt-5.5.
  • Test coverage directly validates the embedded snapshot resolves both aliases.

Overall: The core logic is correct and ready to merge. The context-limit asymmetry (item 1) is the only functional concern worth addressing before merging if context-window queries are used for these models.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — introduces a pricing_alias function and find_entry_or_alias method to resolve Codex-specific log model names (codex-auto-review, gpt-5.3-spark) to canonical pricing keys.

  • Add pricing_alias() mapping — static function mapping codex-auto-reviewgpt-5.5 and gpt-5.3-sparkgpt-5.3-codex-spark. The latter resolves through the existing fuzzy matching against gpt-5.3-codex in the primary table.
  • Add PricingMap::find_entry_or_alias() — tries exact/fuzzy match first, then falls back to alias lookup. Wired into all three pricing fallback paths (find calls network models.dev and embedded models.dev with the same alias-aware method).
  • Two tests validate price equivalence between the alias and its canonical target, covering both the primary table path and (via load_embedded) the embedded models.dev path.

Pullfrog  | View workflow run | Using Big Pickle (free via Pullfrog for OSS) | 𝕏

CodeRabbit pointed out that model aliases resolved pricing but not context limits, which made alias handling asymmetric for callers that ask for context-window metadata.

Route context limit lookup through the same model alias path as pricing, and make the alias tests cover the context limit behavior with clearer failure messages.
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

Addressed your feedback in 1629c12:

  • routed context_limit through the same model alias fallback path as pricing
  • added context-limit coverage for codex-auto-review
  • replaced unwraps in the new alias tests with explicit expect messages
  • removed the push command from the PR Testing section

Validation:

  • nix develop --command cargo test --manifest-path rust/Cargo.toml -p ccusage embedded_pricing_resolves_codex
  • nix develop --command cargo fmt --manifest-path rust/crates/ccusage/Cargo.toml --check
  • pre-push hooks passed: clippy, treefmt, gitleaks, cargo test

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
rust/crates/ccusage/src/pricing.rs (1)

363-380: 💤 Low value

Consider adding alias support to context_limit for consistency.

The find method now resolves aliases across all lookup paths, but context_limit (lines 402-416) still uses direct lookup without alias resolution. This means pricing.find("codex-auto-review") returns gpt-5.5 pricing, but pricing.context_limit("codex-auto-review") won't return gpt-5.5's limit.

Since downstream cost calculation only uses find(), this doesn't block the PR's goals. However, for future maintainability, consider extracting a similar context_limit_entry_or_alias helper.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@rust/crates/ccusage/src/pricing.rs` around lines 363 - 380, The context_limit
path currently does a direct lookup and ignores aliases, causing calls like
pricing.context_limit("codex-auto-review") to miss the aliased model resolved by
pricing.find; add alias-aware resolution by extracting a helper (e.g.,
context_limit_entry_or_alias) that mirrors find_entry_or_alias behavior
(including falling back to models_dev_pricing() when enable_models_dev_fallback
is set and to embedded_models_dev_pricing() when
enable_embedded_models_dev_fallback is set) and then have context_limit call
that helper to return the correct context limit for aliased names.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@rust/crates/ccusage/src/pricing.rs`:
- Around line 363-380: The context_limit path currently does a direct lookup and
ignores aliases, causing calls like pricing.context_limit("codex-auto-review")
to miss the aliased model resolved by pricing.find; add alias-aware resolution
by extracting a helper (e.g., context_limit_entry_or_alias) that mirrors
find_entry_or_alias behavior (including falling back to models_dev_pricing()
when enable_models_dev_fallback is set and to embedded_models_dev_pricing() when
enable_embedded_models_dev_fallback is set) and then have context_limit call
that helper to return the correct context limit for aliased names.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: abec4177-5f3b-4e89-8fe4-2d3b0363f1b7

📥 Commits

Reviewing files that changed from the base of the PR and between 49d5979 and 954267f.

📒 Files selected for processing (1)
  • rust/crates/ccusage/src/pricing.rs

@pkg-pr-new

pkg-pr-new Bot commented Jun 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ccusage@1301

@ccusage/ccusage-darwin-arm64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-arm64@1301

@ccusage/ccusage-darwin-x64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-x64@1301

@ccusage/ccusage-linux-arm64

npx https://pkg.pr.new/@ccusage/ccusage-linux-arm64@1301

@ccusage/ccusage-linux-x64

npx https://pkg.pr.new/@ccusage/ccusage-linux-x64@1301

@ccusage/ccusage-win32-x64

npx https://pkg.pr.new/@ccusage/ccusage-win32-x64@1301

commit: 1629c12

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get latest PR diff after 1629c126
gh pr diff 1301 --repo ccusage/ccusage

echo "---PR DESCRIPTION---"
gh pr view 1301 --repo ccusage/ccusage --json body -q '.body'

Length of output: 6099



@ryoppippi: All four items from the previous review have been addressed in commit 1629c12 — confirmed by the diff:

Concern Status
context_limit asymmetry context_limit_entry_or_alias added; all three resolution paths updated
context_limit test coverage for codex-auto-review ✅ Assertion added in embedded_pricing_resolves_codex_auto_review_model
.unwrap().expect("…") ✅ Done in both new tests
Spurious git push in PR description ✅ Removed
pricing_alias doc comment ✅ Added

One tiny observation (non-blocking): embedded_pricing_resolves_codex_spark_short_model_alias doesn't assert context_limit for gpt-5.3-spark the way the codex-auto-review test does, but since the pattern is exercised in the other test and context_limit_entry_or_alias is shared logic, this is fine.

The PR looks good to me. 🐇

[approve]

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="rust/crates/ccusage/src/pricing.rs">

<violation number="1" location="rust/crates/ccusage/src/pricing.rs:364">
P2: Alias resolution was added for `find()` but not for `context_limit()`, causing Codex alias models to price correctly while still using the default 200k context window.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic


pub(crate) fn find(&self, model: &str) -> Option<Pricing> {
self.find_entry(model)
self.find_entry_or_alias(model)

@cubic-dev-ai cubic-dev-ai Bot Jun 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Alias resolution was added for find() but not for context_limit(), causing Codex alias models to price correctly while still using the default 200k context window.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At rust/crates/ccusage/src/pricing.rs, line 364:

<comment>Alias resolution was added for `find()` but not for `context_limit()`, causing Codex alias models to price correctly while still using the default 200k context window.</comment>

<file context>
@@ -361,22 +361,29 @@ impl PricingMap {
 
     pub(crate) fn find(&self, model: &str) -> Option<Pricing> {
-        self.find_entry(model)
+        self.find_entry_or_alias(model)
             .or_else(|| {
                 self.enable_models_dev_fallback
</file context>
Fix with cubic

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — the incremental commit 1629c12 adds context_limit_entry_or_alias (mirroring the existing find_entry_or_alias) and wires it into context_limit across all three pricing fallback tiers, addressing prior review feedback about alias-aware context limit resolution.

  • Add context_limit_entry_or_alias — new method that tries direct + fuzzy match first, then falls back to pricing_alias lookup
  • Update context_limit — all three pricing paths (primary, network models.dev, embedded models.dev) now use the alias-aware entry point
  • Update testembedded_pricing_resolves_codex_auto_review_model now asserts context_limit equivalence alongside pricing fields

Pullfrog  | View workflow run | Using Big Pickle (free via Pullfrog for OSS) | 𝕏

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 954267f00344
Base SHA: 49d5979cf48b

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new 49d5979cf48b 562.3ms 603.2ms 66.0ms 3
PR pkg.pr.new 954267f 765.5ms 851.1ms 64.5ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: 49d5979cf48b; PR package: 954267f. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 959.1ms 952.4ms 1.01x 740.75 MiB 740.50 MiB 1.00x 1.05 GiB/s 1.06 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 216.1ms 209.3ms 1.03x 94.75 MiB 89.00 MiB 0.94x 4.66 GiB/s 4.81 GiB/s

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 955.6ms 1.05 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 911.4ms 1.10 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 176.7ms 5.70 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 149.0ms 6.76 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 53.9ms 5.9ms 9.07x - 3.00 MiB - 0.03 MiB/s 0.26 MiB/s
claude session --offline --json 0.00 MiB 47.1ms 6.0ms 7.90x 44.25 MiB 2.75 MiB 0.06x 0.03 MiB/s 0.26 MiB/s
codex daily --offline --json 0.00 MiB 40.3ms 5.7ms 7.12x 44.00 MiB 2.75 MiB 0.06x 0.02 MiB/s 0.15 MiB/s
codex session --offline --json 0.00 MiB 40.3ms 5.5ms 7.33x 44.00 MiB 2.75 MiB 0.06x 0.02 MiB/s 0.16 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 912.1ms 928.2ms 0.98x 742.25 MiB 722.00 MiB 0.97x 1.10 GiB/s 1.08 GiB/s
codex --offline --json 1.01 GiB 205.8ms 151.1ms 1.36x 88.75 MiB 96.25 MiB 1.08x 4.89 GiB/s 6.66 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 17.32 KiB 17.32 KiB +0.00 KiB 1.00x
installed native package binary 3324.84 KiB 3324.96 KiB +0.13 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 954267f00344
Base SHA: 49d5979cf48b

This compares the PR package against the configured base package on the same CI runner.

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new 49d5979cf48b 655.3ms 671.6ms 74.5ms 3
PR pkg.pr.new 954267f 571.5ms 633.9ms 73.8ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: 49d5979cf48b; PR package: 954267f. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 1.026s 1.064s 0.96x 743.25 MiB 741.75 MiB 1.00x 1004.75 MiB/s 968.60 MiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 248.9ms 243.9ms 1.02x 87.50 MiB 91.50 MiB 1.05x 4.04 GiB/s 4.13 GiB/s

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 963.6ms 1.04 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 883.9ms 1.14 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 198.4ms 5.08 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 143.4ms 7.02 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 46.6ms 49.9ms 0.93x 44.00 MiB 44.00 MiB 1.00x 0.03 MiB/s 0.03 MiB/s
claude session --offline --json 0.00 MiB 42.6ms 41.7ms 1.02x 44.00 MiB 44.25 MiB 1.01x 0.04 MiB/s 0.04 MiB/s
codex daily --offline --json 0.00 MiB 44.3ms 39.3ms 1.13x 44.00 MiB 44.25 MiB 1.01x 0.02 MiB/s 0.02 MiB/s
codex session --offline --json 0.00 MiB 49.5ms 42.5ms 1.16x 44.00 MiB 44.00 MiB 1.00x 0.02 MiB/s 0.02 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 1.100s 942.2ms 1.17x 741.50 MiB 734.00 MiB 0.99x 937.37 MiB/s 1.07 GiB/s
codex --offline --json 1.01 GiB 183.6ms 182.1ms 1.01x 92.00 MiB 90.25 MiB 0.98x 5.48 GiB/s 5.53 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 17.32 KiB 17.32 KiB +0.00 KiB 1.00x
installed native package binary 3324.84 KiB 3324.96 KiB +0.13 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 1629c1263847
Base SHA: 49d5979cf48b

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new 49d5979cf48b 702.6ms 701.7ms 59.4ms 3
PR pkg.pr.new 1629c12 821.6ms 661.3ms 58.6ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: 49d5979cf48b; PR package: 1629c12. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 968.5ms 932.8ms 1.04x 729.50 MiB 733.75 MiB 1.01x 1.04 GiB/s 1.08 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 205.4ms 199.8ms 1.03x 86.25 MiB 92.00 MiB 1.07x 4.90 GiB/s 5.04 GiB/s

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 941.9ms 1.07 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 900.3ms 1.12 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 167.6ms 6.01 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 129.1ms 7.80 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 46.6ms 5.7ms 8.15x 44.25 MiB 3.00 MiB 0.07x 0.03 MiB/s 0.27 MiB/s
claude session --offline --json 0.00 MiB 42.5ms 6.2ms 6.90x 44.25 MiB 2.75 MiB 0.06x 0.04 MiB/s 0.25 MiB/s
codex daily --offline --json 0.00 MiB 40.4ms 6.0ms 6.73x 44.25 MiB 2.75 MiB 0.06x 0.02 MiB/s 0.14 MiB/s
codex session --offline --json 0.00 MiB 40.9ms 5.6ms 7.24x 44.00 MiB 2.75 MiB 0.06x 0.02 MiB/s 0.15 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 775.2ms 879.3ms 0.88x 735.00 MiB 731.75 MiB 1.00x 1.30 GiB/s 1.14 GiB/s
codex --offline --json 1.01 GiB 168.1ms 131.1ms 1.28x 93.00 MiB 92.50 MiB 0.99x 5.99 GiB/s 7.68 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 17.32 KiB 17.32 KiB -0.00 KiB 1.00x
installed native package binary 3324.84 KiB 3325.09 KiB +0.25 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 1629c1263847
Base SHA: 49d5979cf48b

This compares the PR package against the configured base package on the same CI runner.

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new 49d5979cf48b 576.1ms 687.8ms 66.0ms 3
PR pkg.pr.new 1629c12 754.7ms 648.9ms 64.6ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: 49d5979cf48b; PR package: 1629c12. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 937.2ms 953.4ms 0.98x 735.50 MiB 727.25 MiB 0.99x 1.07 GiB/s 1.06 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 203.6ms 202.9ms 1.00x 90.00 MiB 91.00 MiB 1.01x 4.95 GiB/s 4.96 GiB/s

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 981.1ms 1.03 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 869.1ms 1.16 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 173.5ms 5.80 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 132.3ms 7.61 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 41.8ms 40.1ms 1.04x 44.00 MiB 44.00 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
claude session --offline --json 0.00 MiB 39.6ms 38.6ms 1.03x 44.00 MiB 44.00 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
codex daily --offline --json 0.00 MiB 39.8ms 41.4ms 0.96x 44.00 MiB 44.25 MiB 1.01x 0.02 MiB/s 0.02 MiB/s
codex session --offline --json 0.00 MiB 42.9ms 45.9ms 0.93x 44.00 MiB 44.00 MiB 1.00x 0.02 MiB/s 0.02 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 894.4ms 877.8ms 1.02x 733.75 MiB 726.50 MiB 0.99x 1.13 GiB/s 1.15 GiB/s
codex --offline --json 1.01 GiB 173.3ms 176.4ms 0.98x 91.00 MiB 91.50 MiB 1.01x 5.81 GiB/s 5.71 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 17.32 KiB 17.32 KiB -0.00 KiB 1.00x
installed native package binary 3324.84 KiB 3325.09 KiB +0.25 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@ryoppippi
ryoppippi merged commit e455f34 into main Jun 12, 2026
36 checks passed
@ryoppippi
ryoppippi deleted the codex/fix-codex-model-alias-pricing branch June 12, 2026 11:44
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