Errors and rules / Model refusals

Errors and rules

Model refusals

What a response looks like when a model refuses on content-policy grounds or a request is blocked by moderation, how it is billed, and what to do next.

Updated

A model refusing on content-policy grounds and a request blocked by content moderation both count as a violation: tokens already used are billed as usual, plus a content violation fee. Your code can detect refusals with the markers below, so it doesn't resend the same request over and over.

Refusal markers

A refusal still returns HTTP 200 with a normal response format, but carries one of these markers:

Endpoint Non-streaming Streaming
Messages stop_reason is refusal delta.stop_reason is refusal in the final message_delta event
Chat Completions choices[].finish_reason is content_filter, with the reason in message.refusal finish_reason is content_filter, with the reason in delta.refusal
Responses A content block in output has "type": "refusal" response.refusal.delta and response.refusal.done events appear

Anything the model generated before refusing isn't withdrawn; it is returned to you as usual.

An example from the Messages endpoint:

json
{
  "type": "message",
  "role": "assistant",
  "content": [{"type": "text", "text": "..."}],
  "stop_reason": "refusal"
}

Blocked by content moderation

Some requests are blocked by content moderation before the model answers or while output is streaming. These return a 4xx error, and the message usually contains:

  • SensitiveContentDetected (for example InputTextSensitiveContentDetected)
  • cyber_policy
  • Output blocked by content filtering policy

These also count as a violation.

Billing

  • Tokens already used are billed at the normal price.
  • A content violation fee is charged on top, deducted from your balance at the actual amount incurred: usually $0.10 per violation, and $0.20 in some cases.
  • The fee appears as its own entry on the Usage Logs page of the console, labeled 「内容违规费」 (content violation fee).
  • If your balance is too low, it can go negative; see Billing.

Ordinary failures — rate limits, low balance, network drops, timeouts, invalid parameters — never incur a content violation fee.

What to do after a refusal

  1. Don't resend it unchanged. A refused request resent unchanged within 24 hours returns 403 request_blocked immediately. It isn't charged and isn't sent to the model.
  2. Change the request and try again, for example by removing the part likely to trigger the content policy.
  3. Several violations on the same model in a short time lead to escalating restrictions; see Violations and restrictions.