gpt-oss-120b reasoning token count
#230
by
mfranzoni - opened
Hi everyone,
I have deployed gpt-oss-120b with NIM and I wanted to see the tokens that get spent for the reasoning. The usage section of the answer doesn't give a direct answer:
"usage": {
"completion_tokens": 1056,
"prompt_tokens": 103,
"total_tokens": 1159,
"completion_tokens_details": null,
"prompt_tokens_details": null
}
Even after using this to include reasoning:
response = client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[{"role": "user", "content": prompt}],
extra_body={
"include_reasoning": True,
"reasoning_effort": "high"
}
)
I get the whole reasoning process and I can count the words it contains to approximate the reasoning tokens, but it seems very weird to me that there is not a more straightforward way to do this.
I cannot use the NIM_ENABLE_BUDGET_CONTROL variable because, as you can see from the full output, thereasoning_content it's not delimited by a specific string (in other model is something like "")
Is someone able to point me in the right direction?
FULL OUTPUT:
{
"id": "chatcmpl-94d7637491f54348b232ab12dcdfa597",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "**Step\u2011by\u2011step reasoning**\n\n1. **Identify the people we know** \n - Sally is a girl. \n - She has **3 brothers**. \n\n2. **Turn the \u201ceach brother has 2 sisters\u201d statement into a numeric condition** \n - Let the total number of *female* siblings in the family be **\\(S\\)**. \n - For any brother, the sisters he sees are exactly the girls in the family, i.e. the sisters. \n\n The problem tells us that **each brother has exactly 2 sisters**, so \n\n \\[\n S = 2\n \\]\n\n3. **Interpret what means for Sally** \n - There are **2 sisters total** in the household. \n - One of those sisters is **Sally herself** (she is a sister to each brother). \n\n4. **Find how many *other* sisters Sally has** \n - Total sisters = 2 \n - Subtract Sally (the one we already know) \n\n \\[\n \\text{Other sisters} = 2 - 1 = 1\n \\]\n\n5. **Answer the question** \n The question asks, *\u201cHow many sisters does Sally have?\u201d* \n - That means \u201chow many sisters **besides herself** does she have?\u201d \n\n So **Sally has **1** sister.**\n\n---\n\n### Quick sanity check\n\nIf we list the siblings:\n\n| Name | Gender | Relation to each brother |\n|--------|--------|---------------------------|\n| Sally | Female | Sister |\n| Alice | Female | Sister |\n| Brother\u202f1 | Male | Brother |\n| Brother\u202f2 | Male | Brother |\n| Brother\u202f3 | Male | Brother |\n\n- Each brother sees **Sally + Alice** \u2192 2 sisters. \n- Sally herself sees **Alice** as her only sister.\n\nEverything fits, confirming the answer. \n\n**Answer:** **1** sister.",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": [],
"reasoning_content": "We need to parse the problem: Sally has 3 brothers. Each of her brothers has 2 sisters. How many sisters does Sally have? Provide walk-through logic.\n\nTime for reasoning: The problem description: Sally (a female individual) has 3 brothers. There are other siblings possibly (not specified). Each brother has 2 sisters. The key is to find the total number of sisters that Sally has. The \"sisters\" includes her and maybe other sisters. So if each brother sees exactly 2 sisters, then there are exactly 2 females (sisters) in the sibling set, including Sally.\n\nBut we need to verify that Sally herself is a sister: Sally is a sister to each brother. The brothers have two sisters; one is Sally. That leaves one other sister besides Sally. So Sally has one sister besides herself. The question: \"How many sisters does Sally have?\" Usually the answer excludes counting herself as a sister (i.e., \"How many sisters does Sally have?\" means how many other sisters does she have). So answer is 1.\n\nLet's walk through step-by-step:\n\nSally's brothers = 3.\n\nEach brother has 2 sisters.\n\nSince all the brothers share the same siblings, this means the total number of sisters is 2 (no matter how many brothers). These two sisters are the same for each brother.\n\nAlready we know Sally is one of those sisters. So there must be one more sister in the family besides Sally.\n\nThus, Sally has 1 sister.\n\nBe careful about logical confusion: If each brother had 2 sisters, we can't say there are total 2 per brother \u00d7 3 brothers = 6 sisters (since they'd be counting each sister multiple times). So careful.\n\nThus answer: 1.\n\nNow we can present a step-by-step reasoning:\n\n1. Create variables: let the number of sisters = S.\n\n2. Sally is a female, so she is among the sisters. So S >= 1, and S = 1 + (other sisters).\n\n3. For each brother, the number of sisters equals S. The condition says each brother has exactly 2 sisters. So S = 2.\n\n4. Hence total sisters = 2.\n\n5. Since Sally is one of them, the other sister count = 2 - 1 = 1.\n\nThus Sally has one sister.\n\nWill mention alternative approach: using Venn, families.\n\nPotential alternative interpretation: Some puzzles might interpret that Sally might be counting herself as a sister as well, and answer could be 2. But typical answer is 1. Provide that nuance.\n\nNow, we should provide a walk-through step-by-step logic.\n\nWe'll maybe discuss scenario testing: Check if any other scenario fits: Let's think about if the brothers are half-siblings, different mothers? But the problem simplicity implies they\u2019re all siblings.\n\nThus answer 1.\n\nWill also address that the wives or step-siblings might confound but not needed.\n\nThus final answer: Sally has one sister.\n\nNow produce final answer accordingly, with stepwise logic."
},
"stop_reason": null,
"token_ids": null
}
],
"created": 1771610001,
"model": "openai/gpt-oss-120b",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": null,
"usage": {
"completion_tokens": 1056,
"prompt_tokens": 103,
"total_tokens": 1159,
"completion_tokens_details": null,
"prompt_tokens_details": null
},
"prompt_logprobs": null,
"prompt_token_ids": null,
"kv_transfer_params": null
}