Dreamina video generation
The Dreamina model matrix, a full request-parameter reference, and the submit-poll-download flow.
Dreamina is an asynchronous video task API: submit a task, get a task ID, poll for progress, and download the MP4 when it completes. One ai:video Key covers the whole flow — the gateway handles authentication, routing, billing, and storing the finished file.
Choosing a model
The model ID encodes everything you need, so you rarely have to look anything up:
dreamina-seedance-2.0-fast : 720p -ref
└──────── model family ───┘ └tier┘ └input mode┘- Family —
2.0-fastis quicker and cheaper per second;2.0has better quality and is the only family offering 1080p and 4K. - Tier — output resolution, which also sets the per-second price.
-refsuffix — a-refmodel is image-to-video and requiresinput_reference; without it the model is text-to-video. These are two separate model IDs, not a toggle.
A text-to-video model does not become image-to-video just because you passed input_reference — the reference is ignored upstream. To use a reference frame, the model ID must end in -ref.
Model matrix
Billed per second of video (meter video_seconds, unit: second). Pricing is not listed here — the model discovery and catalog endpoint is the authoritative source for your organization's actual rate. Models your organization has not enabled return 403.
| Model ID | Input | Output tier |
|---|---|---|
dreamina-seedance-2.0-fast:480p | Text-to-video | 480p |
dreamina-seedance-2.0-fast:480p-ref | Image-to-video | 480p |
dreamina-seedance-2.0-fast:720p | Text-to-video | 720p |
dreamina-seedance-2.0-fast:720p-ref | Image-to-video | 720p |
dreamina-seedance-2.0:480p | Text-to-video | 480p |
dreamina-seedance-2.0:480p-ref | Image-to-video | 480p |
dreamina-seedance-2.0:720p | Text-to-video | 720p |
dreamina-seedance-2.0:720p-ref | Image-to-video | 720p |
dreamina-seedance-2.0:1080p | Text-to-video | 1080p |
dreamina-seedance-2.0:1080p-ref | Image-to-video | 1080p |
dreamina-seedance-2.0:4k | Text-to-video | 4K |
dreamina-seedance-2.0:4k-ref | Image-to-video | 4K |
dreamina-seedance-2.0:test | Integration testing | Lowest |
2.0-fast:480p is the cheapest production tier; 2.0:test exists only to validate wiring and should not be used for real output.
Which one to pick
- Validating the integration →
dreamina-seedance-2.0:test - High volume, cost sensitive →
dreamina-seedance-2.0-fast:480p - Standard deliverable output →
dreamina-seedance-2.0:720p - Need a reference frame / consistent subject → switch to
-refat the same tier and passinput_reference - 1080p / 4K → only the
2.0family offers them
Before you start
Create a Key in the ai.tos.run console and grant it the ai:video scope:
export TOS_API_KEY="gk_YOUR_KEY"Every request uses:
Authorization: Bearer $TOS_API_KEYEndpoints
| Operation | Endpoint |
|---|---|
| Dedicated Dreamina create / poll / download | POST /dreamina/v1/video · GET /dreamina/v1/video/{task_id} · GET /dreamina/v1/video/{task_id}/content |
| OpenAI-compatible create / poll / download | POST /v1/videos · GET /v1/videos/{task_id} · GET /v1/videos/{task_id}/content |
Both entries share task, authentication, billing, and response contracts. The dedicated entry always uses Dreamina; the OpenAI-compatible entry routes by model and is the recommended choice for new integrations.
Request parameters
The gateway validates only model and prompt — every other field is forwarded to the Dreamina upstream as-is. The table marks who handles each field, so you can tell a gateway rejection from an upstream one.
Send only model; do not include any service-selection field. The gateway picks a service from the API Key organization's routing policy and performs failover.
| Field | Type | Required | Handled by | Notes |
|---|---|---|---|---|
model | string | Yes | Gateway | Full ID from the matrix, including the :tier and optional -ref suffix |
prompt | string | Yes | Gateway | Empty returns 400 immediately; nothing is sent upstream |
input_reference | string | Yes for -ref models | Gateway rewrites | One publicly reachable http(s) URL. The gateway renames it to image before forwarding |
duration | number | No | Forwarded + billed | Video length in seconds. Aliases duration_seconds and seconds, resolved in that order |
ratio | string | No | Forwarded | Aspect ratio, e.g. "16:9". Accepted values are decided upstream |
duration also drives billing: charges are video_seconds × unit price. If none of the three aliases yields a valid duration, the gateway bills 5 seconds. Dreamina currently requires at least 4 seconds.
Fields not listed here (new upstream parameters, for example) travel with the request body untouched — the gateway neither validates nor rewrites them.
Text-to-video
curl --noproxy '*' "https://ai.tos.run/dreamina/v1/video" \
-H "Authorization: Bearer $TOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2.0-fast:480p",
"prompt": "A product showcase video with a slow dolly-in",
"duration": 4,
"ratio": "16:9"
}'Keep the id from the response — polling and downloading both use this task ID:
{
"id": "job_123456",
"task_id": "job_123456",
"object": "video",
"model": "dreamina-seedance-2.0-fast:480p",
"status": "queued",
"progress": 0,
"metadata": {}
}Image-to-video
Switch to a -ref model ID and pass one publicly reachable http:// or https:// URL in input_reference.
curl --noproxy '*' "https://ai.tos.run/dreamina/v1/video" \
-H "Authorization: Bearer $TOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2.0-fast:480p-ref",
"prompt": "Animate the subject from the reference frame into a natural product showcase",
"input_reference": "https://example.com/product-front.png",
"duration": 4
}'The reference must be:
- A string, not an array. An array returns 400
参考图片格式无效,请提供一张图片. Dreamina accepts exactly one reference image per task. - A publicly downloadable URL. Material-library references are not supported — do not pass
asset://.... - Reachable for the whole run. The upstream fetches the URL while generating; an early expiry fails the task.
The response format matches text-to-video.
OpenAI-compatible entry
The same case works against the standard /v1/videos with an identical body:
curl --noproxy '*' "https://ai.tos.run/v1/videos" \
-H "Authorization: Bearer $TOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2.0-fast:480p-ref",
"prompt": "The runner moves left to right with alternating strides and natural arm swing; no freeze frame.",
"input_reference": "https://example.com/runner.png",
"duration": 4
}'{
"id": "97120312-8053-4c7b-b1dd-4c392dddbeb6",
"task_id": "97120312-8053-4c7b-b1dd-4c392dddbeb6",
"object": "video",
"model": "dreamina-seedance-2.0-fast:480p-ref",
"status": "queued",
"progress": 20,
"created_at": 1785923067,
"expires_at": 1786527867,
"metadata": {}
}Polling and download
Response fields
| Field | Notes |
|---|---|
id / task_id | Gateway task ID, used for polling and download. Distinct from the upstream task ID — do not mix them |
status | queued → processing → completed / failed |
progress | 0–100. Display only; never use it to decide a task is done |
created_at / completed_at | Unix seconds |
expires_at | Retention deadline; metadata.url stops serving after it |
metadata.url | Present once status is completed — the gateway-side output URL |
status is the only terminal-state signal: completed or failed.
curl --noproxy '*' "https://ai.tos.run/dreamina/v1/video/job_123456" \
-H "Authorization: Bearer $TOS_API_KEY"{
"id": "job_123456",
"task_id": "job_123456",
"object": "video",
"model": "dreamina-seedance-2.0-fast:480p-ref",
"status": "completed",
"progress": 100,
"completed_at": 1785923670,
"metadata": {
"url": "https://ai.tos.run/api/files/serve/generated-videos/job_123456/output.mp4"
}
}Downloading the result
Once complete, download the stored MP4 through the gateway and confirm the size from the actual byte count:
curl --noproxy '*' -L "https://ai.tos.run/dreamina/v1/video/job_123456/content" \
-H "Authorization: Bearer $TOS_API_KEY" \
-o output.mp4
wc -c < output.mp4The content endpoint returns video/mp4. While the task is still running it returns 409 — keep polling the same task ID. On the OpenAI-compatible entry, swap the path for /v1/videos/{task_id}/content.
metadata.url also works directly as a server URL; the download size comes from the actual Content-Length response header. Output is retained for a limited window — collect it before expires_at.
Errors and retries
| Status | Meaning | What to do |
|---|---|---|
400 | Empty prompt, invalid reference format, or an upstream-rejected parameter | Fix the request per the response message; do not retry |
401 | Key missing, invalid, or revoked | Check the Authorization header |
403 | Key lacks ai:video, or the organization has not enabled the model | Verify Key scope and model access in the console |
409 | Task not finished yet | Keep polling the same task ID |
502 / 503 | Video service temporarily unavailable | Retry with exponential backoff |
Related
Video Generation and Material Library API
Create video tasks, manage reference materials, and retrieve generated results using the Volcano Engine-compatible format.
Other video models
Parameters, sizes, aspect ratios, and input/output reference for Hailuo 3, Grok Imagine, Kling, Veo, Gemini Omni, and Motion.