Skip to content

fix(usage): price Claude fast-mode requests at the fast rate - #13599

Merged
t3dotgg merged 2 commits into
mainfrom
t3code/update-usage-pricing-math
Sep 25, 2026
Merged

t3dotgg merged 2 commits into
mainfrom
t3code/update-usage-pricing-math

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Usage estimated Claude fast-mode requests at the standard rate. Fast mode bills at a multiple of standard: 2x for Opus 5.5 ($8/$40 per MTok), Opus 5, and Opus 4.8. So the page showed half the real cost for those requests.

Claude Code writes usage.speed: "fast" on these requests, and LiteLLM publishes the multiple in provider_specific_entry.fast. We read neither.

Fix

  • parseClaudeLine sets fast on the record from usage.speed.
  • parseRateTable reads provider_specific_entry.fast into fastMultiplier (default 1).
  • priceUsage and cacheSavingsUsd take the record and apply the multiplier. Custom prices apply as entered.
  • Scan cache v3 → v4, so cached transcripts re-parse once and pick up the flag.

No contract or UI change.

Scope

I compared our pricing against current ccusage and the live LiteLLM table. Base rates for Fable 5.1 (cache reads $0.25) and Opus 5.5 ($4/$20, cache reads $0.20) are already correct because we fetch LiteLLM live. Fast mode is the only gap that no open PR covers. These are left to open PRs:

Proof: On the real LiteLLM table, a fast Opus 5.5 line prices at $0.28 on main and $0.56 on this branch, which matches $8/$40. vp test run apps/server/src/usage/ passes (87 tests). Server tsc --noEmit, lint, and fmt pass.

Made by Claude Opus 5.5 (1M context) in Claude Code, running in T3 Code.

🤖 Generated with Claude Code

Closes #6306

Claude Code records `usage.speed: "fast"` on fast-mode requests, and
LiteLLM publishes the fast multiple in `provider_specific_entry.fast`
(2x for Opus 5.5, Opus 5, and Opus 4.8). Usage ignored both, so fast
requests were estimated at the standard rate.

Records now carry `fast`, rates carry `fastMultiplier`, and cost and
cache savings apply it. Custom prices stay as entered. The scan cache
moves to v4 so cached files re-parse once and pick up the flag.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 25, 2026
Comment thread apps/server/src/usage/usageScanCache.ts
@macroscopeapp

macroscopeapp Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This production usage-metering change alters the calculated cost and cache-savings values for existing Claude fast-mode requests and changes the persisted scan-cache format. The logic is localized and tested, but billing-sensitive behavior requires human review.

You can add or adjust custom eligibility rules. Learn more.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.6 KiB +50 B (+0.4%) 15.1 KiB ✅
Codex Thread snapshot wire 7.0 KiB 7.1 KiB +16 B (+0.2%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.5 KiB 6.5 KiB +34 B (+0.5%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 56.3 KiB 56.3 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 10 10 0 (0.0%) 21 ✅
Claude Total thread wire 13.5 KiB 13.5 KiB −12 B (−0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.1 KiB 7.1 KiB +1 B (+0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.5 KiB 6.4 KiB −13 B (−0.2%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: 408ff8a · PR result: d4ed85c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 114.0 KiB
  • Claude decoded thread snapshot: 114.7 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@t3dotgg
t3dotgg merged commit e3e7cc3 into main Sep 25, 2026
22 of 23 checks passed
@t3dotgg
t3dotgg deleted the t3code/update-usage-pricing-math branch September 25, 2026 07:58
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 25, 2026
## What's Changed
* feat(web): control Android foldables in the Device panel by @juliusmarminge in pingdotgg/t3code#13534
* fix(mcp): preview snapshots fit in the agent's tool output again by @t3dotgg in pingdotgg/t3code#13558
* fix(web): paste after clicking away from the composer lands in it again by @t3dotgg in pingdotgg/t3code#13553
* feat(desktop): keep running threads synced in the background by @t3dotgg in pingdotgg/t3code#13554
* fix(mcp): preview errors tell agents what to do instead by @t3dotgg in pingdotgg/t3code#13559
* feat(web): agents working banner links to the Agents panel by @t3dotgg in pingdotgg/t3code#13572
* fix(web): size the Android fold model from the inner display by @juliusmarminge in pingdotgg/t3code#13574
* fix(clients): a preview app no longer knocks the desktop's own server offline by @t3dotgg in pingdotgg/t3code#13577
* fix(web): keep nested task states out of parent bullets by @dominic-r in pingdotgg/t3code#11477
* feat(release): ship a Linux .deb that updates itself by @t3dotgg in pingdotgg/t3code#13575
* perf(desktop): cache compiled JavaScript between launches by @t3dotgg in pingdotgg/t3code#13501
* fix(dev): one t3.json setup action that works on every OS by @t3dotgg in pingdotgg/t3code#13589
* fix(web): new worktree threads no longer say "checkout" during setup by @t3dotgg in pingdotgg/t3code#13590
* fix(desktop): `t3 app` keeps working after a second desktop app quits by @t3dotgg in pingdotgg/t3code#13585
* fix(usage): price Claude fast-mode requests at the fast rate by @t3dotgg in pingdotgg/t3code#13599
* fix: update OpenAI logo to current brand asset by @aaditagrawal in pingdotgg/t3code#13611
* fix(mobile): render assigned project icons in chat list by @SunkenInTime in pingdotgg/t3code#12810

## New Contributors
* @aaditagrawal made their first contribution in pingdotgg/t3code#13611

**Full Changelog**: pingdotgg/t3code@v0.0.43-nightly.20260925.2237...v0.0.43-nightly.20260925.2251

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.43-nightly.20260925.2251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Usage cost ignores Fast mode pricing

1 participant