BLACK FRIDAYUntil Dec 8 (Tue) 23:59 JSTUntil Dec 8

DocsEmpty or cut-off answers

Empty or cut-off answers (finish_reason is length)

Causes and fixes when Echo Token Station's API returns HTTP 200 but the answer is empty or cut off. When finish_reason is length or stop_reason is max_tokens, the output has reached max_tokens. With models that reason, the reasoning also counts toward max_tokens.

The output reached max_tokens (the upper limit on output tokens) and the answer stopped partway. It is not an error and comes back with HTTP 200, so tell it apart by finish_reason (OpenAI format) or stop_reason (Anthropic format).

Example

200finish_reason is length (OpenAI format), stop_reason is max_tokens (Anthropic format)

This is the response when max_tokens: 5 was set for deepseek-v4.1-flash, a model that reasons (thinks before answering). All 5 tokens were used for reasoning, and the body of the answer is empty.

OpenAI format (/v1/chat/completions). content is empty, and reasoning_tokens in completion_tokens_details is 5:

JSON
{"choices":[{"finish_reason":"length","index":0,"message":{"content":"","reasoning_content":"We need answer in Japanese","role":"assistant"}}],"created":1795432196,"id":"279a8bbf-10e6-4280-a901-8c4590e33288","model":"deepseek-v4.1-flash","object":"chat.completion","usage":{"prompt_tokens":41,"completion_tokens":5,"total_tokens":46,"prompt_tokens_details":{"cached_tokens":0},"completion_tokens_details":{"reasoning_tokens":5}}}

Anthropic format (/v1/messages). content holds only reasoning (thinking). We recorded only the beginning of the response (up to the middle of usage):

JSON
{"id":"69a3c691-38ce-4111-9286-08645fddc0dc","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"We need answer in Japanese"}],"stop_reason":"max_tokens","model":"deepseek-v4.1-flash","usage":{"input_tokens":41,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":5,"claude_cache_creation_5_m_tokens":0,"claude_cache_creation_1_h_tokens":0,"billing_usage":{"source":"oai_chat","semantic":"openai","openai_usage":{"prompt_tokens":41,"completion_tokens"

Common causes

  1. max_tokens is small: a long answer stops when it reaches the limit
  2. With a model that reasons, the reasoning used up max_tokens: reasoning also counts toward max_tokens. In the example above, all 5 tokens went to reasoning and the body is empty
  3. You call a Claude model in the OpenAI format (/v1/chat/completions) without max_tokens: in this case the answer stops at 8,192 tokens

How to fix

  1. Check whether the whole answer arrived. If finish_reason is length or stop_reason is max_tokens, it stopped at the limit. In the OpenAI format, finish_reason is stop when the whole answer arrived
  2. Increase max_tokens. With models that reason, leave room for the reasoning too. The upper limit is the maximum output tokens on the model page
bash
curl "https://token.echohub.io/v1/chat/completions" \
  -H "Authorization: Bearer $ECHO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-fable-5-1",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "What is the capital of Japan?"}
    ]
  }'
  1. If you set max_tokens too high, the estimated price can exceed your balance and you get 403 (403 insufficient_quota)

If a stream stops without finish_reason or stop_reason, it did not stop at the limit; it stopped because of an error from the upstream API or a cut connection ("When streaming stops partway" in Errors and fixes).

  • API reference: parameters such as max_tokens, and what changes when the format is converted
  • Errors and fixes: how to tell when streaming stopped partway