Skip to content

fix(pricing): resolve Claude dot-separated model aliases - #1154

Merged
ryoppippi merged 4 commits into
mainfrom
codex/fix-opus-47-usage
May 25, 2026
Merged

ryoppippi merged 4 commits into
mainfrom
codex/fix-opus-47-usage

Conversation

@ryoppippi

@ryoppippi ryoppippi commented May 25, 2026 •

Copy link
Copy Markdown
Member

Fixes #1125.

This updates pricing lookup so Claude model identifiers with dot or provider separators, such as claude-opus-4.7, resolve to the same embedded pricing as canonical hyphenated model IDs. It also keeps fuzzy matching boundary-aware so nearby versions like 4.70 do not accidentally match 4.7, and updates embedded context fallbacks for current Claude Opus 4.6, Opus 4.7, and Sonnet 4.6 models.

Testing:

  • pnpm run format
  • env -u CFLAGS direnv exec . cargo test --manifest-path rust/Cargo.toml -p ccusage pricing::tests:: -- --nocapture
  • env -u CFLAGS direnv exec . pnpm run test
  • pnpm typecheck
  • env -u CFLAGS direnv exec . cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets -- -D warnings

Summary by cubic

Fix pricing lookup for Claude models with dots or provider prefixes so they resolve to canonical hyphenated keys. Prevents claude-opus-4.7 from falling back to older Opus 4 pricing and sets correct 1M context windows.

  • Bug Fixes

    • Normalize pricing keys: map . and @ to - (e.g., claude-opus-4.7 and openrouter/anthropic/claude-opus-4.7 → claude-opus-4-7).
    • Require boundaries in fuzzy matches so 4.70 doesn’t match 4.7.
    • Set 1M context for claude-opus-4-6, claude-opus-4-7, and claude-sonnet-4-6.
  • Refactors

    • Apply rustfmt to pricing tests and context limits.
    • Add inline docs clarifying boundary-aware alias matching.

Written for commit f27ae5e. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Improvements
    • Boundary-aware, separator-normalized model-name matching so variants like "claude-opus-4.7" and "claude-opus-4-7" resolve consistently and avoid false matches from similar names (e.g., preventing "claude-opus-4.70" matching "claude-opus-4-7").
  • Updates
    • Adjusted context window limits: select Claude models set to 1,000,000 tokens; others in the group use 200,000.
  • Tests
    • Added tests for alias variants, boundary matching, and specific model resolutions.

Review Change Stack

Normalize pricing lookup keys so Claude model identifiers that use dot or provider separators, such as claude-opus-4.7, resolve to the same embedded pricing as their canonical hyphenated forms.

This prevents Opus 4.7 usage from falling back to older Opus 4 pricing in calculate mode while keeping exact model entries authoritative and requiring boundaries for fuzzy matches.

Also updates embedded context fallbacks for current Claude Opus 4.6, Opus 4.7, and Sonnet 4.6 models to match their 1M context windows.

Validation: pnpm run format; env -u CFLAGS direnv exec . cargo test --manifest-path rust/Cargo.toml -p ccusage pricing::tests:: -- --nocapture; env -u CFLAGS direnv exec . pnpm run test; pnpm typecheck
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@ryoppippi, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 10 reviews of capacity. Refill in 4 minutes and 31 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b351daa-babc-4256-9030-fdfc8a7e1136

📥 Commits

Reviewing files that changed from the base of the PR and between dbb66b6 and f27ae5e.

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

Walkthrough

Model-name resolution in pricing/context lookups now uses normalized, boundary-aware fuzzy matching (treating ./@ as - and enforcing non-alphanumeric boundaries). Builtin Claude context limits adjusted: claude-opus-4-6, claude-opus-4-7, and claude-sonnet-4-6 set to 1_000_000. Unit tests added for alias and boundary cases.

Changes

Model Matching and Context Limits

