refusal_from_status_error#

Connect a provider and configure retries, credentials, and transport. See the guide.

zett_agent.providers.stop_reasons.refusal_from_status_error(status_code, body)[源代码]#

Return the refusal an HTTP error response describes, or None when it is something else.

Recognized, and only these:

  • 400 with type or code content_filter (Kimi: "considered high risk").

  • 403 with metadata.reasons (an OpenRouter moderation flag) or metadata.patterns (an OpenRouter guardrail). A budget or permission 403 has other metadata and stays an error.

参数:
  • status_code (int) -- The HTTP status.

  • body (object) -- The error object of the response body, as the SDK exposes it.

返回类型:

StopInfo | None