Skip to content

google-genai: include thinking tokens in output token count#4206

Draft
Rima-ag wants to merge 4 commits intoopen-telemetry:mainfrom
Rima-ag:thoughts-tokens
Draft

google-genai: include thinking tokens in output token count#4206
Rima-ag wants to merge 4 commits intoopen-telemetry:mainfrom
Rima-ag:thoughts-tokens

Conversation

@Rima-ag
Copy link

@Rima-ag Rima-ag commented Feb 14, 2026

Description

Updates the Google GenAI instrumentation to include thinking tokens in the total output token count.

Previously only candidate tokens were counted in the output_tokens, resulting in inaccurate cost estimations for models that produce separate thinking tokens.

Thinking tokens are reported in GenerateContentResponseUsageMetadata.thoughts_token_count.

Fixes #3890

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 14, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@Rima-ag Rima-ag changed the title Thoughts tokens Include thinking tokens in output tokens Feb 14, 2026
@Rima-ag Rima-ag changed the title Include thinking tokens in output tokens Fix: include thinking tokens in Google GenAI output token count Feb 14, 2026
@Rima-ag Rima-ag changed the title Fix: include thinking tokens in Google GenAI output token count google-genai: include thinking tokens in output token count Feb 14, 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.

Google GenAI instrumentation needs to count thinking tokens

6 participants

Comments