Skip to content

fix: normalize cached and reasoning usage details - #28

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

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
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Axpz

Axpz commented Jul 23, 2026

Copy link
Copy Markdown

Hi, any idea when this PR will be merged?

@hassiebp

Copy link
Copy Markdown
Collaborator

Thanks for raising this. This has already been fixed on main.

@hassiebp hassiebp closed this Sep 22, 2026
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

4 participants