/ideogram-pack:ideogram-rate-limitsfrom ideogram-pack
Implements exponential backoff, request queuing, and concurrency control for Ideogram's 10 in-flight request limit. Handles 429 errors and batch image generation.
Ships in ideogram-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Handle Ideogram's rate limits with exponential backoff, request queuing, and concurrency control. Ideogram enforces a default limit of 10 in-flight requests (concurrent, not per-minute). Image generation takes 5-15 seconds per call, so this limit can be hit quickly during batch operations.
IDEOGRAM_API_KEY configuredp-queue npm package (optional, for queue-based approach)| Aspect | Detail |
|---|---|
| Type | Concurrent in-flight requests |
| Default limit | 10 simultaneous requests |
| Error code | HTTP 429 |
| Retry header | Not guaranteed -- use exponential backoff |
| Higher limits | Contact [email protected] |
| Generation time | 5-15s per image (varies by model/resolution) |
async function withBackoff<T>(
operation: () => Promise<T>,
config = { maxRetries: 5, baseMs: 1000, maxMs: 30000, jitterMs: 500 }
): Promise<T> {
for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
try {
return await operation();
} catch (err: any) {
if (attempt === config.maxRetries) throw err;
const status = err.status ?? err.response?.status;
// Only retry on 429 (rate limited) or 5xx (server error)
if (status && status !== 429 && status < 500) throw err;
const exponential = config.baseMs * Math.pow(2, attempt);
const jitter = Math.random() * config.jitterMs;
const delay = Math.min(exponential + jitter, config.maxMs);
console.warn(`Rate limited (attempt ${attempt + 1}/${config.maxRetries}). Waiting ${delay.toFixed(0)}ms`);
await new Promise(r => setTimeout(r, delay));
}
}
throw new Error("Unreachable");
}
import PQueue from "p-queue";
// Ideogram allows 10 in-flight -- use 8 to leave headroom
const ideogramQueue = new PQueue({ concurrency: 8 });
async function queuedGenerate(prompt: string, options: any = {}) {
return ideogramQueue.add(async () => {
const response = await fetch("https://api.ideogram.ai/generate", {
method: "POST",
headers: {
"Api-Key": process.env.IDEOGRAM_API_KEY!,
"Content-Type": "application/json",
},
body: JSON.stringify({
image_request: { prompt, model: "V_2", ...options },
}),
});
if (response.status === 429) {
throw Object.assign(new Error("Rate limited"), { status: 429 });
}
if (!response.ok) throw new Error(`Generate failed: ${response.status}`);
return response.json();
});
}
// Process 50 prompts safely -- queue manages concurrency
const prompts = Array.from({ length: 50 }, (_, i) => `Design variant ${i + 1}`);
const results = await Promise.all(prompts.map(p => queuedGenerate(p)));
class TokenBucket {
private tokens: number;
private lastRefill: number;
constructor(
private maxTokens: number = 10,
private refillRate: number = 1, // tokens per second
) {
this.tokens = maxTokens;
this.lastRefill = Date.now();
}
async acquire(): Promise<void> {
this.refill();
if (this.tokens > 0) {
this.tokens--;
return;
}
// Wait for next token
const waitMs = (1 / this.refillRate) * 1000;
await new Promise(r => setTimeout(r, waitMs));
this.refill();
this.tokens--;
}
private refill() {
const now = Date.now();
const elapsed = (now - this.lastRefill) / 1000;
this.tokens = Math.min(this.maxTokens, this.tokens + elapsed * this.refillRate);
this.lastRefill = now;
}
}
const bucket = new TokenBucket(10, 1);
async function throttledGenerate(prompt: string) {
await bucket.acquire();
return queuedGenerate(prompt);
}
async function batchGenerate(
prompts: string[],
onProgress?: (done: number, total: number) => void
) {
const results: any[] = [];
const errors: { prompt: string; error: Error }[] = [];
for (let i = 0; i < prompts.length; i++) {
try {
const result = await withBackoff(() => queuedGenerate(prompts[i]));
results.push(result);
} catch (err) {
errors.push({ prompt: prompts[i], error: err as Error });
}
onProgress?.(i + 1, prompts.length);
}
console.log(`Batch complete: ${results.length} success, ${errors.length} failed`);
return { results, errors };
}
| Scenario | Detection | Action |
|---|---|---|
| 429 received | HTTP status | Exponential backoff + retry |
| All retries exhausted | Max attempts reached | Log and skip, continue batch |
| Burst spike | Queue depth > 20 | Pause new submissions |
| Credits exhausted | 402 status | Alert, stop batch immediately |
[email protected]For security configuration, see ideogram-security-basics.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ideogram, rate-limiting, backoff, request-queue, api-throttling
npx claudepluginhub flight505/skill-forge --plugin ideogram-pack24 skills in this plugin
/ideogram-ci-integrationConfigure CI/CD pipelines for Ideogram integrations with GitHub Actions.
Use when setting up automated testing, visual regression tests,
or integrating Ideogram validation into your build process.
Trigger with phrases like "ideogram CI", "ideogram GitHub Actions",
"ideogram automated tests", "CI ideogram", "ideogram pipeline".
/ideogram-common-errorsDiagnose and fix Ideogram API errors and exceptions.
Use when encountering Ideogram errors, debugging failed requests,
or troubleshooting integration issues.
Trigger with phrases like "ideogram error", "fix ideogram",
"ideogram not working", "debug ideogram", "ideogram 422", "ideogram 429".
/ideogram-core-workflow-aExecute Ideogram primary workflow: text-to-image generation with text rendering.
Use when generating images from text prompts, creating designs with embedded text,
or building the main image generation pipeline.
Trigger with phrases like "ideogram generate image", "ideogram text to image",
"create image with ideogram", "ideogram primary workflow".
/ideogram-core-workflow-bExecute Ideogram secondary workflows: edit (Magic Fill), remix, upscale, describe, and reframe.
Use when modifying existing images, applying style transfer, upscaling,
or building image-to-image pipelines.
Trigger with phrases like "ideogram edit image", "ideogram remix",
"ideogram upscale", "ideogram inpaint", "ideogram magic fill", "ideogram reframe".
/ideogram-cost-tuningOptimize Ideogram costs through model selection, caching, and usage monitoring.
Use when analyzing Ideogram billing, reducing API costs,
or implementing budget alerts and usage tracking.
Trigger with phrases like "ideogram cost", "ideogram billing",
"reduce ideogram costs", "ideogram pricing", "ideogram budget", "ideogram credits".
/ideogram-data-handlingManage Ideogram generated image assets, metadata tracking, and lifecycle management.
Use when implementing image persistence, tracking generation history,
or building asset management for Ideogram outputs.
Trigger with phrases like "ideogram data", "ideogram images",
"ideogram asset management", "ideogram metadata", "ideogram image storage".
Other plugins' skills for the same job