SelamGPT PlatformSelamGPT
docs v1.0.0
Error Handling
The SelamAPI uses conventional HTTP response codes to indicate the success or failure of an API request.
HTTP Status Codes
200OK - Everything worked as expected
400Bad Request - The request was unacceptable
401Unauthorized - No valid API key provided
403Forbidden - Insufficient permissions or access denied
413Payload Too Large - Request body exceeds size limits
429Too Many Requests - Rate limit exceeded
500Server Error - Something went wrong on our end
503Service Unavailable - Temporary service disruption
Error Response Format
All errors return a JSON object with the following structure:
Error Response Structure
1{
2 "error": {
3 "message": "Invalid API key provided.",
4 "type": "invalid_request_error",
5 "code": "invalid_api_key"
6 }
7}Common Error Types
invalid_request_error
Your request was malformed or missing required parameters.
1{
2 "error": {
3 "message": "Missing required parameter: 'model'",
4 "type": "invalid_request_error",
5 "code": "missing_parameter"
6 }
7}authentication_error
Your API key is invalid, missing, or has insufficient permissions.
1{
2 "error": {
3 "message": "Invalid API key provided.",
4 "type": "authentication_error",
5 "code": "invalid_api_key"
6 }
7}rate_limit_error
You have exceeded your rate limit. Check the response headers for retry information.
1{
2 "error": {
3 "message": "Rate limit exceeded. Try again in 60 seconds.",
4 "type": "rate_limit_error",
5 "code": "rate_limit_exceeded"
6 }
7}Feature-Specific Errors
Text-to-Speech Errors
1{
2 "error": {
3 "message": "Input text exceeds maximum character limit for your account level.",
4 "type": "invalid_request_error",
5 "code": "character_limit_exceeded",
6 "details": {
7 "max_characters": 1500,
8 "provided_characters": 2000
9 }
10 }
11}Solution: Reduce text length or upgrade your account for higher limits.
Image Generation Errors
1{
2 "error": {
3 "message": "Invalid image size specified.",
4 "type": "invalid_request_error",
5 "code": "invalid_size",
6 "details": {
7 "supported_sizes": ["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"]
8 }
9 }
10}Solution: Use one of the supported image sizes.
OCR/File Upload Errors
1{
2 "error": {
3 "message": "File size exceeds maximum limit.",
4 "type": "invalid_request_error",
5 "code": "file_too_large",
6 "details": {
7 "max_size_mb": 5,
8 "provided_size_mb": 8
9 }
10 }
11}Solution: Reduce file size to under 5MB or split into multiple files.
Web Search Errors
1{
2 "error": {
3 "message": "Web search temporarily unavailable.",
4 "type": "service_error",
5 "code": "search_unavailable"
6 }
7}Solution: Request continues without search results. Retry later for search functionality.
Multilingual Mode Errors
1{
2 "error": {
3 "message": "Specified target language is not supported.",
4 "type": "invalid_request_error",
5 "code": "unsupported_language",
6 "details": {
7 "supported_languages": ["en", "am", "ti", "om", "aa", "so"]
8 }
9 }
10}Solution: Use one of the supported language codes.
Best Practices
- Always check the HTTP status code before processing the response
- Implement exponential backoff for rate limit errors
- Log error messages for debugging purposes
- Handle network timeouts gracefully
- Validate your request parameters before sending
Was this page helpful?