Image Generation
Image
by Henri Huotari · Oct 22, 2025
Generate images with default model (Flux Schnell)
This file couldn't be loaded. The link may have expired.
Run it yourself
Set IMMERSIVE_API_KEY to an API key from your account. Create a free account to get one.
curl -X POST 'https://ai.im.inc/api/v1/images/generate' \
-H "Authorization: Bearer $IMMERSIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "White Lamborghini parked on the side of the road in Paris, with one Eiffel Tower far in the background, at night",
"aspect_ratio": "16:9",
"output_format": "webp"
}'
# Set JOB_ID to the response's "id", then poll every few seconds until the job has finished:
curl "https://ai.im.inc/api/v1/images/$JOB_ID" \
-H "Authorization: Bearer $IMMERSIVE_API_KEY"
# The finished response has the result at output.generated_image_url.
const headers = { Authorization: `Bearer ${process.env.IMMERSIVE_API_KEY}` };
const response = await fetch("https://ai.im.inc/api/v1/images/generate", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"prompt": "White Lamborghini parked on the side of the road in Paris, with one Eiffel Tower far in the background, at night",
"aspect_ratio": "16:9",
"output_format": "webp"
}),
});
const job = await response.json();
// Poll every few seconds while the job is still running.
const running = ["pending", "queued", "submitted", "starting", "processing", "running", "streaming", "in_queue", "in_progress"];
let result;
do {
await new Promise((resolve) => setTimeout(resolve, 5000));
result = await (await fetch(`https://ai.im.inc/api/v1/images/${job.id}`, { headers })).json();
} while (running.includes(String(result.status).toLowerCase()));
console.log(result.output.generated_image_url);
import os
import time
import requests
headers = {"Authorization": f"Bearer {os.environ['IMMERSIVE_API_KEY']}"}
job = requests.post(
"https://ai.im.inc/api/v1/images/generate",
headers=headers,
json={
"prompt": "White Lamborghini parked on the side of the road in Paris, with one Eiffel Tower far in the background, at night",
"aspect_ratio": "16:9",
"output_format": "webp",
},
timeout=300,
).json()
# Poll every few seconds while the job is still running.
running = {"pending", "queued", "submitted", "starting", "processing", "running", "streaming", "in_queue", "in_progress"}
while True:
time.sleep(5)
result = requests.get(f"https://ai.im.inc/api/v1/images/{job['id']}", headers=headers, timeout=60).json()
if str(result.get("status", "")).lower() not in running:
break
print(result["output"]["generated_image_url"])
{
"id": "48bs7swg0nrme0ct1hk8aw5dhc",
"meta": "{\"input\": {\"prompt\": \"White Lamborghini parked on the side of the road in Paris, with one Eiffel Tower far in the background, at night\", \"go_fast\": true, \"megapixels\": \"1\", \"num_outputs\": 1, \"aspect_ratio\": \"16:9\", \"output_format\": \"webp\", \"output_quality\": 90, \"negative_prompt\": null, \"num_inference_steps\": 4}}",
"seed": "3235374771",
"error": null,
"output": {
"prompt": "White Lamborghini parked on the side of the road in Paris, with one Eiffel Tower far in the background, at night",
"generated_image_url": "https://s3.huotari.ai/immersive/examples/outputs/740737b8-f410-4401-8804-c75605a0d8ad/output.generated_image_url.jpeg",
"all_generated_image_urls": []
},
"status": "succeeded",
"num_outputs": 0,
"nsfw_detected": false,
"generator_used": "flux_schnell"
}
Your browser blocked the clipboard. Select the text and copy it by hand.
How the job runs
- POST returns the job's id and status right away.
- Poll GET /api/v1/images/{id} every few seconds while the job is running.
- When status is succeeded, download output.generated_image_url. Failed jobs are refunded automatically.
- Endpoint
- POST /api/v1/images/generate
- Output
- Image · JPEG