Skip to content

Why Is the Output Truncated? ​

Output is usually truncated because the maximum output tokens or context window has been reached, the client has display limits, streaming reads were interrupted prematurely, or the upstream model stopped on its own.

Direct Checks ​

  • Check whether max_tokens, max_completion_tokens, or max_output_tokens is set too low.
  • Check whether the input history is too long and is taking up output space.
  • Check whether finish_reason is length.
  • Check whether the client has message length or timeout limits.
  • Check whether the streaming request was disconnected prematurely by a proxy, browser, or server.

Resolution ​

Reduce the historical context, increase the maximum output parameter, or have the model generate the output in segments. For long tasks, split them into multiple steps instead of requesting excessively long content in a single request.