OpenAI o-Series Reasoning Tokens Exhausted — Fix (2026) | AI Error Hub
OpenAIo-SeriesSeverity: Highfinish_reason=length

OpenAI o-Series Reasoning Tokens Exhausted

Your o1/o3 response has empty content and finish_reason: "length". Reasoning burned through max_completion_tokens before producing visible output. Increase the budget, reduce reasoning_effort, or switch to GPT-5 if you don't need deep reasoning.

Error surface: Empty response, finish_reason=lengthCategory: o-SeriesDiagnostic: usage.completion_tokens_details.reasoning_tokensLast tested: Nov 15, 2026
Quick Fix (TL;DR)

Reasoning tokens count against max_completion_tokens BEFORE visible output. If reasoning uses 25K tokens and your cap is 25K, output is empty. Set generous cap: complex tasks use 10K–50K reasoning + your desired output. Start with max_completion_tokens: 32000 for o3, monitor actual usage, tune down.

The Symptoms You're Seeing

Empty output pattern
response = client.chat.completions.create(
    model="o3",
    max_completion_tokens=4096,
    messages=[...]
)

response.choices[0].message.content = ""
response.choices[0].finish_reason = "length"
response.usage:
  prompt_tokens: 1200
  completion_tokens: 4096
  completion_tokens_details:
    reasoning_tokens: 4096  ← ALL budget used on reasoning
    accepted_prediction_tokens: 0
    rejected_prediction_tokens: 0
  total_tokens: 5296

You paid for 4096 output tokens and got nothing visible.

How max_completion_tokens Works

Total = reasoning + visible output

max_completion_tokens is the total cap on everything the model generates after your prompt — reasoning tokens (hidden) AND visible content tokens combined. If reasoning uses the full budget, no visible output is possible. Solve by budgeting explicitly: total_needed = expected_reasoning + desired_output.

Reasoning Token Budget Guide

Task complexityTypical reasoning tokensRecommended max_completion_tokens
Simple Q&A500–20004,000
Code debugging3,000–10,00016,000
Math problem5,000–20,00025,000
Multi-step analysis10,000–30,00040,000
Proof derivation20,000–50,000+65,000
o3 with reasoning_effort=high2–3× mediumMultiply above by 2–3

What Actually Causes This Error

45%
Reused GPT-4o max_tokens value (4096)4K works fine on GPT-4o; too small when o-series reasoning uses it all.
22%
reasoning_effort=high on complex tasksHigh effort multiplies reasoning tokens 2-3×.
15%
Prompt implies extensive thinking"Think step by step through every case" triggers deep reasoning.
10%
Complex multi-turn contextLong history requires more reasoning to synthesize.
8%
Not tracking reasoning_tokens metricTeam unaware of hidden cost until visible output fails.

Fixes That Work (Tested Nov 2026)

1Set Generous max_completion_tokens

Python · o-series with proper budget
from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="o3", max_completion_tokens=32000, # room for reasoning + output reasoning_effort="medium", # low/medium/high messages=[ {"role": "developer", "content": "You are a math tutor."}, {"role": "user", "content": "Prove sqrt(2) is irrational."} ] ) # Inspect actual usage u = response.usage print(f"Reasoning: {u.completion_tokens_details.reasoning_tokens}") print(f"Visible: {u.completion_tokens - u.completion_tokens_details.reasoning_tokens}") print(f"Total out: {u.completion_tokens}") print(f"Budget: {32000}") # If completion_tokens near budget = you got lucky, bump it up # If completion_tokens << budget = you can lower for cost savings

2Adaptive Budget Based on Task

Python · task-aware budgeting
def o_series_config(task_type): configs = { "simple_qa": {"budget": 4000, "effort": "low"}, "code_debug": {"budget": 16000, "effort": "medium"}, "math": {"budget": 25000, "effort": "medium"}, "analysis": {"budget": 40000, "effort": "medium"}, "proof": {"budget": 65000, "effort": "high"}, } return configs.get(task_type, configs["analysis"]) cfg = o_series_config("math") response = client.chat.completions.create( model="o3", max_completion_tokens=cfg["budget"], reasoning_effort=cfg["effort"], messages=messages ) # Verify output not empty if response.choices[0].finish_reason == "length": raise Exception("Reasoning budget exceeded; retry with higher budget")

3Consider GPT-5 for Non-Reasoning Tasks

Python · route by need for reasoning
def choose_model(task_type): # o-series shines: proofs, complex math, multi-step logic if task_type in ["proof", "complex_math", "deep_analysis"]: return "o3" # GPT-5 handles most other tasks better + cheaper # No hidden reasoning tokens; predictable cost return "gpt-5" # Cost comparison (per M tokens, Nov 2026): # o3: input $15, output $60 (includes reasoning) # o3-mini: input $3, output $12 # gpt-5: input $10, output $40 # gpt-5-mini: input $2, output $8 # # For non-reasoning tasks, GPT-5 is cheaper AND more predictable
GPT-5 vs o3 decision

Rule of thumb: if the task involves multi-step logic where showing work matters, or complex problem-solving where the model needs to explore approaches, use o-series. For extraction, summarization, chat, RAG answers, function calls — GPT-5 is faster, cheaper, and equally reliable.

Preventing This Error Going Forward

  • Never set max_completion_tokens < 4096 on o-series. Minimum viable budget.
  • Log reasoning_tokens on every response. Learn your real budget needs.
  • Alert when reasoning_tokens > 80% of budget. Near-miss for empty output.
  • Match reasoning_effort to task complexity. Don't default to high.
  • Consider GPT-5 as default; escalate to o-series. Reasoning is a specialty.
SK
Tested by Sana K.
Researcher · AI Error Hub
Last verified: Nov 15, 2026 · SDK: openai 1.54

Frequently Asked Questions

No — reasoning tokens are hidden. You see the token count in usage.completion_tokens_details.reasoning_tokens but not the content. Anthropic's Claude exposes thinking; OpenAI does not.

Yes on the request that generated them. In subsequent turns, the reasoning is discarded — only the visible content persists. So reasoning doesn't grow your context indefinitely.

max_tokens is legacy (GPT-4 and earlier); caps visible output only. max_completion_tokens covers reasoning + output for o-series. On o-series, use max_completion_tokens; on GPT-5/4o, either works but max_completion_tokens is preferred.

Rare but possible if budget is very tight. "low" uses fewer reasoning tokens (500-3000 typical) so 4096 budget usually works. When in doubt, still set 8K+.

Yes — detect finish_reason == "length" AND empty content, then retry with 2× budget. Cap retries at 2 to prevent runaway cost. Log outcome for budget tuning.