MythIQ

Command Palette

Search for a command to run...

API Limits

Understand the rate limits and usage constraints of the MythIQ API.

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 TierRequests per MinuteRequests per HourRequests per Day
Free101001,000
Basic305005,000
Pro1002,00020,000
EnterpriseCustomCustomCustom

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 TierConcurrent Image GenerationsConcurrent Video Generations
Free21
Basic52
Pro205
EnterpriseCustomCustom

Content Size Limits

There are limits on the size of content that can be uploaded or generated through the API:

Upload Limits

Content TypeMaximum Size
Images20 MB
Videos100 MB

Prompt Limits

EndpointMaximum Prompt Length
/v1/images/generations1,000 characters
/v1/videos/generations500 characters

Output Size Limits

The maximum size of generated content depends on the specific model and parameters used. For example:

Content TypeMaximum Dimensions
Images4096x4096 pixels (model dependent)
Videos1080p 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 TierStorage LimitRetention Period
Free1 GB7 days
Basic10 GB30 days
Pro100 GB90 days
EnterpriseCustomCustom

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:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1616979600

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:

bash
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:

json
{
  "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

typescript
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