Available models
For exact prices, see the pricing page (video is billed per token).
Endpoint & auth
- Base URL:
https://www.ruapi.ai/v1 - Auth: header
Authorization: Bearer sk-YOUR_KEY(create one in the console under “Tokens”)
1
Submit a task
POST /v1/videos → returns a task id2
Poll the status
GET /v1/videos/{id} → until status becomes completed3
Download the video
GET /v1/videos/{id}/content → get the MP4Step 1. Submit a task (text-to-video)
id is the task number, used in the next two steps):
Step 2. Poll the status
Query theGET /v1/videos/{id} route about every 5 seconds. status goes through queued → in_progress → completed.
metadata.url is the download link):
Step 3. Download the video
Full example: the whole flow in one script
Copy-paste and run, replacingsk-YOUR_KEY with your own key:
Python
Parameters
Top-level fields:
Fields inside
metadata:
Higher resolution and longer duration use more tokens and cost more. If unsure, start with
480p / 5 seconds, then tune.The four input modes
input_type usually doesn’t need to be set — it’s inferred from the number of images/videos; you can also set it explicitly via metadata.input_type.
Images / videos must be publicly reachable URLs (the upstream fetches them); images support JPG / PNG / WebP, videos support MP4. base64 inline is not supported (an oversized request body will fail).
Mode 1. Text-to-video
Just a textprompt — generated entirely from the description.
Mode 2. Image-to-video (1 image)
Put 1 image URL inmetadata.images; it’s used as the basis to animate. Describe the motion / camera in prompt.
Mode 3. First-last frame (2 images)
Put 2 images inmetadata.images: the 1st = start frame, the 2nd = end frame. It generates a smooth transition from the first to the second.
Mode 4. Reference-video (1 video)
Put 1 short video URL inmetadata.videos; the model reinterprets it while keeping the subject’s motion (e.g. restyle or change the scene).
Advanced: multiple images / videos
images and videos are arrays — you can pass several references at once (both verified):
- Multiple images: put 3 or more images in
images(officially up to 9). The model combines subject / scene / style across them. With 3+ images,input_typeis auto-detected asreference. - Multiple videos: put 2 or more clips in
videos(officially up to 3, total duration ≤ 15 seconds).
Same for videos: replace
images with videos and pass several short clips (each ideally ≤ 7 seconds with a clear subject, ≤ 15 seconds total).Task statuses
Billing
Video is billed per token (resolution × duration). A pre-charge is held on submit, then recalculated by actual usage on completion — the difference is refunded. The final charge is what actually got deducted. See the pricing page.FAQ
model_not_found / 404 error
model_not_found / 404 error
Check two things: is the
model name correct (doubao-seedance-2.0-fast), and is the address https://www.ruapi.ai/v1/videos (with /v1).Stuck on queued / in_progress
Stuck on queued / in_progress
That’s normal. Generation usually takes 1–3 minutes; keep polling and don’t set the interval too short.
Downloaded file is empty / won't open
Downloaded file is empty / won't open
It’s likely been more than 7 days and the upstream link expired. Download right after generation.
Reference-video task failed
Reference-video task failed
This mode is picky about input. Make sure the reference video is ≤ 15 seconds, has a clear subject, and is a publicly reachable MP4. Cartoons or clips without an obvious subject often fail.
Which address do I poll?
Which address do I poll?
Use the plural
GET /v1/videos/{id}. It’s the OpenAI-compatible format, and metadata.url in the response is directly the download link.Next
- Pricing & billing rules
- Questions? [email protected]