Getting Started
Quickstart
End-to-end examples for image, video, and audio generation with the AirCube API.
This guide walks through 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 stored in the
AIRCUBE_API_KEYenvironment variable (create one)
Example 1: Text to image
Generate an image with Seedream 5.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"
}'
# 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
import time
import requests
API_KEY = os.environ["AIRCUBE_API_KEY"]
BASE_URL = "https://aircube.ai/api/v3"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
# Submit
response = requests.post(
f"{BASE_URL}/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",
},
)
data = response.json()
generation_id = data["data"]["id"]
print(f"Generation submitted: {generation_id}")
# Poll until completed
while True:
result = requests.get(
f"{BASE_URL}/status/{generation_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_URL = "https://aircube.ai/api/v3";
async function generateImage() {
// Submit
const submitRes = await fetch(
`${BASE_URL}/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",
}),
}
);
const { data } = await submitRes.json();
const generationId = data.id;
console.log(`Generation submitted: ${generationId}`);
// Poll until completed
while (true) {
const pollRes = await fetch(`${BASE_URL}/status/${generationId}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await pollRes.json();
const status = result.data.status;
console.log(`Status: ${status}`);
if (status === "completed") {
console.log(`Output: ${result.data.output_url}`);
return result.data;
} else if (status === "failed") {
throw new Error("Generation failed");
}
await new Promise((r) => setTimeout(r, 3000));
}
}
generateImage();Example 2: Image to video
Create a video from a source image with Seedance 2.0.
cURL
# Submit
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"
}'
# Poll
curl https://aircube.ai/api/v3/status/YOUR_GENERATION_ID \
-H "Authorization: Bearer $AIRCUBE_API_KEY"Python
# Submit
response = requests.post(
f"{BASE_URL}/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",
},
)
generation_id = response.json()["data"]["id"]
# Poll until completed
while True:
result = requests.get(
f"{BASE_URL}/status/{generation_id}",
headers=HEADERS,
).json()
if result["data"]["status"] == "completed":
print(f"Video: {result['data']['output_url']}")
break
elif result["data"]["status"] == "failed":
print("Generation failed")
break
time.sleep(5) # Videos take longer; poll every 5 secondsJavaScript
async function generateVideo() {
const submitRes = await fetch(`${BASE_URL}/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",
}),
});
const { data } = await submitRes.json();
while (true) {
const pollRes = await fetch(`${BASE_URL}/status/${data.id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await pollRes.json();
if (result.data.status === "completed") {
console.log(`Video: ${result.data.output_url}`);
return result.data;
} else if (result.data.status === "failed") {
throw new Error("Generation failed");
}
await new Promise((r) => setTimeout(r, 5000));
}
}Example 3: Text to speech
Generate speech with Qwen3 TTS.
cURL
# Submit
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."
}'
# Poll
curl https://aircube.ai/api/v3/status/YOUR_GENERATION_ID \
-H "Authorization: Bearer $AIRCUBE_API_KEY"Python
# Submit
response = requests.post(
f"{BASE_URL}/qwen3-tts/text-to-speech",
headers=HEADERS,
json={
"prompt": "Welcome to AirCube. The unified API for AI generation.",
},
)
generation_id = response.json()["data"]["id"]
# Poll until completed
while True:
result = requests.get(
f"{BASE_URL}/status/{generation_id}",
headers=HEADERS,
).json()
if result["data"]["status"] == "completed":
print(f"Audio: {result['data']['output_url']}")
break
elif result["data"]["status"] == "failed":
print("Generation failed")
break
time.sleep(3)JavaScript
async function generateSpeech() {
const submitRes = await fetch(`${BASE_URL}/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 pollRes = await fetch(`${BASE_URL}/status/${data.id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await pollRes.json();
if (result.data.status === "completed") {
console.log(`Audio: ${result.data.output_url}`);
return result.data;
} else if (result.data.status === "failed") {
throw new Error("Generation failed");
}
await new Promise((r) => setTimeout(r, 3000));
}
}Next steps
- Submit Generation — full parameter reference for the submit endpoint.
- Get Result — polling endpoint details and status values.
- Models — browse all available models and task types.