HTTP Errors
Our API follows a predictable HTTP error code format to help you handle issues programmatically.
Error Structure
Errors are always returned as JSON, with a top-level error object that includes a type and message. The response will also include a request_id for easier tracking and debugging.
Example Error Response:
Request ID
Every API response, whether successful or not, includes a unique X-Request-Id header. This ID is crucial for debugging. When contacting support about a specific request, please include this ID to help us resolve your issue quickly.
Example Header:
Handling Long Requests
For requests that may take a significant amount of time to process (e.g., generating a very long text or a high-resolution image), we highly recommend using streaming.
- Streaming Endpoints: Endpoints like
/v1/chat/completions and /v1/responses support a stream: true parameter.
- Benefits: Streaming provides a much better user experience by delivering the response piece by piece, and it helps avoid timeouts that can occur on some networks for long-running, non-streaming connections.
Last modified on November 11, 2025