Video
Text to video
Make your first video from a text prompt: create the task, wait for it and download it, with curl, Python and JavaScript examples.
This page uses NURETA_URL, NURETA_KEY and the wait_task helper from Get started.
The cheapest video: seedance2.0-fast at 480p, 5 seconds, $0.33. It sends your prompt to Seedance as written.
- Create the task:
TASK=$(curl -s -X POST "$NURETA_URL/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $NURETA_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance2.0-fast",
"resolution": "480p",
"duration": 5,
"ratio": "16:9",
"content": [{"type": "text", "text": "A woman in a red dress walks along a beach at sunset, slow camera follow"}]
}')
printf '%s' "$TASK" | jq '{id, status, price_usd: .usage.price_usd}'
TASK_ID=$(printf '%s' "$TASK" | jq -r .id)Response (201):
{"id": "cgt-20261125...", "status": "queued", "price_usd": 0.33}- Wait for it. A 5-second clip usually takes 5 to 20 minutes, longer when many tasks are waiting.
DONE=$(wait_task "$NURETA_URL/api/v3/contents/generations/tasks/$TASK_ID")
printf '%s' "$DONE" | jq '{status, video: .content.video_url, error, expires_at}'- Download the video. The link is valid for up to 7 days, and the video is deleted 60 days after you created the task (
expires_at).
curl -s -o first-video.mp4 "$(printf '%s' "$DONE" | jq -r .content.video_url)"The same in Python
import os, time, requests
BASE = os.environ.get("NURETA_URL", "https://developer.nureta.ai")
HEADERS = {"Authorization": f"Bearer {os.environ['NURETA_KEY']}"}
def create_and_wait(route: str, body: dict, every: float = 10) -> dict:
"""Create a task on `route`, poll it until it is finished, and return the task view."""
r = requests.post(f"{BASE}{route}", json=body, headers=HEADERS, timeout=60)
if r.status_code != 201:
raise RuntimeError(f"{r.status_code}: {r.json()['error']}")
task = r.json()
while task["status"] not in ("succeeded", "failed", "cancelled", "planned"):
time.sleep(every)
task = requests.get(f"{BASE}{route}/{task['id']}", headers=HEADERS, timeout=60).json()
return task
task = create_and_wait("/api/v3/contents/generations/tasks", {
"model": "seedance2.0-fast", "resolution": "480p", "duration": 5,
"content": [{"type": "text", "text": "A woman in a red dress walks along a beach at sunset"}],
})
if task["status"] == "succeeded":
with open("first-video.mp4", "wb") as f:
f.write(requests.get(task["content"]["video_url"], timeout=300).content)
else:
print("failed:", task["error"]) # the price was refundedThe same helper works for images (/api/v3/images/generations/tasks) and scripts (/api/v3/contents/scripts).
The same in JavaScript (Node.js 18+)
const BASE = process.env.NURETA_URL ?? "https://developer.nureta.ai";
const HEADERS = { Authorization: `Bearer ${process.env.NURETA_KEY}`, "Content-Type": "application/json" };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function createAndWait(route, body) {
const res = await fetch(`${BASE}${route}`, { method: "POST", headers: HEADERS, body: JSON.stringify(body) });
let task = await res.json();
if (res.status !== 201) throw new Error(`${res.status}: ${JSON.stringify(task.error)}`);
while (!["succeeded", "failed", "cancelled", "planned"].includes(task.status)) {
await sleep(10_000);
task = await (await fetch(`${BASE}${route}/${task.id}`, { headers: HEADERS })).json();
}
return task;
}
const task = await createAndWait("/api/v3/images/generations/tasks", {
model: "seahorse-image",
content: [{ type: "text", text: "a woman in a red dress on a balcony at sunset, photo" }],
});
console.log(task.status, task.content?.image_url ?? task.error);Save it as nureta.mjs and run node nureta.mjs.
Common errors
| You get | Why | Fix |
|---|---|---|
403 AccountOverdueError | Your balance is lower than the price. | Add funds. |
400 InvalidParameter "duration must be one of 5, 8, 10, 12, 15 …" | A direct Seedance model takes only single clips. | Use 5, 8, 10, 12 or 15, or a seahorse-* model for 16–300 s. |
400 InvalidParameter about resolution | seedance2.0-fast, seedance2.0-pro and seedance2.5-flash take only 480p or 720p. | Use one of them, or seedance2.5 for 1080p and 4k. |
429 RateLimitExceeded | More than 10 requests per second on this key. | Poll every 5–10 s, not in a tight loop. |
The task ends failed with prompt_policy_rejected or content_filter_rejected | The content policy blocked the prompt or the output. | Change the prompt. You were refunded. |