Why did my free LLM API return an empty answer with finish_reason: length?

When a reasoning model returns HTTP 200, an empty visible answer, and a limit-related ending, its generated-token allowance may have been spent on hidden reasoning before any answer text appeared. Check the raw response, the exact provider and model, the output cap, and any documented reasoning-token breakdown before changing settings. OpenAI explicitly documents this behavior for its reasoning API; it is not a universal rule for every OpenAI-compatible free route.

A local diagnostic path from an empty visible answer through the raw completion status and reasoning-token usage to a bounded fix.

First identify which limit signal you actually received

A rendered chat bubble can hide the evidence. Save the response object locally, redact keys and prompts, then read the API status and termination fields together.

Raw response shape What the documentation supports Next check
OpenAI Responses: status: incomplete and incomplete_details.reason: max_output_tokens The response reached its generated-output cap. OpenAI says this can happen before visible text is produced. Read usage.output_tokens_details.reasoning_tokens when present, then compare it with usage.output_tokens and the configured cap.
Chat Completions: finish_reason: length A token or context limit ended generation. This value alone does not say how much of the completion was hidden reasoning. Check the provider's documented completion-usage breakdown. DeepSeek documents completion_tokens_details.reasoning_tokens in its Chat Completions schema.
finish_reason: stop with empty content This is not proof that a token cap was exhausted. A model may stop before producing visible text, a response adapter may lose the upstream status, or JSON mode may transform unrecognized output. Compare the upstream raw response with the adapter result. See the empty Qwen answer guide and the Open WebUI truncation report guide.
No usage breakdown, or an unexplained zero The response does not let you attribute the missing text to reasoning-token use. A gateway may omit or mis-map usage fields. Mark the cause unknown for that route. Do not treat an absent count as zero reasoning.

The general incomplete-output guide already explains the ordinary meaning of length. The extra question here is narrower: can you see whether the hidden reasoning used the same generated-token budget before visible text began?

A documented case, not a compatibility promise

OpenAI says reasoning tokens are generated output tokens, count toward the max_output_tokens limit, and may consume the whole limit before visible output starts. Its API can return status: incomplete with reason max_output_tokens; the response usage object exposes a reasoning-token count.

DeepSeek's Chat Completions reference separately defines max_tokens as the maximum generated completion and documents an optional completion_tokens_details.reasoning_tokens field. That gives a developer a useful route-specific measurement when the upstream returns it. Read the selected provider's current contract: an OpenAI-shaped body does not ensure identical limits or usage details.

Community reports show why this distinction matters in practice, but they are not general provider rules. For example, one Goose report describes reasoning tokens using the completion cap before visible content appeared; a separate FreeToken issue reports a particular adapter returning a zero reasoning count despite a reasoning trace. Treat each as a version- and route-specific report, not an incidence rate.

Work one synthetic budget example

Suppose an API documents a 300-token generated-output cap and its response reports 300 output tokens, of which 300 are reasoning tokens, with no visible text. In that synthetic example, the response has no remaining generated-token room for a visible answer. It is arithmetic for explaining the fields, not a captured provider response or a benchmark.

If the same API reports 220 reasoning tokens out of a 300-token output, the remaining 80 is only a ceiling for visible text. Other generated material and tokenization can still use part of it. Do not apply this subtraction to two fields whose meanings the provider has not documented.

Keep three quantities separate:

  1. The request's output cap, such as max_output_tokens or max_tokens.
  2. The completion usage actually reported by the selected route.
  3. The usage subtype that the provider identifies as reasoning.

A requested cap is not proof that the route honored it. A field called reasoning_tokens is useful only when that provider defines and reports it for the response you are examining.

A local-only diagnostic sequence

  1. Name the route. Record the host, API family, path, model ID, client version, and any gateway or adapter between the client and upstream. A client label such as “OpenAI compatible” is not enough to identify who set the limit.
  2. Preserve the raw result. Keep the HTTP status and full JSON or final stream event. Remove the authorization header, API key, prompt, personal data, and any private request content before sharing a trace.
  3. Read the stopping condition. For Responses, distinguish incomplete plus max_output_tokens from completed. For Chat Completions, record finish_reason. A proxy may convert one response family into another, so compare upstream and client-visible objects when you already have both.
  4. Compare cap and usage fields. Check total completion/output tokens and the documented reasoning subtype. If the subtype is missing, zero without an upstream guarantee, or lost across an adapter, the amount spent on reasoning is unverified.
  5. Choose one documented change. If the response proves the output cap was reached and the provider permits a larger cap within the context limit, raise it only enough to leave room for the answer. If the provider supports a lower reasoning effort and your task allows it, try that documented value. If the provider says the context limit was reached, reduce conversation history instead.
  6. Stop deterministic retries. Repeating the same request with the same cap does not create more room. Record one before-and-after comparison and check the account's free allowance before another live call.

No model request is needed to perform these checks on a response you already captured. A small local fixture can also test that your client displays incomplete, preserves finish_reason, and does not retry an unchanged, limit-ended response. The fixture should use invented values and must not contain a live key or prompt.

Fix the limit only when the evidence points to a limit

A larger cap may increase generated usage or exceed the provider's free allowance. Check the provider's current context length, cap rules, free-tier quota, and any fallback or paid-overage behavior before changing a client default. OpenAI's billing semantics are not a claim about an independent free gateway's pricing.

Lowering reasoning effort can help only when the selected model and exact route document that control. It can also change answer quality. If the request ended because the context window was full, a larger output cap alone may not help; reduce old history or trim the input according to the provider's context rules.

If the raw response instead says stop with empty content, do not diagnose it as a consumed cap without more evidence. If the upstream response was incomplete but the adapter shows stop, investigate the conversion path. If the body contains only spaces under JSON output mode, check whether the provider documents whitespace substitution. These are separate paths with separate fixes.

Questions developers ask

Does an empty reasoning_tokens field prove the model did not reason?

No. First check whether the provider promises that field for this model and API family. Some gateways omit usage detail or translate it incorrectly. Until the upstream contract and response agree, record the reasoning amount as unknown.

Does finish_reason: length prove hidden reasoning used the whole budget?

No. It indicates a limit-ended completion, but alone it does not identify which generated tokens consumed the limit. Read the documented usage fields and check whether the context limit could be responsible.

Should I increase the cap on every empty response?

No. A stop response, a lost upstream status, or JSON-mode whitespace is not fixed by raising a token cap. Follow the status and usage evidence for the exact route.

Sources checked 11 November 2026