Read thoughtsTokenCount even when Gemini thinking text is absent

For CometAPI Gemini reasoning-usage telemetry, use the documented thoughtsTokenCount field in response metadata rather than inferring reasoning usage from visible output text.

On CometAPI’s documented Gemini native generation route, usageMetadata includes thoughtsTokenCount. The documentation describes this field as the number of tokens used for internal reasoning, including cases where thinking output is not included in the response. The same object also contains promptTokenCount, candidatesTokenCount, and totalTokenCount.

That makes thoughtsTokenCount the relevant counter for a usage report: visible candidates[].content.parts[].text tells you what was returned, not how much internal reasoning was performed. Keep the fields separate in telemetry, and avoid substituting output-text inspection for the documented counter.

This is a response-contract detail from CometAPI’s documentation, not a claim about a live call or a pricing formula. If cost accounting is the next step, join this counter with the pricing rules that apply to your account and model rather than assigning a price from the example response alone.

Source: CometAPI Gemini native generation documentation.