Conversation
saphid
force-pushed
the
saphid/usage-cache-write-cost
branch
from
September 11, 2026 02:59
6193c64 to
1ff3581
Compare
The composer shows the active thread's estimated API cost with cache-write, cache-read and fresh-token components. The server attributes transcripts to a thread through current and historical provider sessions and dedicated worktrees, and exposes a filtered usage thread breakdown that clients request only when the environment advertises it. Squashed onto current main; adopts the unpriced-model flag from pingdotgg#11021 in the model totals and the usage summary line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
saphid
force-pushed
the
agent/composer-thread-cost
branch
from
September 11, 2026 03:02
b3ff8a9 to
6592812
Compare
When the rate table is unavailable, a thread with tokens reported $0.00. Show "Unpriced" and mark the components unavailable, matching the model rows in the usage page. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
saphid
force-pushed
the
saphid/usage-cache-write-cost
branch
from
September 24, 2026 20:43
1ff3581 to
6bb3648
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The web composer shows the active thread public-list API cost beside the send button. Hovering or clicking opens the cache-write, cache-read, fresh input plus output, and provider-reported breakdown. Sub-cent totals retain useful precision.
The server now keeps the final progressive Claude response snapshot, expands fallback attempts, preserves separate 5-minute and 1-hour cache-write counters, and falls back to the top-level serving model when an iteration omits its own model. The scan-cache version advances so previously cached false-zero Claude records are discarded and rebuilt.
Pricing now honors LiteLLM context-length tiers from each request total input, including the GPT-5.6 Sol tier above 272k tokens. Service tiers such as priority, flex, and batch remain at base public-list rates because local transcripts do not identify them.
Why the displayed value was wrong
The composer arithmetic and formatting were not the cause. The combined accounting parser required every Claude iteration to repeat its model even though real Claude transcripts commonly place the serving model only on the parent message. It therefore dropped billed iterations before thread attribution and handed the UI zeros.
A read-only audit of the affected real session found 857 of 871 usage-bearing lines in that shape. The broken path retained 14 deduplicated records containing zero tokens; the corrected path retains 369 records containing 109,779,332 billed tokens.
A separate pricing audit found 96 cached GPT-5.6 Sol requests above 272k input. Base-only pricing produced $18.953256; the published long-context tier produces $37.390112, a prior understatement of $18.436856.
Stack note
This remains stacked on #9 because that PR adds the cache-write component used by the composer. The current head of #28 still contains the model-less-iteration defect, so this PR carries the corrected accounting rather than depending on that broken head.
Surfaces
Verification
Checklist
Built by gpt-5.6-sol in T3 Code through the Codex harness.