Skip to content

fix: normalize cached and reasoning usage details#28

Open
NeuralEmpowerment wants to merge 1 commit into
langfuse:mainfrom
NeuralEmpowerment:fix/normalize-langfuse-usage-buckets
Open

fix: normalize cached and reasoning usage details#28
NeuralEmpowerment wants to merge 1 commit into
langfuse:mainfrom
NeuralEmpowerment:fix/normalize-langfuse-usage-buckets

Conversation

@NeuralEmpowerment

Copy link
Copy Markdown

Summary

  • make Codex input/output usage exclusive of cached and reasoning subsets
  • emit cache_read_input_tokens and output_reasoning_tokens using LangFuse-compatible price keys
  • add regression coverage for both bucket types

Why

Codex reports cached input and reasoning output as subsets of input/output. LangFuse treats usage details as additive buckets, so sending inclusive values double-counts cacheable input and makes custom model cost inference incorrect.

Closes #22.

Validation

  • corepack pnpm@9.5.0 test (35 passing)
  • corepack pnpm@9.5.0 lint

Real trace reproduction is documented in #22.

@CLAassistant

CLAassistant commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex cached input is double counted in Langfuse usage/cost

2 participants