Overview
To ensure fair usage and system stability, the MythIQ API enforces various limits on requests. These limits help prevent abuse, ensure equitable access to resources, and maintain a high quality of service for all users.
The limits fall into several categories:
- Rate limits (requests per minute/hour/day)
- Concurrent request limits
- Content size limits
- Token usage limits
Fair Usage Policy
Our limits are designed to ensure all users have fair access to the API while maintaining system stability and performance. Higher tier accounts receive more generous limits.
Rate Limits
Rate limits restrict the number of API requests you can make within a specific time period. These limits vary based on your account tier and the specific endpoint being accessed.
Account Tier | Requests per Minute | Requests per Hour | Requests per Day |
---|---|---|---|
Free | 10 | 100 | 1,000 |
Basic | 30 | 500 | 5,000 |
Pro | 100 | 2,000 | 20,000 |
Enterprise | Custom | Custom | Custom |
Endpoint-Specific Limits
Some endpoints, particularly those for resource-intensive operations like video generation, may have lower rate limits than those listed above. These specific limits are noted in the documentation for each endpoint.
Concurrent Request Limits
In addition to rate limits, there are also limits on the number of concurrent requests you can have in progress at any given time. This is particularly relevant for generation endpoints that may take some time to complete.
Account Tier | Concurrent Image Generations | Concurrent Video Generations |
---|---|---|
Free | 2 | 1 |
Basic | 5 | 2 |
Pro | 20 | 5 |
Enterprise | Custom | Custom |
Content Size Limits
There are limits on the size of content that can be uploaded or generated through the API:
Upload Limits
Content Type | Maximum Size |
---|---|
Images | 20 MB |
Videos | 100 MB |
Prompt Limits
Endpoint | Maximum Prompt Length |
---|---|
/v1/images/generations | 1,000 characters |
/v1/videos/generations | 500 characters |
Output Size Limits
The maximum size of generated content depends on the specific model and parameters used. For example:
Content Type | Maximum Dimensions |
---|---|
Images | 4096x4096 pixels (model dependent) |
Videos | 1080p resolution, 30 seconds (model dependent) |
Storage Limits
MythIQ provides storage for generated and uploaded media. The amount of storage available depends on your account tier:
Account Tier | Storage Limit | Retention Period |
---|---|---|
Free | 1 GB | 7 days |
Basic | 10 GB | 30 days |
Pro | 100 GB | 90 days |
Enterprise | Custom | Custom |
After the retention period, files are automatically deleted unless you've downloaded them or extended their retention through the API or dashboard.
Monitoring Your Usage
You can monitor your API usage and limits through several methods:
Response Headers
Every API response includes headers that provide information about your current rate limit status:
These headers indicate your total limit, how many requests you have remaining, and when the limit will reset (in Unix timestamp format).
Dashboard
The MythIQ dashboard provides detailed analytics on your API usage, including:
- Current usage relative to your limits
- Historical usage patterns
- Breakdown by endpoint and operation type
- Storage usage and file counts
Usage API
You can also programmatically check your usage through the Usage API:
curl https://api.mythiq.ai/v1/usage \
-H "Authorization: Bearer YOUR_API_KEY"
This endpoint returns detailed information about your current usage and limits.
Handling Limit Errors
When you exceed a limit, the API will return a 429 Too Many Requests status code along with an error response:
{
"success": false,
"message": "Rate limit exceeded. Please try again in 35 seconds.",
"code": "rate_limit_exceeded",
"retry_after": 35
}
The retry_after
field indicates how many seconds you should wait before making another request.
Best Practices for Handling Limits
- Implement exponential backoff: When you receive a rate limit error, wait the suggested time and then retry with increasing delays if needed.
- Monitor your usage: Keep track of your usage to avoid hitting limits unexpectedly.
- Batch requests when possible: Instead of making many small requests, batch them together to reduce the number of API calls.
- Implement client-side caching: Cache responses to avoid making redundant requests for the same data.
- Upgrade your account tier: If you consistently hit limits, consider upgrading to a higher tier with more generous limits.
Example: Implementing Retry Logic
async function makeRequestWithRetry(url, options, maxRetries = 3) {
let retries = 0;
while (retries < maxRetries) {
try {
const response = await fetch(url, options);
if (response.status === 429) {
// Rate limit exceeded
const data = await response.json();
const retryAfter = data.retry_after || 1;
console.log(`Rate limit exceeded. Retrying in ${retryAfter} seconds...`);
// Wait for the specified time
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
// Increment retry counter
retries++;
} else {
// Success or other error
return response;
}
} catch (error) {
console.error('Request failed:', error);
retries++;
if (retries >= maxRetries) {
throw error;
}
// Exponential backoff
await new Promise(resolve => setTimeout(resolve, Math.pow(2, retries) * 1000));
}
}
throw new Error('Maximum retries exceeded');
}
Increasing Your Limits
If you need higher limits than what's available on your current plan, you have several options:
Upgrade Your Account
The simplest way to increase your limits is to upgrade to a higher account tier. You can do this through the MythIQ dashboard.
Request Custom Limits
Enterprise customers can request custom limits tailored to their specific needs. Contact our sales team to discuss your requirements.
Optimize Your Usage
Sometimes, you can achieve your goals without increasing limits by optimizing your API usage patterns:
- Implement caching to reduce redundant requests
- Batch operations where possible
- Use webhooks for long-running operations instead of polling
- Prioritize critical requests and defer non-essential ones