Layer / File(s) Summary
Boundary-aware fuzzy matching implementation
rust/crates/ccusage/src/pricing.rs
Adds helper functions (normalized_pricing_key, pricing_key_matches, contains_pricing_key, is_pricing_key_boundary) and imports Cow to normalize model strings (map ./@ → -) and enforce non-alphanumeric boundary-aware matching.
Apply fuzzy matching to pricing lookups
rust/crates/ccusage/src/pricing.rs
PricingMap::find and PricingMap::context_limit replace substring-containment fallback filters with the new normalized, boundary-aware fuzzy matching predicate.
Update builtin context window limits
rust/crates/ccusage/src/pricing.rs
Reassigns builtin Claude context limits so claude-opus-4-7, claude-opus-4-6, and claude-sonnet-4-6 receive 1_000_000, with the remaining listed Claude models set to 200_000.
Tests for fuzzy matching and context limits
rust/crates/ccusage/src/pricing.rs
Adds unit tests for dot/separator alias resolution (claude-opus-4.7), separator normalization across Claude model variants, and boundary-respecting matching (ensuring claude-opus-4.70 does not match claude-opus-4-7).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • ryoppippi/ccusage#689: Related work improving pricing/model-name matching logic across the project (TS and Rust changes to handle provider/model variants).
  • ryoppippi/ccusage#1018: Closely related changes to fuzzy model-name matching to prevent incorrect substring matches in pricing lookups.

Poem

🐰 I hop through dots and dashes neat,
I nudge the keys so matches meet,
Opus bounds now vast and wide,
Small mistakes no longer hide,
A rabbit cheers for matches sweet.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.46% 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
Title check ✅ Passed The PR title directly describes the main change: fixing pricing lookup for Claude dot-separated model aliases (e.g., claude-opus-4.7). This matches the core objective of enabling fuzzy boundary-aware matching.
Linked Issues check ✅ Passed The PR addresses the primary coding objective from #1125: enabling ccusage to recognize Claude Opus 4.7 by implementing fuzzy matching for dot-separated model aliases. The context limit updates (1M for opus-4-6/4-7/sonnet-4-6) support proper usage reporting.
Out of Scope Changes check ✅ Passed All code changes (fuzzy matching implementation, context limit updates, and test coverage) are directly scoped to resolving Claude model alias pricing lookups. No unrelated modifications detected.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-opus-47-usage

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

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

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 25, 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 f27ae5e Commit Preview URL

Branch Preview URL
May 25 2026, 07:21 PM

@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)

545-575: 💤 Low value

Boundary-aware fuzzy matching implementation is correct.

