stop takes a string or up to strings. The answer ends right before the first match, which isn’t included, and finish_reason is 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.
The Responses API has no stop sequences: it rejects
stop with 400 unsupported_parameter. Use Chat Completions when you need them.