Skip to main content
When a request fails, Portrix returns a standard error response body that follows the OpenAI error format. Every error response includes a human-readable message, a machine-readable type string, and a specific code you can use to handle errors programmatically. The HTTP status code tells you the broad category of the failure.

Error Response Format

All error responses have the following JSON structure:

HTTP Status Codes

Error Types

Handling Errors

Use your SDK’s built-in error handling to catch and inspect API errors. The examples below show how to check the HTTP status code and respond accordingly.

Retry Guidance

Not every error is worth retrying. Use the table below to decide whether to retry automatically. For retryable errors, use exponential backoff with jitter to avoid thundering-herd problems. The example below shows a simple implementation:
Python
When you receive a 502 or 503 error, consider also using the x-portrix-fallback header to automatically route the retry to an alternative model. See the Overview for details.