This duck helps you produce a video with Seedance2.0 in one command — give it a prompt, and the server generates a MP4 and returns it to you. No need to build your own generation pipeline, pay per use, and get back a direct video link.
Calls go through doubaoya.com as one line, authentication uses your own token (environment variable
DOUBAOYA_API_KEY, in the formdyh_…)。
⏳ This is an asynchronous slow operation, and at its slowest: the video is generated on the server,up to about 20 minutes, and is returned in one go within a single request —no client-side polling needed, after sending one POST be sure towait patiently, and do not interrupt it midway.
Use cases
| Scenario | How to use | What you get |
|---|---|---|
| Text-to-video | Give a visual prompt | A direct MP4 video link |
| Produce dynamic assets | Describe the camera movement and subject | A downloadable video clip |
| Adjust duration | Add --duration to specify seconds |
A video with the specified duration |
| Try multiple versions | Run several times with different prompts | Multiple candidate videos |
Workflow (3 steps)
1. Write the prompt (optionally set the duration)
Convert the user's needs into a clear video visual prompt, and determine the duration if necessary (default 6 seconds).
2. Call the script (be sure to wait patiently, up to about 20 minutes)
python3 "$SKILL_PATH/scripts/generate_video.py" "一只鸭子在霓虹城市夜景中滑板穿行,电影级运镜"
Specify duration:
python3 "$SKILL_PATH/scripts/generate_video.py" "海浪缓缓拍打沙滩,日落金光" --duration 6
The script will first print "Submitted, generating on the server" to stderr, thenwait for a long time(up to about 20 minutes) until the result is returned, and print the data from the success envelope to stdout as JSON.For each video generation, run the script only once, do not interrupt it midway, and do not call it repeatedly — it really will run for a long time.
3. Render the video
From data , take the fields and dodefensive reading——videoUrl(direct video link) / duration(duration) may be missing; if missing, indicate that no result was obtained. Simply give the direct video link to the user.
Get the key (token)
- Open doubaoya.com
- Log in
- Go to Token Center
- Generate token(in the form
dyh_…)
Configure it in the environment variable (the script only recognizes this one):
export DOUBAOYA_API_KEY="dyh_你的口令"
Iron rule: never print the token, never write it to a file, never echo it back to the user. The script itself also never outputs the token. All requests are sent only to doubaoya.com。
Interface and envelope
POST https://doubaoya.com/api/skills/seedance-video-gen/invoke- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "prompt": "<提示词>", "duration": 6 }prompt: string, requiredduration: integer, optional (default 6, controlled by--duration)
- Asynchronous slow operation (up to about 20 minutes): returned within this request after the server finishes generating, no polling needed.
- Return envelope:
{ "success": true, "requestId": "...", "data": { "videoUrl": "https://...mp4", "duration": 6 }, "error": null } - First check
success: readtrueonly ifdata; otherwise readerror.code/error.message。
Error handling
When the script fails, print to stderr [error] CODE: message and exit with code 1. Common cases:
| HTTP | code | Meaning | Handling |
|---|---|---|---|
| 401 | MISSING_API_KEY / UNAUTHORIZED |
No passphrase provided or invalid passphrase | Check DOUBAOYA_API_KEY, regenerate it in the passphrase center |
| 400 | VALIDATION_ERROR |
Invalid parameters (e.g., empty prompt, invalid duration) | Fix the parameters and retry |
| 402 | INSUFFICIENT_CREDITS |
Insufficient quota | Top up/renew quota at doubaoya.com |
| 502 | PROVIDER_FAILED |
Temporary upstream failure (automatically refunded) | safe to retry |
502 PROVIDER_FAILEDwill automatically refund; retrying is safe and will not double-charge.
Directory structure
seedance-video-gen/
├── SKILL.md # 本文件
└── scripts/
└── generate_video.py # 零依赖脚本(urllib),调用 doubaoya.com