Error Codes
This guide provides an overview of the error codes you might encounter when using the IG1 AI API. Each error includes the cause and recommended solutions.
API Errors Overview
IG1 AI uses conventional HTTP response codes to indicate the success or failure of API requests:
- 2xx codes indicate success
- 4xx codes indicate an error with the request (authentication, parameters, rate limits, budget)
- 5xx codes indicate an issue on our server side
All error responses include a JSON body with the following structure:
{
"message": "Human-readable error message",
"code": 400,
"request_id": "req_abc123xyz"
}
When contacting support about an error, always include the request_id to help us diagnose the issue quickly.
Endpoint paths: Most endpoints are under /v1/ (e.g., /v1/chat/completions, /v1/embeddings), but some are not:
/document- Document to markdown conversion/usage- Current month usage summary/usage/history- Detailed usage by model and day
Error Code Reference
| Code | Message | Overview |
|---|---|---|
| 400 - Bad Request | Various | The request was malformed or contains invalid parameters |
| 401 - Unauthorized | Unauthorized | Missing or invalid API key |
| 402 - Payment Required | Commit exceeded | Monthly budget limit exceeded |
| 403 - Forbidden | Forbidden | API key does not exist or is inactive |
| 500 - Internal Server Error | Internal Server Error | Server-side error during request processing |
| 502 - Bad Gateway | Failed to forward request | Backend model service unavailable |
400 - Bad Request
This error indicates that your request was malformed, contains invalid parameters, or references resources that don't exist.
Common Causes
Invalid JSON payload
- Messages:
"Request body processing error.","Failed to parse request","Bad JSON." - Cause: The request body is not valid JSON or doesn't match the expected schema
- Solution: Check that your request body is properly formatted JSON. Validate against the API schema for the specific endpoint you're calling.
Unknown model
- Message:
"Unknown model {model}" - Cause: The model name specified in your request doesn't exist in our catalog
- Solution: Verify the model name. Check the Models overview page for the complete list of available models and their correct names.
For image models with prompt enhancing enabled, use the model name with the -pe suffix (e.g., flux-1-pe instead of flux-1). This automatically enables prompt enhancement using the configured LLM.
Invalid parameters
- Messages:
"Unknown quality {quality}","Invalid month parameter.","Invalid year parameter." - Cause: A parameter value is outside the accepted range or format
- Solution: Review the endpoint documentation for valid parameter values and formats.
Too many input images
- Message:
"Model {model} only supports up to {N} input images" - Cause: You've provided more input images than the model supports
- Solution: Reduce the number of input images to within the model's limits. Check the Image models documentation.
Invalid content type
- Message:
"Invalid content type. Must be application/json or multipart/form-data." - Cause: The
Content-Typeheader doesn't match the expected format - Solution: Use
application/jsonfor JSON payloads ormultipart/form-datafor file uploads.
Prompt enhancing not supported
- Message:
"Prompt enhancing not supported for model {model}" - Cause: You're trying to use prompt enhancement with a model that doesn't support it
- Solution: Check the model's capabilities in the Image models documentation.
401 - Unauthorized
This error indicates that your request is missing valid authentication credentials.
Message: Unauthorized
Cause:
- The
Authorizationheader is missing or empty - The header format is incorrect
Solution:
- Include the
Authorizationheader in your request:Authorization: Bearer YOUR_API_KEY - Verify your API key is correctly formatted (no extra spaces or characters)
- Check your API key settings
402 - Payment Required
Message: Commit exceeded: {totalCost} >= {maxCost}
Cause: Your organization has exceeded its monthly budget limit (MaxCostPerMonth).
Solution:
- Check your current usage (see Usage API and Usage History)
- Contact your organization administrator to review budget settings
- Wait until the next billing cycle when usage resets
403 - Forbidden
Message: Forbidden
Cause: The API key provided doesn't exist in our database or has been deactivated.
Solution:
- Verify you're using the correct API key from your organization settings
- Ensure your API key hasn't been revoked or expired
- If you've recently created a new key, wait a few moments and try again
- Contact your organization administrator if you believe this is an error
500 - Internal Server Error
This error indicates that something went wrong on our side while processing your request.
Common Messages
| Message | When it occurs |
|---|---|
"Internal Server Error" | Generic server error during request processing |
"Failed to get model" | Database error when looking up model information |
"Failed to tokenize input." | Error during text tokenization |
"Input rate limiter error" | Rate limiter service encountered an error |
"Failed to marshal request payload" | Error serializing the request |
"Failed to decode backend response" | Error parsing the model's response |
"Failed to extract image data" | Error processing image generation output |
"Failed to convert image format" | Error during image format conversion |
Solution:
- Retry your request after a brief wait (we recommend exponential backoff)
- Include the
request_idfrom the error response when contacting support - Check our status page for any ongoing incidents
- If the issue persists, contact support with the request ID
All 5xx errors include the suffix: " Please contact the administrator with the request ID."
502 - Bad Gateway
Message: Failed to forward request to backend
Cause: The backend model service (vLLM or other inference engine) is temporarily unavailable.
Solution:
- Retry your request after a brief wait (typically resolves within seconds)
- Implement retry logic with exponential backoff in your application
- If the issue persists for more than a few minutes, contact support
Error Handling Best Practices
Implement Retry Logic
For transient errors (5xx codes), implement retry logic with exponential backoff:
import time
from openai import OpenAI, APIError
client = OpenAI(base_url="https://api.ig1.ai/v1", api_key="your-api-key")
def make_request_with_retry(max_retries=3):
for attempt in range(max_retries):
try:
response = client.chat.completions.create(
model="qwen35-397b-a17b-instruct-general",
messages=[{"role": "user", "content": "Hello"}]
)
return response
except APIError as e:
if attempt == max_retries - 1:
raise # Last attempt, re-raise the error
# Wait before retrying (exponential backoff)
wait_time = 2 ** attempt
print(f"Attempt {attempt + 1} failed. Retrying in {wait_time}s...")
time.sleep(wait_time)
# Usage
try:
response = make_request_with_retry()
print(response.choices[0].message.content)
except APIError as e:
print(f"Request failed after retries: {e}")
Log Request IDs
Always log the request_id from error responses. This is crucial for debugging:
try:
response = client.chat.completions.create(
model="qwen35-397b-a17b-instruct-general",
messages=[{"role": "user", "content": "Hello"}]
)
except APIError as e:
request_id = getattr(e, 'request_id', 'unknown')
print(f"Error (request_id: {request_id}): {e}")
# Log this to your monitoring system
Handle Specific Error Codes
Differentiate between client errors (4xx) and server errors (5xx):
from openai import (
BadRequestError,
RateLimitError,
APIConnectionError,
InternalServerError,
AuthenticationError
)
try:
response = client.chat.completions.create(
model="qwen35-397b-a17b-instruct-general",
messages=[{"role": "user", "content": "Hello"}]
)
except BadRequestError as e:
# Don't retry - fix the request
print(f"Invalid request: {e}")
except AuthenticationError as e:
# Check your API key
print(f"Authentication failed: {e}")
except RateLimitError as e:
# Wait and retry
print(f"Rate limited, waiting...")
except (APIConnectionError, InternalServerError) as e:
# Retry with backoff
print(f"Server error, will retry...")
Getting Help
If you encounter persistent errors that you cannot resolve:
- Check the documentation: Review the specific endpoint documentation for parameter requirements
- Verify your setup: Ensure your Master API Key is correct and you're using the right base URL
- Retry the request: For 5xx errors, wait a moment and try again
- Contact support: Reach out with the following information:
- The
request_idfrom the error response - The endpoint you're calling
- The model you're using
- A sanitized version of your request (remove sensitive data)
- A sanitized version of your request (remove sensitive data)
- The timestamp of the error
- The
Support Channels
- Documentation: Browse the API Reference for detailed endpoint documentation
- Documentation: Browse the API Reference for detailed endpoint documentation
- Models: Check the Models overview for available models and their capabilities
Quick Reference Table
| HTTP Code | Retry? | Action Required |
|---|---|---|
| 400 | ❌ No | Fix request parameters |
| 401 | ❌ No | Update API key |
| 402 | ❌ No | Contact admin about budget |
| 403 | ❌ No | Verify API key is active |
| 500 | ✅ Yes | Retry with backoff |
| 502 | ✅ Yes | Retry with backoff |
Note: All error messages from the IG1 AI API include a suffix: " Please contact the administrator with the request ID." This is intentional to help with debugging and support requests.