Skip to content

$ llm codec: cache-write and Cohere cached tokens bill at the input tier, as in 1.5.5 - #843

Draft
MattJackson wants to merge 1 commit into
predevfrom
lane-llm-billing-classes
Draft

MattJackson wants to merge 1 commit into
predevfrom
lane-llm-billing-classes

Conversation

@MattJackson

Copy link
Copy Markdown
Collaborator

What. The OpenAI Chat and Responses readers moved prompt_tokens_details.cache_write_tokens / input_tokens_details.cache_write_tokens out of the input total onto the cache-write tier, and the Cohere reader moved usage.cached_tokens onto the cache-read tier. This restores 1.5.5: both stay inside the input count and bill at the input tier.

Why. Row-159 audit, plane-llm L3#2 (HIGH) and L2#4 (HIGH). 1.5.5 never split these: v1.5.5 crates/busbar/src/proto/openai_chat/reader.rs:693 (stream) and :966 (buffered), crates/busbar/src/proto/openai_responses/reader.rs:1022 and :1341, crates/busbar/src/proto/cohere/reader.rs:709-729 and :964-979 each set the split tier to None. Nothing signs the move. BUSBAR-1.6.0.md THE LLM DIALECT FIDELITY RULE says "Billing never moves". §7 Money and #77 say the money path stays 1.5.5's unless the owner signs a change, and #81 signs only fractional counts. CHANGELOG 1.6.0 Upgrade says "The token classes, their figures and every tokens: cap count exactly what 1.5.5 counted". LEDGER-100 is about adding units that were never ledgered. It does not cover these, because 1.5.5 already ledgered them, as input.

RED-able tests (the expected figures come from the 1.5.5 lines above):

  • openai_chat/tests/unreadable_count_refusal_tests.rs::cache_write_tokens_bill_inside_the_input_on_every_path and openai_responses/...::cache_write_tokens_bill_inside_the_input_on_every_path: prompt 100, cache write 40 (also as "40"), output 9 ledgers input 100, output 9, no cache write, on the buffered, stream and truncated paths. Before this change: input 60 / cache write 40, and the string spelling was refused.
  • The usage_census_tests for Chat and Responses class cache_write_tokens as a slice of the input. In the Cohere census, cached_tokens moves nothing.
  • codec/tests/cache_tier_capture_tests.rs: the three dialects' capture tests, rewritten against the recorded bodies to pin the 1.5.5 tiers.

No ledger, oracle cell or ceiling changes. The oracle mock reports cache-write 0 and no Cohere cached_tokens, so no recorded cell moves.

…ier, as in 1.5.5

The Chat and Responses readers split `cache_write_tokens` out of the input total onto the
cache-write tier, and the Cohere reader split `cached_tokens` onto the cache-read tier. 1.5.5
billed both inside the input count (v1.5.5 crates/busbar/src/proto/openai_chat/reader.rs:693,
:966; openai_responses/reader.rs:1022, :1341; cohere/reader.rs:709-729, :964-979 each set the
split tier None). No owner ruling signs the move: the fidelity rule says "Billing never moves" and
the 1.6.0 CHANGELOG says the token classes count exactly what 1.5.5 counted. The usage tables lose
the split rows; the census, refusal and capture tests now pin 1.5.5's figures (RED before: input
60 / cache write 40 where 1.5.5 billed input 100).
@MattJackson

Copy link
Copy Markdown
Collaborator Author

row 155 B2 (#974) edits crates/busbar-plane-llm/src/codec/{cohere,openai_chat,openai_responses}/mod.rs at fn claims and the DECL quota_exceeded_status / auth_failure_status_and_kind rows; disjoint from this PR's hunks.

@MattJackson
MattJackson marked this pull request as draft October 14, 2026 19:51
@MattJackson MattJackson added the alone ModernCI: judge and land alone (never batched) label Oct 14, 2026
@MattJackson
MattJackson marked this pull request as ready for review October 14, 2026 20:22
@MattJackson
MattJackson marked this pull request as draft October 14, 2026 22:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alone ModernCI: judge and land alone (never batched)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant