Getting Started
Quickstart
End-to-end examples for image, video, and audio generation with the AirCube API.
Three complete examples — text-to-image, image-to-video, and text-to-speech — each showing the full submit-and-poll workflow.
Prerequisites
- An AirCube account with credits (sign up)
- An API key in the
AIRCUBE_API_KEYenvironment variable (create one)
Step 0: Discover models
List all available models to find the slug and supported tasks:
curl https://aircube.ai/api/v3/models \
-H "Authorization: Bearer $AIRCUBE_API_KEY"Each entry returns slug, tasks, and price_from_usd. Use slug + tasks[n] to build your submit URL.
Example 1: Text to image
Generate an image with Seedream 5.0 Pro (seedream-v5.0-pro).
cURL
# Submit
curl -X POST https://aircube.ai/api/v3/seedream-v5.0-pro/text-to-image \
-H "Authorization: Bearer $AIRCUBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a photorealistic glass cube refracting light, on a marble surface",
"aspect_ratio": "1:1",
"resolution": "2k"
}'
# Poll (replace ID with the value from the response)
curl https://aircube.ai/api/v3/status/YOUR_GENERATION_ID \
-H "Authorization: Bearer $AIRCUBE_API_KEY"Python
import os, time, requests
API_KEY = os.environ["AIRCUBE_API_KEY"]
BASE = "https://aircube.ai/api/v3"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
# Submit
res = requests.post(f"{BASE}/seedream-v5.0-pro/text-to-image", headers=HEADERS, json={
"prompt": "a photorealistic glass cube refracting light, on a marble surface",
"aspect_ratio": "1:1",
"resolution": "2k",
})
gen_id = res.json()["data"]["id"]
print(f"Submitted: {gen_id}")
# Poll
while True:
result = requests.get(f"{BASE}/status/{gen_id}", headers=HEADERS).json()
status = result["data"]["status"]
print(f"Status: {status}")
if status == "completed":
print(f"Output: {result['data']['output_url']}")
break
elif status == "failed":
print("Generation failed")
break
time.sleep(3)JavaScript
const API_KEY = process.env.AIRCUBE_API_KEY;
const BASE = "https://aircube.ai/api/v3";
// Submit
const submitRes = await fetch(`${BASE}/seedream-v5.0-pro/text-to-image`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
prompt: "a photorealistic glass cube refracting light, on a marble surface",
aspect_ratio: "1:1",
resolution: "2k",
}),
});
const genId = (await submitRes.json()).data.id;
console.log(`Submitted: ${genId}`);
// Poll
while (true) {
const poll = await fetch(`${BASE}/status/${genId}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const { data } = await poll.json();
console.log(`Status: ${data.status}`);
if (data.status === "completed") { console.log(`Output: ${data.output_url}`); break; }
if (data.status === "failed") throw new Error("Generation failed");
await new Promise((r) => setTimeout(r, 3000));
}Example 2: Image to video
Animate a still image with Seedance 2.0 (seedance-2.0).
cURL
curl -X POST https://aircube.ai/api/v3/seedance-2.0/image-to-video \
-H "Authorization: Bearer $AIRCUBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "the cube slowly rotates and light refracts through it",
"image": "https://example.com/your-image.jpg",
"duration": "5",
"resolution": "720p"
}'Python
res = requests.post(f"{BASE}/seedance-2.0/image-to-video", headers=HEADERS, json={
"prompt": "the cube slowly rotates and light refracts through it",
"image": "https://example.com/your-image.jpg",
"duration": "5",
"resolution": "720p",
})
gen_id = res.json()["data"]["id"]
while True:
result = requests.get(f"{BASE}/status/{gen_id}", headers=HEADERS).json()
if result["data"]["status"] == "completed":
print(f"Video: {result['data']['output_url']}")
break
elif result["data"]["status"] == "failed":
print("Failed"); break
time.sleep(5) # Videos take longerJavaScript
const submitRes = await fetch(`${BASE}/seedance-2.0/image-to-video`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
prompt: "the cube slowly rotates and light refracts through it",
image: "https://example.com/your-image.jpg",
duration: "5",
resolution: "720p",
}),
});
const { data } = await submitRes.json();
while (true) {
const poll = await fetch(`${BASE}/status/${data.id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await poll.json();
if (result.data.status === "completed") { console.log(`Video: ${result.data.output_url}`); break; }
if (result.data.status === "failed") throw new Error("Failed");
await new Promise((r) => setTimeout(r, 5000));
}Example 3: Text to speech
Synthesize speech with Qwen3 TTS (qwen3-tts).
cURL
curl -X POST https://aircube.ai/api/v3/qwen3-tts/text-to-speech \
-H "Authorization: Bearer $AIRCUBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "Welcome to AirCube. The unified API for AI generation."}'Python
res = requests.post(f"{BASE}/qwen3-tts/text-to-speech", headers=HEADERS, json={
"prompt": "Welcome to AirCube. The unified API for AI generation.",
})
gen_id = res.json()["data"]["id"]
while True:
result = requests.get(f"{BASE}/status/{gen_id}", headers=HEADERS).json()
if result["data"]["status"] == "completed":
print(f"Audio: {result['data']['output_url']}")
break
elif result["data"]["status"] == "failed":
print("Failed"); break
time.sleep(3)JavaScript
const submitRes = await fetch(`${BASE}/qwen3-tts/text-to-speech`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ prompt: "Welcome to AirCube. The unified API for AI generation." }),
});
const { data } = await submitRes.json();
while (true) {
const poll = await fetch(`${BASE}/status/${data.id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await poll.json();
if (result.data.status === "completed") { console.log(`Audio: ${result.data.output_url}`); break; }
if (result.data.status === "failed") throw new Error("Failed");
await new Promise((r) => setTimeout(r, 3000));
}Next steps
- Submit Generation — full parameter reference by task type.
- Get Result — polling endpoint details and status values.
- Models — all models with slugs, tasks, and pricing.