AI Development
Custom strings that tell a model to stop generating as soon as it produces one of them.
Custom strings that tell a model to stop generating as soon as it produces one of them. In the Claude Messages API you pass them as stop_sequences, and when one matches, the response comes back with stop_reason set to "stop_sequence" and the matched string in the stop_sequence field. They let you cut output at a known delimiter, such as a closing XML tag, without paying for tokens you would throw away. Some compatible endpoints ignore the parameter, so check before relying on it.
Primary source: platform.claude.com
Example
They let you cut output at a known delimiter, such as a closing XML tag, without paying for tokens you would throw away.
Hands-on guides, comparisons, and tutorials that cover AI Development.
FAQ
Custom strings that tell a model to stop generating as soon as it produces one of them.
Stop Sequences sits in the AI Development part of the AI stack. Understanding it helps you make better decisions when building, debugging, and shipping AI features.
Developers Digest publishes tutorials and videos that cover AI Development topics including Stop Sequences. Check the blog and YouTube channel for hands-on walkthroughs.
Related
The request parameter that sets a hard ceiling on how many tokens a model may generate in one response.
A model card is a short document published with a trained machine learning model that explains its intended uses, its limitations, and how it performs across different conditions and groups.
Reserved tokens that mark structure rather than text, such as beginning-of-sequence (BOS), end-of-sequence (EOS), padding, and BERT-style [CLS] and [SEP] markers.

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.