Generation examples

Ready-to-use JSON for all four models and common video settings.

Save one of the following JSON bodies as request.json. Set BASE_URL and API_KEY as in Connect. Each POST can create a billable task; save the returned ID and use Results for status and downloads.

Text to video

json
{
  "model": "seedance-2.5",
  "generate_audio": false,
  "prompt": "A paper boat glides across a quiet lake at sunrise, one continuous shot.",
  "seconds": "5",
  "size": "1280x720"
}

Create once

bash
curl --fail --silent --show-error --max-time 120 \
  "$BASE_URL/v1/videos" \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' --data-binary @request.json \
  -o created.json
jq -r '.id' created.json

If creation times out before you receive an ID, inspect the account or ask support before another POST. For automatic recovery and resume, use Integration.

Official SDKs: text to video

These minimal examples create a task through the Videos methods in the official Python and Node.js SDKs. Set BASE_URL to your HTTPS origin without /v1 and API_KEY as in Connect. The SDK appends /videos to the configured /v1 path. Each run can create a billable task; save id before continuing.

Python (openai):

python
import json
import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ["BASE_URL"].rstrip("/") + "/v1",
    api_key=os.environ["API_KEY"],
    max_retries=0,
)
video = client.videos.create(
    model="seedance-2.0",
    prompt="A red toy car moves slowly across a white table",
    seconds="4",
    size="1280x720",
)
with open("seedance-task.json", "w", encoding="utf8") as file:
    json.dump({"id": video.id}, file)
print(video.id)

Node.js (openai):

javascript
import OpenAI from "openai";
import { writeFile } from "node:fs/promises";

const client = new OpenAI({
  baseURL: process.env.BASE_URL.replace(/\/+$/, "") + "/v1",
  apiKey: process.env.API_KEY,
  maxRetries: 0,
});
const video = await client.videos.create({
  model: "seedance-2.0",
  prompt: "A red toy car moves slowly across a white table",
  seconds: "4",
  size: "1280x720",
});
await writeFile("seedance-task.json", JSON.stringify({ id: video.id }));
console.log(video.id);

max_retries=0 and maxRetries: 0 disable the SDK's default retries for the creation POST. If the response is lost and the outcome is unknown, inspect the account or ask support before another POST. These examples cover text creation only. The SDK method does not imply support for its full current schema: the input_reference field here supports only a scalar HTTPS URL. The object and file forms of input_reference in current SDKs, as well as arrays, repeated fields and nested multipart structures for that field, are unsupported. This limit does not apply to the JSON extensions documented in References: image_urls, video_urls and audio_urls accept URL arrays, while image_with_roles accepts an array of role objects.

Create with a webhook

Add your public HTTPS handler URL to the same request.json:

json
{
  "model": "seedance-2.5",
  "resolution": "720p",
  "generate_audio": false,
  "callback_url": "CALLBACK_URL",
  "prompt": "A paper boat glides across a quiet lake.",
  "seconds": "5"
}

Creation still returns a task ID. A separate POST delivers the final result to callback_url; see the notification format and handling sequence.

Scenario bodies

Video with the final output frame as JPEG:

json
{
  "model": "seedance-2.0",
  "resolution": "720p",
  "generate_audio": false,
  "return_last_frame": true,
  "prompt": "A ceramic cup rotates slowly on a table, stable lighting.",
  "seconds": "5",
  "aspect_ratio": "1:1"
}

After completion, use content.last_frame_url from the task response. You can also add the flag to a request with callback_url.

Portrait with sound:

json
{
  "model": "seedance-2.5",
  "generate_audio": true,
  "prompt": "A cyclist crosses a rainy street at dusk. Gentle tire sounds; one continuous shot.",
  "seconds": "10",
  "size": "720x1280"
}

Square 1080p:

json
{
  "model": "seedance-2.0",
  "resolution": "1080p",
  "prompt": "A ceramic cup rotates slowly on a table, stable lighting.",
  "seconds": "12",
  "aspect_ratio": "1:1"
}

Automatic duration on 2.5 only:

json
{
  "model": "seedance-2.5",
  "resolution": "720p",
  "prompt": "A small kite rises above a beach.",
  "seconds": "-1"
}

Mini and Fast require text. If an audio reference is included, they also require an image or video. For media roles, mixed references, edit, extend and draft examples see References. Access to those modes depends on your connection and key.