Skip to content

Today I learned

Why is OpenAI output_text empty with max_output_tokens set?

· updated #AI engineering #Web development

With a reasoning model, max_output_tokens is one budget for the hidden reasoning and the visible answer. Set it to the size of the answer you want (say 300 for a short teaser) and the model can spend all of it thinking: you get status: "incomplete", incomplete_details.reason: "max_output_tokens", and no message item at all, so output_text is an empty string with no error.

Lower the reasoning effort and give the limit room for both:

ts
const res = await openai.responses.create({
  model: 'gpt-5.5',
  instructions,
  input,
  reasoning: { effort: 'low' },
  // reasoning tokens count here too; the answer itself is ~200
  max_output_tokens: 4000,
})

if (res.status === 'incomplete' || !res.output_text.trim())
  throw new Error(`No answer: ${res.incomplete_details?.reason ?? 'empty'}`)

Control the length of the answer in the prompt ("2–4 sentences"), not with the token limit, and treat an empty output_text as a failure so a fallback kicks in.

Hit this while building the Telegram channel announcements for this site: a model writes a short teaser for each new post, and the description is the fallback when it returns nothing.

Docs: Reasoning models, allocating space for reasoning

Share LinkedIn Post on X

Related notes

Newsletter

Occasional notes on engineering, game tech, and new tools — no spam, unsubscribe anytime.

Ravy

Engineering manager, founder, and software developer building web platforms, game systems, real-time services, and automation tools. 15 years of shipped work — currently at Gaijin.net.

Get in Touch

Building an MVP, shipping a game feature, or automating a team workflow? Open source or paid — let's talk.

Contact Me
© 2020-2026 XPLOIT FZE. All trademarks, names and logos belong to their respective copyright holders.