---
title: "What is finish_reason? Why an LLM response stopped | BroadRouter"
description: "finish_reason tells you why a model stopped writing: a natural end, the max_tokens limit, a tool call or a content filter. How to read it before you trust a reply."
url: https://broadrouter.com/glossary/finish-reason/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# finish\_reason

Updated 2026-11-15

finish\_reason is a field on each choice in a chat completion response that says why the model stopped generating. In the OpenAI format the values are stop, length, tool\_calls, content\_filter and the deprecated function\_call. Anthropic's Messages API reports the same idea as stop\_reason.

Also called: finish reason, stop reason, stop\_reason

A reply that looks complete may not be. finish\_reason is the one field that tells you whether the model ended on its own terms.

## How it works

Each item in `choices` carries a `finish_reason`. OpenAI’s reference lists these values:

| Value | Meaning (OpenAI) |
| --- | --- |
| `stop` | Natural stop point, or a provided [stop sequence](https://broadrouter.com/glossary/stop-sequences/) was hit |
| `length` | “The maximum number of tokens specified in the request was reached” |
| `tool_calls` | The model called a tool |
| `content_filter` | “Content was omitted due to a flag from our content filters” |
| `function_call` | Older, deprecated form of a function call |

Anthropic’s Messages API uses `stop_reason` with its own values, including `end_turn`, `max_tokens`, `stop_sequence`, `tool_use`, `pause_turn`, `refusal` and `model_context_window_exceeded`. When a stop sequence fires, Anthropic also returns which one in `stop_sequence`.

```python
choice = r.choices[0]
if choice.finish_reason == "length":
    raise RuntimeError("cut off: raise max_tokens and resend")
if choice.finish_reason == "tool_calls":
    run_tools(choice.message.tool_calls)
```

## Why it matters

-   **Truncated JSON.** A `length` reply is incomplete. Closing the brackets makes it parse but loses data. The [invalid JSON post](https://broadrouter.com/blog/fix-invalid-json-from-llm/) covers this.
-   **Agent loops.** `tool_calls` means “run the tools and call me again”, not “done”.
-   **Caching.** Only cache replies that ended with `stop`. A cut-off answer cached for a week looks like a model bug.

## On BroadNet Inference

BroadNet’s [API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-finish-reason&utm_content=body) does not document finish\_reason values, so log what you get before you rely on them. It does document the main cause of `length` surprises: DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B reason before they answer, and the [reasoning tokens](https://broadrouter.com/glossary/reasoning-tokens/) count toward [max\_tokens](https://broadrouter.com/glossary/max-tokens/). BroadNet says that with a small limit “the reasoning can use the whole budget and the answer comes back empty.” Leave 1,000 tokens or more, or set `reasoning_effort` to `low`. The [empty response guide](https://broadrouter.com/guides/reasoning-tokens-empty-response/) walks through the fix.

## Common mistakes

-   Reading `message.content` without checking finish\_reason first.
-   Treating an empty answer as a model failure when the reasoning used the whole budget.

## Questions

### What does finish\_reason "length" mean?

The reply hit the token limit you set and was cut off. OpenAI describes it as "the maximum number of tokens specified in the request was reached." Raise max\_tokens or ask for less; do not repair the cut-off text.

### Why is finish\_reason "stop" when I set a stop sequence?

In the OpenAI format, stop covers both a natural end and a matched stop sequence. Anthropic separates them into end\_turn and stop\_sequence.

### Does BroadNet document finish\_reason values?

No. BroadNet's API reference does not list finish\_reason values. Log the field on your own requests and test before you branch on it.

## See also

-   [max\_tokens](https://broadrouter.com/glossary/max-tokens/) (term)
-   [Reasoning tokens](https://broadrouter.com/glossary/reasoning-tokens/) (term)
-   [Stop sequences](https://broadrouter.com/glossary/stop-sequences/) (term)
-   [Tool calling](https://broadrouter.com/glossary/tool-calling/) (term)
-   [Chat Completions API](https://broadrouter.com/glossary/chat-completions-api/) (term)
-   [Why a reasoning model returns an empty answer](https://broadrouter.com/guides/reasoning-tokens-empty-response/) (guide)
-   [Stream chat completions and handle dropped connections](https://broadrouter.com/guides/streaming-chat-completions/) (guide)
-   [How to fix invalid JSON from an LLM: causes, repair, retry](https://broadrouter.com/blog/fix-invalid-json-from-llm/) (article)
-   [Setting max\_tokens for reasoning models: a budgeting method](https://broadrouter.com/blog/reasoning-model-max-tokens-budget/) (article)
-   [Cache LLM API responses to cut cost: an exact-match cache in Python](https://broadrouter.com/blog/cache-llm-responses-cut-cost/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-finish-reason&utm_content=page-cta) ·

**Sources**

-   [OpenAI API reference, chat completion object (finish\_reason) (checked 2026-11-15)](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)
-   [Anthropic docs, handling stop reasons (checked 2026-11-15)](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons)
-   [BroadNet Inference API reference, reasoning and max\_tokens (checked 2026-11-15)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-finish-reason&utm_content=sources)
