Tutorial
Seedance 2.5 Text-to-Video API: curl and Python Guide
Generate 4–30 second clips with native sound from one prompt: working code, the input schema, per-second pricing, and production tips.
- 720p / second
- $0.204
- 1080p / second
- $0.516
- Clip length
- 4–30 s
TL;DR
seedance-2.5/text-to-videoturns a single prompt into a 4–30 second video with native sound. You can try it in the browser on the model page or call it through the API.- It is billed per second: $0.204 at 720p and $0.516 at 1080p. A 5-second 720p clip costs $1.02.
- The API is two calls:
POST /v1/tasksto submit, thenGET /v1/tasks/{taskId}for the result. The curl and Python below run as-is.
What it produces
This 8-second 720p clip came from one prompt and one request. The milk steaming, cups clinking, and café chatter were all generated by the model:
A barista in a small morning cafe pours steamed milk into a cup, drawing a latte art leaf.
The camera starts on her hands and slowly pulls back to reveal the counter and a sign on the wall that reads 'OPEN'.
Warm window light, realistic, smooth motion. Sound: milk steaming, cups clinking, quiet cafe chatter.
Generate with this prompt → (8 seconds, 720p)
seedance-2.5/text-to-video, 720p, 8 seconds, with sound, $1.632.
curl: your first clip
A 5-second 720p clip, $1.02:
curl -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer $HIAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5/text-to-video",
"input": {
"prompt": "A paper airplane glides through a sunlit office, dust drifting in the light, the camera following it slowly",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}'
The response comes back immediately with a task id:
{"code": 200, "data": {"taskId": "tk-hiapi-..."}, "message": "success"}
Check the result:
curl https://api.hiapi.ai/v1/tasks/tk-hiapi-... \
-H "Authorization: Bearer $HIAPI_KEY"
While the clip renders, status is handling. When it is success, the video URL is in output[0].url.
Python: submit, poll, download
# pip install requests; export HIAPI_KEY=your-key
import os, time, uuid, requests
KEY = os.environ["HIAPI_KEY"]
H = {"Authorization": f"Bearer {KEY}"}
def generate(prompt, model="seedance-2.5/text-to-video", timeout_s=900, **params):
body = {"model": model, "input": {"prompt": prompt, **params}}
# Reuse the same Idempotency-Key if you retry this submission, so it is billed once
headers = {**H, "Idempotency-Key": str(uuid.uuid4())}
r = requests.post("https://api.hiapi.ai/v1/tasks", json=body, headers=headers, timeout=30)
r.raise_for_status()
res = r.json()
if res.get("code") != 200:
raise RuntimeError(res)
task_id = res["data"]["taskId"]
deadline = time.time() + timeout_s
while time.time() < deadline:
d = requests.get(f"https://api.hiapi.ai/v1/tasks/{task_id}", headers=H, timeout=30).json()["data"]
if d["status"] == "success":
return d["output"][0]["url"]
if d["status"] == "fail":
raise RuntimeError(d)
time.sleep(10)
raise TimeoutError(task_id)
url = generate(
"A paper airplane glides through a sunlit office, dust drifting in the light, the camera following it slowly",
duration=5, resolution="720p", aspect_ratio="16:9",
)
with open("clip.mp4", "wb") as f:
f.write(requests.get(url).content)
Input schema
| Field | Values | Notes |
|---|---|---|
prompt |
string, required | English, Chinese, and several other languages |
duration |
integer 4–30, default 5 | Seconds; billed per second |
resolution |
720p / 1080p, default 720p |
1080p costs about 2.5× as much per second |
aspect_ratio |
16:9 4:3 1:1 3:4 9:16 21:9 adaptive, default adaptive |
Use 9:16 for vertical feeds |
generate_audio |
default true |
Sound is generated together with the picture |
output_format |
mp4 / mov |
|
watermark |
default false |
The schema is strict, so unknown fields such as seed, negative_prompt, or ratio are rejected with HTTP 400. Text-to-video takes no image or video URLs. To start from an image, use Seedance 2.5 image-to-video; to follow the camera and motion of an existing clip, use Seedance 2.5 reference-to-video.
Cost
| Duration | 720p ($0.204/s) | 1080p ($0.516/s) |
|---|---|---|
| 5 s | $1.02 | $2.58 |
| 10 s | $2.04 | $5.16 |
| 15 s | $3.06 | $7.74 |
| 30 s | $6.12 | $15.48 |
$10 buys about 49 seconds at 720p. Tune the prompt on short 720p clips first, then render the final cut at 1080p. More detail in Seedance 2.5 API pricing.
Before you ship
- Use a callback instead of polling. Add
"callback": {"url": "https://your-app.example.com/hiapi/callback"}at the top level of the request (next toinput). HiAPI notifies you once the task finishes; deduplicate bytaskId. - Save the output right away.
output[0].urlis temporary (kept for about 7 days by default), so copy the file to your own storage. - Send an
Idempotency-Keyheader. Retrying with the same key creates the task only once and returns the originaltaskId, so a timeout never bills you twice. - Set every parameter explicitly. Pass
duration,resolution, andaspect_ratioso cost and framing match your budget. - Failed tasks are refunded. You pay only for videos that generate successfully.
FAQ
How long can a Seedance 2.5 video be?
4 to 30 seconds per task, twice the 15-second limit of Seedance 2.0. That's enough for a single continuous shot.
Does turning off sound make it cheaper?
No. generate_audio: false removes the soundtrack, but the price depends only on resolution and duration.
What does a 401 error mean?
permission_denied means the key is wrong, revoked, or not allowed to use this model. Check it in the API keys dashboard.
Seedance 2.5 or Seedance 2.0?
Pick 2.5 for longer single shots and more reference inputs. Pick the 2.0 ext route ($0.134/s at 720p) when budget matters most or you need 4K. See Seedance 2.5 vs 2.0.
Copy the latte prompt above and run it on the model page, or read the Seedance 2.5 user guide for more prompt patterns.
Related articles
View all articles →-
Tutorial
How to Call hailuo-2.3-fast/image-to-video via the HiAPI API: curl and Python
A first working request for the fast, low-cost image-to-video tier — from model ID to downloaded MP4
9 min read -
Tutorial
How to Use hailuo-2.3/text-to-video via the HiAPI API: curl, Python, and a Working Request
11 min read -
Tutorial
Kandinsky 6.0 Pro Text-to-Video on HiAPI: curl and Python Tutorial
A request-first walkthrough: build the prompt-to-clip call, submit it, poll for completion, and download the result
11 min read