Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zengbo/ccusage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: zengbo/ccusage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix/codex-cache-write-tokens
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 10 files changed
  • 2 contributors

Commits on Jul 10, 2026

  1. feat(codex): parse and price cache_write_tokens for GPT-5.6 prompt ca…

    …ching
    
    GPT-5.6 and later model families bill prompt-cache writes at the
    cache-write rate (1.25x input by default) and report them via
    cache_write_tokens in usage. The codex adapter previously hardcoded
    cacheCreationTokens to 0 and priced all non-cached input at the plain
    input rate, so cache writes were invisible and costs underestimated.
    
    - parse cache_write_tokens into CodexRawUsage (cumulative-total deltas
      included) and clamp it to the non-cached input subset
    - aggregate per group/model with a long-context bucket, mirroring
      cached-input handling
    - price writes with Pricing::cache_create (cache_create_above_200k for
      the long-context tier)
    - report the value as cacheCreationTokens in codex JSON and the unified
      report, subtracting writes from plain input to avoid double counting
    - add a Cache Create column to the codex focused table
    
    Codex CLI <= 0.144.1 does not persist cache_write_tokens in rollout
    files yet, so existing logs keep reporting 0; output for such logs is
    byte-identical to before.
    
    Fixes ccusage#1422
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01DmpB9eSnRtDpCBP77SbHSo
    zengbo and claude committed Jul 10, 2026
    Configuration menu
    Copy the full SHA
    4ce472b View commit details
    Browse the repository at this point in the history
Loading