The helper functions implement the core matching logic properly:

  • contains_pricing_key uses match_indices and boundary checks to prevent false matches (e.g., "4.70" won't match "4-7")
  • normalized_pricing_key efficiently uses Cow to avoid allocation when no normalization is needed
  • pricing_key_matches checks both directions (stored key in query, query in stored key) after normalization

The boundary definition (non-alphanumeric ASCII) correctly handles version separators while preventing partial version matches.

📝 Optional: Add doc comments for maintainability

Consider adding brief doc comments to explain the boundary-aware matching semantics, especially for pricing_key_matches which encapsulates the core fuzzy matching algorithm:

/// Checks if a candidate pricing key matches a model string using boundary-aware fuzzy matching.
/// Normalizes '.' and '@' separators to '-' and requires matches to align on non-alphanumeric boundaries.
fn pricing_key_matches(candidate: &str, model: &str, normalized_model: &str) -> bool {
    // ... existing implementation
}
🤖 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 545 - 575, Add concise doc
comments explaining the boundary-aware fuzzy matching behavior for pricing keys:
document pricing_key_matches (what it does, that it normalizes '.' and '@' to
'-' and checks both directions), contains_pricing_key (that it uses
match_indices and checks non-alphanumeric ASCII boundaries),
is_pricing_key_boundary (defines boundary as non-alphanumeric ASCII), and
normalized_pricing_key (returns Cow and replaces separators). Place the comments
immediately above each corresponding function (pricing_key_matches,
contains_pricing_key, is_pricing_key_boundary, normalized_pricing_key) and keep
them short and focused for maintainability.
🤖 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 545-575: Add concise doc comments explaining the boundary-aware
fuzzy matching behavior for pricing keys: document pricing_key_matches (what it
does, that it normalizes '.' and '@' to '-' and checks both directions),
contains_pricing_key (that it uses match_indices and checks non-alphanumeric
ASCII boundaries), is_pricing_key_boundary (defines boundary as non-alphanumeric
ASCII), and normalized_pricing_key (returns Cow and replaces separators). Place
the comments immediately above each corresponding function (pricing_key_matches,
contains_pricing_key, is_pricing_key_boundary, normalized_pricing_key) and keep
them short and focused for maintainability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d75e59fd-74be-4d01-a1e1-70f1576be5ef

📥 Commits

Reviewing files that changed from the base of the PR and between bf84d4b and e7ab886.

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

@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.

No issues found across 1 file

Re-trigger cubic

Apply cargo fmt to the Claude pricing alias tests and context fallback array so nix flake check passes the Rust formatting check.

Validation: env -u CFLAGS direnv exec . cargo test --manifest-path rust/Cargo.toml -p ccusage pricing::tests:: -- --nocapture; env NIX_CONFIG="access-tokens = github.com=$(gh auth token)" nix flake check --print-build-logs
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review\n\nPushed 12ee23d to apply rustfmt after CI caught the Rust formatting check. Validation now includes the focused pricing tests and local nix flake check.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

@ryoppippi Triggering a review of the latest commit (12ee23d).

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Add concise helper documentation for the boundary-aware pricing key matching requested by CodeRabbit.

The comments explain the matching semantics for separator normalization and version boundaries without changing runtime behavior.

Validation: direnv exec . cargo fmt --manifest-path rust/Cargo.toml --all; env -u CFLAGS direnv exec . cargo test --manifest-path rust/Cargo.toml -p ccusage pricing::tests:: -- --nocapture
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review\n\nPushed dbb66b6 to address your maintainability nit by documenting the boundary-aware pricing alias helpers. Validation: cargo fmt and focused pricing tests passed.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

@ryoppippi Triggering a review of the latest commit (dbb66b6) — thanks for adding docs to the boundary-aware helpers!

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@pkg-pr-new

pkg-pr-new Bot commented May 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ryoppippi/ccusage@1154

@ccusage/ccusage-darwin-arm64

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

@ccusage/ccusage-darwin-x64

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

@ccusage/ccusage-linux-arm64

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

@ccusage/ccusage-linux-x64

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

@ccusage/ccusage-win32-arm64

npx https://pkg.pr.new/ryoppippi/ccusage/@ccusage/ccusage-win32-arm64@1154

@ccusage/ccusage-win32-x64

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

commit: f27ae5e

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: e7ab8867b189
Base SHA: bf84d4bc1ce8

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 bf84d4bc1ce8 624.9ms 517.6ms 34.7ms 3
PR pkg.pr.new e7ab8867b189 471.3ms 470.7ms 35.1ms 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: bf84d4bc1ce8; PR package: e7ab8867b189. 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 506.9ms 518.1ms 0.98x 265.20 MiB 253.08 MiB 0.95x 1.99 GiB/s 1.94 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 362.6ms 370.3ms 0.98x 67.08 MiB 58.08 MiB 0.87x 2.78 GiB/s 2.72 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 508.9ms 1.98 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 476.2ms 2.11 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 367.1ms 2.74 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 332.4ms 3.03 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 31.8ms 31.4ms 1.01x 43.61 MiB 43.61 MiB 1.00x 0.05 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 31.7ms 32.1ms 0.99x 43.73 MiB - - 0.05 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 31.2ms 31.0ms 1.01x 43.48 MiB 43.61 MiB 1.00x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 31.8ms 31.3ms 1.01x 43.48 MiB 43.61 MiB 1.00x 0.03 MiB/s 0.03 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 493.7ms 508.5ms 0.97x 245.95 MiB 254.33 MiB 1.03x 2.04 GiB/s 1.98 GiB/s
codex --offline --json 1.01 GiB 364.4ms 392.1ms 0.93x 62.58 MiB 57.58 MiB 0.92x 2.76 GiB/s 2.57 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB -0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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: e7ab8867b189
Base SHA: bf84d4bc1ce8

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 bf84d4bc1ce8 561.7ms 566.7ms 36.6ms 3
PR pkg.pr.new e7ab8867b189 487.2ms 619.6ms 36.7ms 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: bf84d4bc1ce8; PR package: e7ab8867b189. 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 511.8ms 516.7ms 0.99x 249.33 MiB 262.33 MiB 1.05x 1.97 GiB/s 1.95 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 421.2ms 384.1ms 1.10x 59.20 MiB 60.83 MiB 1.03x 2.39 GiB/s 2.62 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 518.7ms 1.94 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 486.1ms 2.07 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 372.3ms 2.70 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 346.7ms 2.90 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 32.9ms 4.6ms 7.22x 43.61 MiB 2.83 MiB 0.06x 0.05 MiB/s 0.34 MiB/s
claude session --offline --json 0.00 MiB 33.1ms 4.6ms 7.20x - 2.83 MiB - 0.05 MiB/s 0.34 MiB/s
codex daily --offline --json 0.00 MiB 33.3ms 4.3ms 7.82x 43.48 MiB 2.83 MiB 0.07x 0.03 MiB/s 0.20 MiB/s
codex session --offline --json 0.00 MiB 32.2ms 4.3ms 7.50x 43.61 MiB 2.83 MiB 0.06x 0.03 MiB/s 0.20 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 513.1ms 490.5ms 1.05x - 262.33 MiB - 1.96 GiB/s 2.05 GiB/s
codex --offline --json 1.01 GiB 362.2ms 336.6ms 1.08x 51.08 MiB 65.95 MiB 1.29x 2.78 GiB/s 2.99 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB -0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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.

…x/fix-opus-47-usage

# Conflicts:
#	rust/crates/ccusage/src/pricing.rs
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

Pushed f27ae5e to merge latest main and resolve the pricing.rs conflict. Kept the Claude alias/context fix and retained the new main-side Kimi context/pricing updates. Validation after conflict resolution: cargo fmt --check and focused pricing tests passed.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

@ryoppippi Triggering a review of the latest commit (f27ae5e) — glad the merge conflict resolution went smoothly, keeping both the Claude alias/context fix and the Kimi updates from main!

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

Re-triggering after the temporary review capacity limit. Latest head remains f27ae5e with the main merge conflict resolved.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 12ee23d92948
Base SHA: bf84d4bc1ce8

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 bf84d4bc1ce8 553.3ms 452.8ms 32.3ms 3
PR pkg.pr.new 12ee23d92948 427.3ms 501.2ms 33.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: bf84d4bc1ce8; PR package: 12ee23d92948. 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 489.6ms 508.1ms 0.96x 273.95 MiB 249.58 MiB 0.91x 2.06 GiB/s 1.98 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 356.0ms 365.1ms 0.98x 63.58 MiB 58.45 MiB 0.92x 2.83 GiB/s 2.76 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 498.1ms 2.02 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 469.7ms 2.14 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 362.2ms 2.78 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 336.8ms 2.99 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 30.5ms 30.7ms 0.99x 43.73 MiB 43.48 MiB 0.99x 0.05 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 30.8ms 30.8ms 1.00x 43.61 MiB 43.61 MiB 1.00x 0.05 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 30.3ms 30.4ms 1.00x - 43.48 MiB - 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 30.3ms 32.1ms 0.94x 43.61 MiB 43.73 MiB 1.00x 0.03 MiB/s 0.03 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 491.2ms 491.5ms 1.00x 257.95 MiB 247.20 MiB 0.96x 2.05 GiB/s 2.05 GiB/s
codex --offline --json 1.01 GiB 351.6ms 357.4ms 0.98x 61.45 MiB 66.20 MiB 1.08x 2.86 GiB/s 2.82 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB -0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

@ryoppippi Triggering a review of the latest commit (f27ae5e) — happy to pick this back up now that capacity is available again!

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 12ee23d92948
Base SHA: bf84d4bc1ce8

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 bf84d4bc1ce8 506.0ms 496.8ms 35.3ms 3
PR pkg.pr.new 12ee23d92948 398.2ms 522.6ms 35.0ms 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: bf84d4bc1ce8; PR package: 12ee23d92948. 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 505.5ms 501.3ms 1.01x 261.45 MiB 266.33 MiB 1.02x 1.99 GiB/s 2.01 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 396.9ms 365.7ms 1.09x 59.20 MiB 50.95 MiB 0.86x 2.54 GiB/s 2.75 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 500.8ms 2.01 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 470.0ms 2.14 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 368.9ms 2.73 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 335.1ms 3.00 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 31.8ms 4.2ms 7.62x 43.61 MiB 2.83 MiB 0.06x 0.05 MiB/s 0.37 MiB/s
claude session --offline --json 0.00 MiB 32.2ms 4.2ms 7.63x 43.48 MiB 2.95 MiB 0.07x 0.05 MiB/s 0.37 MiB/s
codex daily --offline --json 0.00 MiB 31.5ms 3.9ms 8.14x 43.61 MiB 2.83 MiB 0.06x 0.03 MiB/s 0.22 MiB/s
codex session --offline --json 0.00 MiB 32.0ms 3.8ms 8.33x 43.61 MiB 2.83 MiB 0.06x 0.03 MiB/s 0.22 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 493.5ms 472.0ms 1.05x 269.70 MiB 263.83 MiB 0.98x 2.04 GiB/s 2.13 GiB/s
codex --offline --json 1.01 GiB 357.0ms 336.0ms 1.06x 63.70 MiB 52.20 MiB 0.82x 2.82 GiB/s 3.00 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB -0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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: dbb66b6728a5
Base SHA: bf84d4bc1ce8

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 bf84d4bc1ce8 501.9ms 624.5ms 33.7ms 3
PR pkg.pr.new dbb66b6728a5 482.7ms 719.1ms 34.0ms 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: bf84d4bc1ce8; PR package: dbb66b6728a5. 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 525.5ms 495.6ms 1.06x 260.45 MiB 253.70 MiB 0.97x 1.92 GiB/s 2.03 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 363.9ms 358.1ms 1.02x 56.45 MiB 67.45 MiB 1.19x 2.77 GiB/s 2.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 493.7ms 2.04 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 458.0ms 2.20 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 358.6ms 2.81 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 326.7ms 3.08 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 30.5ms 30.8ms 0.99x 43.61 MiB 43.61 MiB 1.00x 0.05 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 30.6ms 30.5ms 1.00x - 43.48 MiB - 0.05 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 30.4ms 30.6ms 0.99x 43.48 MiB 43.48 MiB 1.00x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 30.3ms 30.7ms 0.99x 43.48 MiB 43.48 MiB 1.00x 0.03 MiB/s 0.03 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 505.4ms 503.0ms 1.00x 275.33 MiB 258.58 MiB 0.94x 1.99 GiB/s 2.00 GiB/s
codex --offline --json 1.01 GiB 369.3ms 367.5ms 1.00x - 64.45 MiB - 2.73 GiB/s 2.74 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB +0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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: dbb66b6728a5
Base SHA: bf84d4bc1ce8

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 bf84d4bc1ce8 463.5ms 593.4ms 34.5ms 3
PR pkg.pr.new dbb66b6728a5 540.0ms 514.8ms 35.0ms 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: bf84d4bc1ce8; PR package: dbb66b6728a5. 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 512.6ms 519.0ms 0.99x 254.20 MiB 265.08 MiB 1.04x 1.96 GiB/s 1.94 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 399.6ms 369.8ms 1.08x 51.95 MiB 59.08 MiB 1.14x 2.52 GiB/s 2.72 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 502.9ms 2.00 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 477.5ms 2.11 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 361.6ms 2.78 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 334.8ms 3.01 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 31.6ms 4.3ms 7.29x 43.61 MiB 2.83 MiB 0.06x 0.05 MiB/s 0.36 MiB/s
claude session --offline --json 0.00 MiB 32.0ms 4.3ms 7.38x 43.73 MiB 2.83 MiB 0.06x 0.05 MiB/s 0.36 MiB/s
codex daily --offline --json 0.00 MiB 31.3ms 4.0ms 7.79x 43.73 MiB 2.83 MiB 0.06x 0.03 MiB/s 0.21 MiB/s
codex session --offline --json 0.00 MiB 31.3ms 3.9ms 7.93x 43.61 MiB 2.83 MiB 0.06x 0.03 MiB/s 0.22 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 504.5ms 470.9ms 1.07x 260.45 MiB 270.95 MiB 1.04x 2.00 GiB/s 2.14 GiB/s
codex --offline --json 1.01 GiB 359.5ms 329.3ms 1.09x 57.58 MiB 60.95 MiB 1.06x 2.80 GiB/s 3.06 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB +0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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: f27ae5e4b582
Base SHA: 70d458447dec

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 70d458447dec 565.0ms 519.0ms 33.2ms 3
PR pkg.pr.new f27ae5e4b582 742.6ms 548.6ms 32.9ms 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: 70d458447dec; PR package: f27ae5e4b582. 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 501.2ms 493.8ms 1.01x 247.33 MiB 255.70 MiB 1.03x 2.01 GiB/s 2.04 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 383.0ms 363.5ms 1.05x 59.83 MiB 57.45 MiB 0.96x 2.63 GiB/s 2.77 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 486.0ms 2.07 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 466.7ms 2.16 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 362.0ms 2.78 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 332.1ms 3.03 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 30.4ms 4.0ms 7.63x 43.61 MiB 2.83 MiB 0.06x 0.05 MiB/s 0.39 MiB/s
claude session --offline --json 0.00 MiB 30.7ms 4.1ms 7.56x 43.48 MiB 2.83 MiB 0.07x 0.05 MiB/s 0.38 MiB/s
codex daily --offline --json 0.00 MiB 30.6ms 3.7ms 8.22x 43.48 MiB 2.83 MiB 0.07x 0.03 MiB/s 0.23 MiB/s
codex session --offline --json 0.00 MiB 30.3ms 3.7ms 8.12x - 2.83 MiB - 0.03 MiB/s 0.23 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 501.6ms 457.7ms 1.10x 253.20 MiB 260.83 MiB 1.03x 2.01 GiB/s 2.20 GiB/s
codex --offline --json 1.01 GiB 366.7ms 327.4ms 1.12x 51.70 MiB 57.20 MiB 1.11x 2.75 GiB/s 3.08 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB -0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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: f27ae5e4b582
Base SHA: 70d458447dec

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 70d458447dec 590.9ms 706.4ms 33.1ms 3
PR pkg.pr.new f27ae5e4b582 507.3ms 535.6ms 32.7ms 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: 70d458447dec; PR package: f27ae5e4b582. 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 509.6ms 516.4ms 0.99x 265.33 MiB 267.83 MiB 1.01x 1.98 GiB/s 1.95 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 369.7ms 361.8ms 1.02x 64.95 MiB 55.20 MiB 0.85x 2.72 GiB/s 2.78 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 488.2ms 2.06 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 459.7ms 2.19 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 354.6ms 2.84 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 325.9ms 3.09 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 29.8ms 30.4ms 0.98x 43.48 MiB 43.48 MiB 1.00x 0.05 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 30.0ms 30.1ms 1.00x 43.73 MiB 43.48 MiB 0.99x 0.05 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 29.3ms 29.2ms 1.00x 43.73 MiB 43.48 MiB 0.99x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 29.6ms 29.6ms 1.00x 43.61 MiB 43.61 MiB 1.00x 0.03 MiB/s 0.03 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 492.9ms 491.1ms 1.00x 268.83 MiB 292.33 MiB 1.09x 2.04 GiB/s 2.05 GiB/s
codex --offline --json 1.01 GiB 354.6ms 348.8ms 1.02x 58.08 MiB 66.70 MiB 1.15x 2.84 GiB/s 2.89 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB -0.00 KiB 1.00x
installed native package binary 3289.49 KiB 3289.49 KiB +0.00 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 0113543 into main May 25, 2026
39 checks passed
@ryoppippi
ryoppippi deleted the codex/fix-opus-47-usage branch May 25, 2026 19:54
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.

is opus supported ? usage limits ?

1 participant