Skip to main content

Error Response Format

All errors follow a consistent format:

HTTP Status Codes

Generation Status Responses

Generation responses include a status field that can be:
  • completed — Generation successful, result available
  • pending — Generation in progress (for async operations)
  • failed — Generation failed due to content policy, provider error, or other issues
For failed status, an error field provides the failure reason:

Common Generation Errors

Generation failures can occur for several reasons:

Model Overloaded (503)

When a model is experiencing high demand:

Generation Timeout

For requests that take too long to process:

Content Policy Violations

When content is blocked by safety filters:

Common Errors

401 — Token expired

Access tokens expire after 15 minutes. Refresh automatically:

402 — Insufficient tokens

Handle it gracefully:

429 — Rate limit exceeded

500 — Provider error

Upstream AI providers occasionally fail. Tokens are never charged on provider errors.

Retry Logic

Handling Generation Failures

Always check the status field in generation responses:

Validation Errors

For 422 errors, the response includes field-level details: