Bill OpenAI reasoning tokens as output#195
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefactors Piebald token billing semantics to count OpenAI reasoning tokens in billed output, reuse the semantic check in input normalization, wire the new output value into cost calculation, and update pricing tests. ChangesBillable Output Token Semantics
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
OpenAI-style model pricing bills reasoning tokens at the output-token rate even though Splitrail displays reasoning tokens separately from output tokens. Add a dedicated billable-output calculation so OpenAI models include reasoning tokens in cost calculation while Anthropic output pricing remains unchanged. Cover the behavior with focused Piebald analyzer tests for OpenAI and Anthropic model semantics.
1c18ee0 to
8c20181
Compare
Why
Piebald usage rows can include reasoning tokens alongside output tokens. Splitrail already displays those fields separately, but OpenAI-style model pricing needs reasoning tokens to be billed at the output-token rate. Without that, rows with OpenAI reasoning tokens underreport cost while keeping the token columns otherwise correct.
For example, the same 6/24/2026 row moves from
$348.92before this fix to$360.77after reasoning tokens are included in billable output:What changed
output_tokensandreasoning_tokensvalues so the stats table still reports those columns separately.Validation
cargo test --quiet piebald- 16 passedcargo build --quiet- passedcargo test --quiet- 370 passed; 1 failed:models::tests::repeated_tiered_model_lookups_reuse_the_same_tier_storagecargo test --quiet models::tests::repeated_tiered_model_lookups_reuse_the_same_tier_storage- passed on focused reruncargo clippy --quiet -- -D warnings- passedcargo doc --quiet- passedcargo fmt --all --quiet- passed with a clean worktree afterwardVisual proof is not applicable for this non-visual analyzer pricing change; I reviewed the code path and validated it with focused analyzer tests plus the repository Rust checks above.
Summary by CodeRabbit