Skip to main content
Sign in

Website navigation

Errors & refusalsModel refusals

Detecting Model Refusals

A model can decline to generate content and still return HTTP 200. Inspect the output, stop reason or terminal stream event.

On this page

Detect refusals by protocol

EndpointWhat to inspect
Chat CompletionsInspect choices[].finish_reason, message content and any refusal fields. content_filter is one possible finish reason.
ResponsesInspect output messages for refusal blocks and check status and incomplete_details.
MessagesInspect stop_reason, which may be refusal, and any notice in content. For a stream, read the stop reason from message_delta.

Report the result to your user

Show any refusal message and ask the user to revise their input in line with the content rules. For empty text, check the stop reason, tool calls and disconnects.