Error response format
All error responses follow this structure:| Field | Description |
|---|---|
message | A human-readable description of the error |
type | The category of error (e.g., authentication_error, invalid_request_error) |
code | A machine-readable error code |
Error codes
| Code | HTTP Status | Description |
|---|---|---|
AUTHENTICATION_FAILED | 401 | Invalid or missing API key |
INSUFFICIENT_BALANCE | 402 | Account balance too low (prepaid accounts) |
INVALID_REQUEST | 400 | Malformed request or invalid parameters |
MODEL_NOT_FOUND | 404 | Requested model does not exist |
MODEL_DISABLED | 404 | Model is currently disabled |
RATE_LIMITED | 429 | Too many requests |
ALL_PROVIDERS_EXHAUSTED | 502 | All providers failed to handle the request |
UPSTREAM_ERROR | varies | A provider returned an error |
Error details
AUTHENTICATION_FAILED
Returned when your API key is invalid, missing, or inactive.- Missing
Authorizationheader - Malformed authorization header (should be
Bearer lmnfl_...) - API key has been revoked or is inactive
Authorization header is correctly formatted.
INSUFFICIENT_BALANCE
Returned when your prepaid account balance is too low to cover the request cost.?dryRun=true parameter to estimate costs before making requests.
INVALID_REQUEST
Returned when your request is malformed or contains invalid parameters.- Missing required parameters
- Invalid parameter values or types
- Unsupported parameter combinations
MODEL_NOT_FOUND
Returned when the requested model does not exist in the Lumenfall catalog.MODEL_DISABLED
Returned when the requested model exists but is currently disabled.RATE_LIMITED
Returned when you’ve exceeded the rate limit.ALL_PROVIDERS_EXHAUSTED
Returned when all available providers failed to process your request. This typically indicates a temporary issue with upstream providers.UPSTREAM_ERROR
Returned when a provider returns an error that cannot be retried. The HTTP status code varies based on the underlying provider error.- Content policy violations (prompt or generated content flagged)
- Provider-specific validation errors
Best practices
- Check HTTP status codes first - Use status codes for high-level error categorization before parsing the response body.
- Use the
codefield for programmatic handling - Thecodefield is stable and suitable for conditional logic in your application. - Display the
messagefield to users - Error messages are designed to be human-readable and actionable. - Implement retry logic with backoff - For 5xx errors and
RATE_LIMITED, implement exponential backoff with jitter.