Error Response Format
When an error occurs, the gateway returns a JSON response with error details:HTTP Status Codes
The gateway uses standard HTTP status codes:2xx Success
OK
Request succeeded
Created
Resource created successfully
4xx Client Errors
Bad Request
Invalid request format or parameters
Unauthorized
Invalid or missing authentication credentials
Forbidden
Valid credentials but insufficient permissions
Not Found
Requested resource does not exist
Unprocessable Entity
Request format is valid but contains semantic errors
Too Many Requests
Rate limit exceeded
5xx Server Errors
Internal Server Error
Unexpected server error
Bad Gateway
Error from upstream provider
Service Unavailable
Service temporarily unavailable
Gateway Timeout
Request timeout from upstream provider
Error Types
Authentication Errors
- Missing
x-portkey-api-keyheader - Invalid API key for the provider
- Expired API key
Invalid Request Errors
- Missing required parameters
- Invalid parameter values
- Malformed JSON
Provider Errors
- Invalid model name
- Model not available for your account
- Provider API is down
Rate Limit Errors
Timeout Errors
- Provider taking too long to respond
- Network issues
- Large request or response
Error Handling Best Practices
Retry Strategy
Implement exponential backoff for retries:Fallback Configuration
Use the gateway’s built-in fallback support:Check Provider Status
Before making requests, you can check provider availability:Debug Mode
Enable debug mode for detailed error information:boolean
Enable debug mode (returns additional error details)