Error Response Format
All error responses follow this structure:HTTP Status Codes
| Status | Meaning | Description |
|---|---|---|
200 | Success | Request completed successfully |
400 | Bad Request | Invalid request body or parameters |
401 | Unauthorized | Missing or invalid API key |
402 | Payment Required | Insufficient credits |
404 | Not Found | Resource not found (e.g., uploaded image expired) |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Something went wrong on our end |
SDK Error Classes
Both SDKs provide typed error classes for precise error handling.Python SDK
TypeScript SDK
Error Reference
BijouInsufficientCreditsError
Thrown when the user’s credit balance is too low to complete the request.| Property | Type | Description |
|---|---|---|
message | string | Error message from API |
status_code | number | Always 402 |
code | string | "INSUFFICIENT_CREDITS" |
request_id | string? | Request ID for debugging |
BijouRateLimitError
Thrown when too many requests are made in a short period.| Property | Type | Description |
|---|---|---|
message | string | Error message |
retry_after | number | Seconds to wait before retrying |
request_id | string? | Request ID for debugging |
retry_after seconds, then retry.
BijouValidationError
Thrown when the request contains invalid data.| Property | Type | Description |
|---|---|---|
message | string | Validation error message |
field | string? | Field that failed validation |
BijouTimeoutError
Thrown when a request takes too long to complete.| Property | Type | Description |
|---|---|---|
message | string | Timeout message |
timeout_ms | number | Timeout duration in milliseconds |
BijouAPIError
Base class for all API errors. Catch this to handle any API error.| Property | Type | Description |
|---|---|---|
message | string | Error message |
status_code | number | HTTP status code |
code | string | Error code |
request_id | string? | Request ID for debugging |
is_retryable | boolean | Whether the request can be retried |
Retryable Errors
The SDK automatically retries these errors with exponential backoff:5xxserver errors429rate limit errors- Network timeouts
400bad request401unauthorized402insufficient credits404not found