Errors
Understanding and handling API errors.
Error Response Format
When an API error occurs, InferHood returns a JSON response containing error details.
json
{
"error": {
"message": "Invalid API key provided.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}Error Codes
- 400 - Bad Request: The request was unacceptable, often due to missing a required parameter.
- 401 - Unauthorized: No valid API key provided.
- 402 - Payment Required: You have hit your billing limit, or the request requires x402 payment fulfillment.
- 403 - Forbidden: The API key doesn’t have permissions to perform the request (wrong scope).
- 404 - Not Found: The requested resource (e.g., model) doesn’t exist.
- 409 - Conflict: The request conflicts with another request.
- 422 - Unprocessable Entity: The request format is valid, but semantics are incorrect.
- 429 - Too Many Requests: You have hit your rate limit. See headers for retry details.
- 500 - Internal Server Error: Something went wrong on our end.
- 502 - Bad Gateway: The upstream provider (OpenAI, Anthropic, etc.) returned an invalid response.
- 503 - Service Unavailable: The service is temporarily unavailable (e.g., provider outage).
Rate Limiting
InferHood enforces rate limits based on your account tier. Rate limit information is included in the response headers of every request. Wait the specified amount of time before retrying.