⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@eavanvalkenburg
Copy link

@eavanvalkenburg eavanvalkenburg commented Dec 16, 2025

Fixes #3194

Changes

Adds reasoning tokens as a attribute to the gen_ai.usage field.

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 16, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: eavanvalkenburg / name: Eduard van Valkenburg (7fdf8bc, fb16d48)

@github-actions github-actions bot added enhancement New feature or request area:gen-ai labels Dec 16, 2025
- id: gen_ai.usage.reasoning_tokens
stability: development
type: int
brief: The number of tokens used in the GenAI reasoning or thinking.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably explicit if the reasoning tokens are included in gen_ai.usage.output_tokens or not.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great point, updated to reflect this.

| [`gen_ai.request.choice.count`](/docs/registry/attributes/gen-ai.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Conditionally Required` if available, in the request, and !=1 | int | The target number of candidate completions to return. | `3` |
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Conditionally Required` If available. | string | The name of the GenAI model a request is being made to. [7] | `gpt-4` |
| [`gen_ai.request.seed`](/docs/registry/attributes/gen-ai.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Conditionally Required` if applicable and if the request includes a seed | int | Requests with same seed value more likely to return same result. | `100` |
| [`gen_ai.usage.reasoning_tokens`](/docs/registry/attributes/gen-ai.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Conditionally Required` when available | int | The number of tokens used in the GenAI reasoning or thinking, only set this if the GenAI model provides a separate count for reasoning tokens and they are not also included in input or output tokens. | `180` |
Copy link

@stephentoub stephentoub Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would reasoning tokens only be set if not included in output count? I think it'd be better to just state whether they're counted as part of output or not (ideally yes, so that output is consistent regardless of whether reasoning tokens are separated out by a provider), and then an implementation can do the math to ensure the values match the convention based on whether the provider includes reasoning in the output it reports.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, they should be a subset of output tokens.

@lmolkova lmolkova moved this from Untriaged to Awaiting codeowners approval in Semantic Conventions Triage Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gen-ai enhancement New feature or request

Projects

Status: Awaiting codeowners approval

Development

Successfully merging this pull request may close these issues.

Add usage.reasoning_tokens to span attributes

4 participants