x-request-id header. For code that retries and recovers, see Handle errors.
Error bodies
Each body holds a code you can branch on. The codes stay the same between releases; the messages may be reworded.- OpenAI
- Anthropic
- Gemini
The refusal code is in
type and error.type. error.code holds the refusal code or, for an error without one, a broader code from the status (see Broad codes).Refusal codes
Keys and access
Organization and AI system
Models, providers and tools
Budgets and limits
See Budgets and rate limits.
Guardrails
A guardrail error names the guardrails that fired, never your text, and says whose guardrails they were: “this AI system” or “this organization”. Fallbacks are not tried after a guardrail refusal.
When a guardrail would have to change the structured arguments of a tool call, the request or reply is stopped instead, because those cannot be masked safely. See Guardrails at runtime.
Prompts
When Altrum cannot decide
Retry these with backoff, and quote the request reference to support if they continue.
Broad codes
An error without a refusal code of its own, such as one from your model provider, gets a broad code from its status inerror.code on the OpenAI routes:
An error from your model provider keeps the provider’s message, so it reads as it would without Altrum.