Stop Sequences are a developer's strongest tool for preventing hallucination and managing costs. By defining a list of strings (e.g., ["</json>", "User:"]), you tell the model to instantly stop computing tokens as soon as it predicts those exact characters. This is essential for ensuring a model doesn't continue with unnecessary conversational filler after completing a structured task.
You can steer Claude's starting point by including a final assistant message that is not yet complete. For example, by prefilling the assistant reply with { "analysis": , you force Claude to bypass the common "Sure, here is your analysis" introduction and immediately begin generating valid JSON. This technique significantly improves reliability for automated pipelines.