> ## Documentation Index
> Fetch the complete documentation index at: https://www.usenotra.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop sequences

> End writer-0.1's answer at a string of your choice with stop on Chat Completions. Stop sequences apply to the answer only, never to the plan or tool calls.

`stop` takes a string or up to 4 strings. The answer ends right before the first match, which isn't included, and `finish_reason` is `stop`.

```ts theme={"system"}
const completion = await client.chat.completions.create({
  model: "writer-0.1",
  messages: [{ role: "user", content: "Write three changelog entries, separated by ---." }],
  stop: ["---"],
});
```

## How the gateway applies them

* **Only to the answer.** writer-0.1 plans before it writes, and the plan can contain your stop string. The gateway matches stop sequences in the answer only, so the plan never ends the request.
* **Never inside tool calls.** Tool calls are never cut.
* **Streamed too.** When a streamed answer matches, the gateway ends the stream there and stops generation. Usage counts the tokens up to the match.

> [!NOTE]
>
> The Responses API has no stop sequences: it rejects `stop` with 400 `unsupported_parameter`. Use Chat Completions when you need them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.