<800ms
Time-to-First-Byte
First SSE event
50
Parallel Requests
Per API key
Native
SSE Streaming
Real-time progress
99.9%
Uptime SLA
Enterprise-grade
Open a single SSE connection and receive progress updates, intermediate results, and completion events as they happen. No polling, no WebSocket complexity.
import httpx
# Stream image generation progress via SSE
def stream_image_generation(prompt: str, api_key: str):
url = "https://api.creativeai.run/v1/images/generations/stream"
headers = {
"Authorization": f"Bearer {api_key}",
"Accept": "text/event-stream",
}
payload = {
"model": "seedream-3",
"prompt": prompt,
"size": "1024x1024",
"stream": True,
}
with httpx.stream("POST", url, json=payload, headers=headers, timeout=60) as r:
for line in r.iter_lines():
if line.startswith("data: "):
data = json.loads(line[6:])
if data.get("status") == "progress":
print(f"Progress: {data['percent']}%")
elif data.get("status") == "complete":
print(f"Image URL: {data['url']}")
return data["url"]
# Sub-second TTFB β first SSE event arrives in <800ms
url = stream_image_generation(
"cinematic portrait, golden hour lighting",
api_key="YOUR_CREATIVEAI_KEY",
)const EventSource = require("eventsource");
function streamVideoGeneration(prompt, apiKey) {
return new Promise((resolve, reject) => {
const url = "https://api.creativeai.run/v1/videos/generations/stream";
const es = new EventSource(url, {
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
// POST body for SSE connection
body: JSON.stringify({
model: "kling-v2",
prompt,
duration: 5,
stream: true,
}),
});
es.addEventListener("progress", (e) => {
const data = JSON.parse(e.data);
console.log(`Video progress: ${data.percent}%`);
});
es.addEventListener("complete", (e) => {
const data = JSON.parse(e.data);
console.log(`Video ready: ${data.url}`);
es.close();
resolve(data.url);
});
es.addEventListener("error", (e) => {
es.close();
reject(new Error("Stream error"));
});
});
}
// First progress event arrives in <1s
const videoUrl = await streamVideoGeneration(
"smooth camera orbit around a product bottle, studio lighting",
"YOUR_CREATIVEAI_KEY"
);Fire 50 generation requests simultaneously. Process entire product catalogs, avatar batches, or thumbnail grids in a single burst.
import asyncio
import httpx
API_KEY = "YOUR_CREATIVEAI_KEY"
BASE_URL = "https://api.creativeai.run/v1"
async def generate_image(client: httpx.AsyncClient, prompt: str) -> dict:
"""Fire a single generation request."""
resp = await client.post(
f"{BASE_URL}/images/generations",
json={"model": "seedream-3", "prompt": prompt, "size": "1024x1024"},
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=30,
)
resp.raise_for_status()
return resp.json()
async def batch_generate(prompts: list[str]) -> list[dict]:
"""Run up to 50 concurrent image generations."""
async with httpx.AsyncClient() as client:
tasks = [generate_image(client, p) for p in prompts]
results = await asyncio.gather(*tasks)
return results
# Generate 50 images in parallel β all hit the API simultaneously
prompts = [f"product photo variant {i}, white background" for i in range(50)]
results = asyncio.run(batch_generate(prompts))
print(f"Generated {len(results)} images concurrently")Use the native Fetch API ReadableStream to consume SSE events in React. Progress state updates your UI frame-by-frame.
import { useCallback, useState } from "react";
export function useStreamGeneration() {
const [progress, setProgress] = useState(0);
const [result, setResult] = useState<string | null>(null);
const generate = useCallback(async (prompt: string) => {
setProgress(0);
setResult(null);
const resp = await fetch(
"https://api.creativeai.run/v1/images/generations/stream",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NEXT_PUBLIC_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "seedream-3",
prompt,
stream: true,
}),
}
);
const reader = resp.body!.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop() || "";
for (const line of lines) {
if (!line.startsWith("data: ")) continue;
const data = JSON.parse(line.slice(6));
if (data.status === "progress") setProgress(data.percent);
if (data.status === "complete") setResult(data.url);
}
}
}, []);
return { generate, progress, result };
}Every layer of the stack is optimized for low latency and high throughput.
First progress event arrives in under 800ms. Your UI starts updating before the image is even half-rendered β no more blank loading screens.
Fire up to 50 concurrent generation requests per API key. Process entire product catalogs, avatar batches, or thumbnail grids in seconds, not minutes.
Native SSE support streams generation progress in real time. Get percentage updates, intermediate frames, and completion notifications over a single HTTP connection.
Stream video generation progress for conversational AI, avatar lip-sync, and live product demos. Know exactly when each frame is ready.
Intelligent rate limiting adjusts to your usage pattern. Burst up to 50 requests, sustain high throughput, and scale with your traffic without manual limit increases.
Requests route to the nearest GPU cluster. Connection pooling and keep-alive reduce overhead so every millisecond of your TTFB budget goes toward generation.
GPU clusters in multiple regions ensure consistent sub-second TTFB regardless of where your users are located. No cold starts.
Drop-in replacement for OpenAI image endpoints. Switch your base_url, keep your existing code, and gain streaming + concurrency for free.
Most AI image/video APIs force you to poll. We stream.
| Feature | CreativeAI | Typical AI API |
|---|---|---|
| Time-to-First-Byte | <800ms | 2-5s |
| Parallel Requests / Key | 50 | 5-10 |
| SSE Streaming | Native | Polling only |
| Progress Updates | Real-time % | None |
| Video Generation Streaming | SSE + Webhooks | Webhook only |
| Cold Start | None (warm pools) | 5-30s |
| Pricing Model | Pay-per-use | Subscription + overage |
| SDK Compatibility | OpenAI drop-in | Custom SDK |
Real-time streaming and high concurrency unlock use cases that polling-based APIs cannot serve.
Tavus, Zoice, HeyGen
Stream avatar video frames with sub-second latency for real-time conversations. SSE delivers frame-by-frame progress so your UI stays responsive.
302.AI, PiAPI, NovitaAI
Serve hundreds of end-users concurrently with 50 parallel requests per key. Stream progress to each user's browser via SSE pass-through.
Shopify Apps, E-commerce Tools
Generate 50 product photo variants simultaneously. Sub-second TTFB means your merchants see previews almost instantly.
AdTech, Newsletter Platforms
Generate ad creatives and newsletter visuals on-the-fly. Streaming lets your pipeline start post-processing before generation completes.