🦋
SYNAPSE API
  • 📚SYNAPSE
  • Services
    • 💬Language Models
    • 🎨Stable Diffusion
    • 🖼️Stable Diffusion XL
    • 🛝Playground
    • 👨‍🎨DALL-E-3
    • 🎤Whisper
    • 🗣️Text To Speech
  • Info
    • ⛓️Limits
    • ❓Support
    • 🔑API Key
    • 👑Premium
Powered by GitBook
On this page
  • Get Limits
  • Example: Fetching and Updating Rate Limits
  1. Info

Limits

Some API endpoints, which are expensive to run, may have limits. These limitations are subject to change often. When changes occur, updates will be made on this page to reflect the new limits.

If you'd like to get rid of API limits, consider upgrading!

Warning - Not up to date!

API limits are updated and changed often based on demand and availability, and this page is not always updated to match current limits.

You should always check using the API first! You do not need an API Key for the limits endpoint!

Get Limits

GET /limits

This endpoint lets you get a list of rate limits for specific endpoints and their features. The number value associated with a limit is the number of milliseconds you must wait between requests.

Headers

Name
Value

Content-Type

application/json

Response

{
  "llm": {
    "gpt-3.5-turbo-16k": 15000,
    "gemini-pro": 15000,
    "claude-3-sonnet": {
      "premium": 5000,
      "free": -1,
    },
    "gpt-4": { "premium": 5000, "free": -1 },
  },
  "sdxl": 20000,
  "playground": 90000,
  "dalle": 120000,
  "whisper": 600000,
  "tts": 60000,
}
{
  "error": "Invalid request"
}

Example: Fetching and Updating Rate Limits

To get specific rate limits and update them every hour automatically, you can use the following example code. This script fetches the rate limits, updates them every hour, and saves the updated values to be referenced later if needed.

let rateLimits = {};

// Function to fetch rate limits
async function fetchRateLimits() {
  try {
    const response = await fetch('https://synapselabs.onrender.com/limits', {
      headers: {
        'Content-Type': 'application/json'
      }
    });
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    const data = await response.json();
    // Update the global variable with the latest rate limits
    rateLimits = data;
    console.log('Rate limits updated:', rateLimits);
  } catch (error) {
    console.error('Error fetching rate limits:', error);
  }
}

// Fetch rate limits immediately and then update every hour
fetchRateLimits();
setInterval(fetchRateLimits, 3600000); // 3600000 milliseconds = 1 hour

This script performs an initial fetch of the rate limits and then sets an interval to automatically update the limits every hour.

PreviousText To SpeechNextSupport

Last updated 1 year ago

⛓️