Skip to navigation

The Ideogram API limits how much work your organization can have in progress at once. The limit applies across every endpoint and counts the images and videos still being generated, not the requests: a request for 4 images takes 4 places. The default limit is 10. To raise it, contact partnership@ideogram.ai.

There is no batch submission endpoint. To process a large set of requests, send them with bounded concurrency and let finished requests make room for new ones.

When you reach the limit

A request over the limit is rejected with 429 and a reject_reason:

{
"error": "<message>",
"reject_reason": "inflight_limit"
}

The body can also include max_inflight_requests, your limit, and task_completion_speed. Despite its name, max_inflight_requests counts images and videos. A rejected request doesn’t run and isn’t billed. Wait for some of your in-flight requests to finish, then retry.

A 402 is not a rate limit. It means your balance or plan doesn’t allow the request, with a reject_reason such as insufficient_funds or daily_limit. Retrying won’t help until the balance or limit changes; see Errors and billing.

Polling limits

GET /v2/generations/{generation_id} allows 1,000 requests per 10 seconds per organization. Over that, it returns 429 with a Retry-After header that gives the number of seconds to wait. Poll each generation every few seconds rather than in a tight loop, or use webhooks instead.

Bounded concurrency

Keep a fixed number of requests in flight and back off on 429. Size the pool by outputs: each request below asks for one image, so 8 workers keep at most 8 of the default 10 places busy.

import os
import time
from concurrent.futures import ThreadPoolExecutor
import requests
API = "https://api.ideogram.ai"
HEADERS = {"Api-Key": os.environ["IDEOGRAM_API_KEY"]}
IMAGES_PER_REQUEST = 1
MAX_IN_FLIGHT = 8 // IMAGES_PER_REQUEST # stay under your organization's limit
def generate(prompt: str) -> dict:
for attempt in range(5):
response = requests.post(
f"{API}/v2/image/generate/ideogram-4-5",
headers=HEADERS,
json={"prompt": prompt, "num_images": IMAGES_PER_REQUEST},
timeout=300, # longer than the API's 265-second synchronous wait
)
if response.status_code != 429:
response.raise_for_status()
return response.json()
time.sleep(2**attempt) # wait for in-flight requests to finish
# A requests.Timeout isn't caught: the request may still be running and billed,
# so don't send it again.
raise RuntimeError("Still over the in-flight limit after 5 attempts")
prompts = ["A ceramic mug on a wooden table", "A glass vase with tulips"]
with ThreadPoolExecutor(max_workers=MAX_IN_FLIGHT) as pool:
results = list(pool.map(generate, prompts))

Retrying after a 429 is safe because the rejected request never ran. Retrying after a timeout is not: the first request may still be running and will be billed. See Idempotency and safe retries.