Error Handling
Learn how to handle errors from the Assisters API gracefully. All errors follow a consistent format to make debugging easier.Error Response Format
All API errors return a JSON response with this structure:| Field | Description |
|---|---|
message | Human-readable description of the error |
type | Category of the error |
code | Machine-readable error code |
param | The parameter that caused the error (if applicable) |
HTTP Status Codes
| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Valid key but no access |
404 | Not Found - Resource doesn’t exist |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server-side issue |
503 | Service Unavailable - Temporarily overloaded |
Error Types
invalid_request_error
The request was malformed or missing required parameters.
- Missing required parameters
- Invalid parameter values
- Malformed JSON body
- Unsupported model name
authentication_error
Issues with your API key.
- API key is missing
- API key is malformed
- API key has been revoked
rate_limit_error
You’ve exceeded your rate limits.
tokens_exhausted_error
You’ve used all your monthly tokens.
insufficient_funds_error
Your wallet balance is too low (for pay-as-you-go).
content_policy_error
Content was blocked by moderation.
server_error
An issue on our side.
Error Codes Reference
| Code | Status | Description |
|---|---|---|
invalid_api_key | 401 | API key is invalid or missing |
api_key_revoked | 401 | API key has been revoked |
origin_not_allowed | 403 | Request origin not in allowed domains |
invalid_model | 400 | Specified model doesn’t exist |
invalid_request | 400 | Request body is malformed |
missing_parameter | 400 | Required parameter is missing |
invalid_parameter | 400 | Parameter has invalid value |
context_length_exceeded | 400 | Input exceeds model’s context limit |
rate_limit_exceeded | 429 | RPM or TPM limit exceeded |
tokens_exhausted | 429 | Monthly token limit reached |
insufficient_funds | 402 | Wallet balance too low |
content_filtered | 400 | Content blocked by moderation |
prompt_injection_detected | 400 | Potential prompt injection blocked |
model_overloaded | 503 | Model is temporarily overloaded |
internal_error | 500 | Server-side error |
Handling Errors in Code
Retry Strategy
Implement exponential backoff for transient errors:Best Practices
Implement Retries
Use exponential backoff for rate limits and server errors
Log Request IDs
Save the
X-Request-ID header for debugging with supportHandle All Error Types
Don’t just catch generic exceptions - handle specific error types
Show User-Friendly Messages
Don’t expose raw error messages to end users
Getting Help
If you encounter persistent errors:- Check the status page for outages
- Review your dashboard for usage limits
- Include the
X-Request-IDwhen contacting support - Join our Discord for community help
Contact Support
Email us with your request ID for faster resolution