Skip to main content
Message responses distinguish the model’s stop_reason from the overall interaction_stop_reason and error details. Check each field when deciding whether to continue, run a tool, or retry. For details about stop_reason in the response schema, see Messages.

What is stop_reason?

stop_reason explains how model generation ended. It is nullable and may be omitted; it is not an error type. Example response (truncated):

Stop reason values

Only the six model-generation values below are stop_reason values.

Interaction outcomes

interaction_stop_reason is nullable and describes the overall interaction: stop, error, cancelled, or refusal. It is separate from the model stop reason. Optional stop_details contains required type, optional category, and optional explanation; use these details when explaining an outcome to the user.

Errors

Failures before generation may return an HTTP error envelope. During streaming, handle error events; completed message objects may also include an errors array. Error types below are not valid stop_reason values. Do not retry refusals or cancellations as transient server errors.