HappyHorse 1.0 Text-to-Video
Validation
mkdir -p output/aliyun-happyhorse-t2v
python -m py_compile skills/ai/video/aliyun-happyhorse-t2v/scripts/t2v_happyhorse.py && echo "py_compile_ok" > output/aliyun-happyhorse-t2v/validate.txt
Pass criteria: command exits 0 and output/aliyun-happyhorse-t2v/validate.txt is generated.
Output And Evidence
- Save task IDs, polling responses, and final video URLs to
output/aliyun-happyhorse-t2v/.
- Keep at least one end-to-end run log for troubleshooting.
Prerequisites
- Install dependencies (recommended in a venv):
python3 -m venv .venv
. .venv/bin/activate
python -m pip install requests
- Set
DASHSCOPE_API_KEY in your environment, or add dashscope_api_key to ~/.alibabacloud/credentials.
Critical model names
happyhorse-1.0-t2v — text-to-video, supports resolution, ratio, duration, watermark and seed control
Capabilities
| Capability |
Description |
Required input |
| Text-to-video |
Generate a physically realistic video from a text prompt only |
prompt |
API endpoint (async only)
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
Required headers:
Authorization: Bearer $DASHSCOPE_API_KEY
Content-Type: application/json
X-DashScope-Async: enable
Singapore endpoint: replace dashscope.aliyuncs.com with dashscope-intl.aliyuncs.com.
Polling endpoint: GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id} — recommended interval 15s.
Normalized interface
Request
model (string, required) — fixed happyhorse-1.0-t2v
input.prompt (string, required) — up to 5000 non-CJK characters or 2500 CJK characters; longer is truncated
parameters.resolution (string, optional) — 720P or 1080P (default: 1080P)
parameters.ratio (string, optional) — 16:9 (default), 9:16, 1:1, 4:3, 3:4
parameters.duration (integer, optional) — video length in seconds, range [3, 15] (default: 5)
parameters.watermark (boolean, optional) — add bottom-right "Happy Horse" watermark (default: true)
parameters.seed (integer, optional) — range [0, 2147483647]
Response (task creation)
output.task_id (string) — use for polling, valid 24 hours
output.task_status (string) — PENDING | RUNNING | SUCCEEDED | FAILED | CANCELED | UNKNOWN
request_id (string)
Response (task result, on SUCCEEDED)
output.video_url (string) — generated MP4 (H.264) URL, valid 24 hours
output.orig_prompt (string)
output.submit_time / output.scheduled_time / output.end_time (string)
usage.duration (integer) — billable duration in seconds
usage.output_video_duration (integer)
usage.SR (integer) — output resolution tier
usage.ratio (string)
usage.video_count (integer) — fixed 1
Quick start (Python + HTTP)
import os
import time
import requests
API_KEY = os.getenv("DASHSCOPE_API_KEY")
BASE_URL = "https://dashscope.aliyuncs.com/api/v1"
def create_t2v_task(req: dict) -> str:
"""Create a text-to-video task and return task_id."""
payload = {
"model": "happyhorse-1.0-t2v",
"input": {"prompt": req["prompt"]},
"parameters": {
"resolution": req.get("resolution", "1080P"),
"ratio": req.get("ratio", "16:9"),
"duration": req.get("duration", 5),
"watermark": req.get("watermark", True),
},
}
if req.get("seed") is not None:
payload["parameters"]["seed"] = req["seed"]
resp = requests.post(
f"{BASE_URL}/services/aigc/video-generation/video-synthesis",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
"X-DashScope-Async": "enable",
},
json=payload,
)
resp.raise_for_status()
return resp.json()["output"]["task_id"]
def poll_task(task_id: str, interval: int = 15) -> dict:
while True:
resp = requests.get(
f"{BASE_URL}/tasks/{task_id}",
headers={"Authorization": f"Bearer {API_KEY}"},
)
resp.raise_for_status()
data = resp.json()
if data["output"]["task_status"] in ("SUCCEEDED", "FAILED", "CANCELED"):
return data
time.sleep(interval)
Usage examples
# Minimal — pure text prompt
task_id = create_t2v_task({
"prompt": "一座由硬纸板和瓶盖搭建的微型城市,在夜晚焕发出生机。",
"duration": 5,
})
# Vertical short video at 720P
task_id = create_t2v_task({
"prompt": "A neon cyberpunk alley at midnight, rain reflections, slow dolly forward.",
"resolution": "720P",
"ratio": "9:16",
"duration": 8,
})
Error handling
| Error |
Likely cause |
Action |
401 / InvalidApiKey |
Missing or invalid DASHSCOPE_API_KEY |
Check env var or credentials file |
400 InvalidParameter |
Unsupported resolution/ratio, duration out of [3,15], wrong model name |
Validate parameters |
current user api does not support synchronous calls |
Missing X-DashScope-Async: enable header |
Add the required header |
task_status: UNKNOWN |
task_id older than 24 hours |
Re-create the task |
| 429 |
RPS or quota exceeded |
Retry with backoff; query RPS default 20 |
Output location
- Default output:
output/aliyun-happyhorse-t2v/videos/
- Override base dir with
OUTPUT_DIR.
Anti-patterns
- Do not use any model ID other than
happyhorse-1.0-t2v.
- Do not call this API synchronously — async header is required.
- Do not pass
media, first_frame, or reference_image — t2v takes only a text prompt.
- Video and task URLs expire after 24 hours; download and persist immediately.
- Do not use this skill for image- or video-conditioned generation — use
aliyun-happyhorse-i2v, aliyun-happyhorse-r2v, or aliyun-happyhorse-videoedit instead.
Workflow
- Confirm pure text-to-video intent (no input image/video).
- Build the prompt and choose
resolution, ratio, duration.
- Create async task and poll
/tasks/{task_id} every ~15s.
- Download
output.video_url before the 24-hour expiration.
References
- See
references/api_reference.md for full HTTP API details.
- See
references/sources.md for source links.
1---2name: aliyun-happyhorse-t2v3description: Use when generating videos from text prompts with DashScope HappyHorse 1.0 text-to-video model (happyhorse-1.0-t2v). Use when implementing pure text-to-video synthesis via the video-synthesis async API on Alibaba Cloud Model Studio.4---5
6# HappyHorse 1.0 Text-to-Video
7
8## Validation
9
10```bash
11mkdir -p output/aliyun-happyhorse-t2v
12python -m py_compile skills/ai/video/aliyun-happyhorse-t2v/scripts/t2v_happyhorse.py && echo "py_compile_ok" > output/aliyun-happyhorse-t2v/validate.txt
13```
14
15Pass criteria: command exits 0 and `output/aliyun-happyhorse-t2v/validate.txt` is generated.
16
17## Output And Evidence
18
19- Save task IDs, polling responses, and final video URLs to `output/aliyun-happyhorse-t2v/`.
20- Keep at least one end-to-end run log for troubleshooting.
21
22## Prerequisites
23
24- Install dependencies (recommended in a venv):
25
26```bash
27python3 -m venv .venv
28. .venv/bin/activate
29python -m pip install requests
30```
31- Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials`.
32
33## Critical model names
34
35- `happyhorse-1.0-t2v` — text-to-video, supports resolution, ratio, duration, watermark and seed control
36
37## Capabilities
38
39| Capability | Description | Required input |
40|---|---|---|
41| Text-to-video | Generate a physically realistic video from a text prompt only | `prompt` |
42
43## API endpoint (async only)
44
45```
46POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
47```
48
49Required headers:
50- `Authorization: Bearer $DASHSCOPE_API_KEY`
51- `Content-Type: application/json`
52- `X-DashScope-Async: enable`
53
54Singapore endpoint: replace `dashscope.aliyuncs.com` with `dashscope-intl.aliyuncs.com`.
55
56Polling endpoint: `GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}` — recommended interval 15s.
57
58## Normalized interface
59
60### Request
61- `model` (string, required) — fixed `happyhorse-1.0-t2v`
62- `input.prompt` (string, required) — up to 5000 non-CJK characters or 2500 CJK characters; longer is truncated
63- `parameters.resolution` (string, optional) — `720P` or `1080P` (default: `1080P`)
64- `parameters.ratio` (string, optional) — `16:9` (default), `9:16`, `1:1`, `4:3`, `3:4`
65- `parameters.duration` (integer, optional) — video length in seconds, range [3, 15] (default: 5)
66- `parameters.watermark` (boolean, optional) — add bottom-right "Happy Horse" watermark (default: `true`)
67- `parameters.seed` (integer, optional) — range [0, 2147483647]
68
69### Response (task creation)
70- `output.task_id` (string) — use for polling, valid 24 hours
71- `output.task_status` (string) — `PENDING` | `RUNNING` | `SUCCEEDED` | `FAILED` | `CANCELED` | `UNKNOWN`
72- `request_id` (string)
73
74### Response (task result, on SUCCEEDED)
75- `output.video_url` (string) — generated MP4 (H.264) URL, valid 24 hours
76- `output.orig_prompt` (string)
77- `output.submit_time` / `output.scheduled_time` / `output.end_time` (string)
78- `usage.duration` (integer) — billable duration in seconds
79- `usage.output_video_duration` (integer)
80- `usage.SR` (integer) — output resolution tier
81- `usage.ratio` (string)
82- `usage.video_count` (integer) — fixed 1
83
84## Quick start (Python + HTTP)
85
86```python
87import os
88import time
89import requests
90
91API_KEY = os.getenv("DASHSCOPE_API_KEY")
92BASE_URL = "https://dashscope.aliyuncs.com/api/v1"
93
94
95def create_t2v_task(req: dict) -> str:
96 """Create a text-to-video task and return task_id."""
97 payload = {
98 "model": "happyhorse-1.0-t2v",
99 "input": {"prompt": req["prompt"]},
100 "parameters": {
101 "resolution": req.get("resolution", "1080P"),
102 "ratio": req.get("ratio", "16:9"),
103 "duration": req.get("duration", 5),
104 "watermark": req.get("watermark", True),
105 },
106 }
107 if req.get("seed") is not None:
108 payload["parameters"]["seed"] = req["seed"]
109
110 resp = requests.post(
111 f"{BASE_URL}/services/aigc/video-generation/video-synthesis",
112 headers={
113 "Authorization": f"Bearer {API_KEY}",
114 "Content-Type": "application/json",
115 "X-DashScope-Async": "enable",
116 },
117 json=payload,
118 )
119 resp.raise_for_status()
120 return resp.json()["output"]["task_id"]
121
122
123def poll_task(task_id: str, interval: int = 15) -> dict:
124 while True:
125 resp = requests.get(
126 f"{BASE_URL}/tasks/{task_id}",
127 headers={"Authorization": f"Bearer {API_KEY}"},
128 )
129 resp.raise_for_status()
130 data = resp.json()
131 if data["output"]["task_status"] in ("SUCCEEDED", "FAILED", "CANCELED"):
132 return data
133 time.sleep(interval)
134```
135
136## Usage examples
137
138```python
139# Minimal — pure text prompt
140task_id = create_t2v_task({
141 "prompt": "一座由硬纸板和瓶盖搭建的微型城市,在夜晚焕发出生机。",
142 "duration": 5,
143})
144
145# Vertical short video at 720P
146task_id = create_t2v_task({
147 "prompt": "A neon cyberpunk alley at midnight, rain reflections, slow dolly forward.",
148 "resolution": "720P",
149 "ratio": "9:16",
150 "duration": 8,
151})
152```
153
154## Error handling
155
156| Error | Likely cause | Action |
157|---|---|---|
158| 401 / `InvalidApiKey` | Missing or invalid `DASHSCOPE_API_KEY` | Check env var or credentials file |
159| 400 `InvalidParameter` | Unsupported resolution/ratio, duration out of [3,15], wrong model name | Validate parameters |
160| `current user api does not support synchronous calls` | Missing `X-DashScope-Async: enable` header | Add the required header |
161| `task_status: UNKNOWN` | task_id older than 24 hours | Re-create the task |
162| 429 | RPS or quota exceeded | Retry with backoff; query RPS default 20 |
163
164## Output location
165
166- Default output: `output/aliyun-happyhorse-t2v/videos/`
167- Override base dir with `OUTPUT_DIR`.
168
169## Anti-patterns
170
171- Do not use any model ID other than `happyhorse-1.0-t2v`.
172- Do not call this API synchronously — async header is required.
173- Do not pass `media`, `first_frame`, or `reference_image` — t2v takes only a text prompt.
174- Video and task URLs expire after 24 hours; download and persist immediately.
175- Do not use this skill for image- or video-conditioned generation — use `aliyun-happyhorse-i2v`, `aliyun-happyhorse-r2v`, or `aliyun-happyhorse-videoedit` instead.
176
177## Workflow
178
1791) Confirm pure text-to-video intent (no input image/video).
1802) Build the prompt and choose `resolution`, `ratio`, `duration`.
1813) Create async task and poll `/tasks/{task_id}` every ~15s.
1824) Download `output.video_url` before the 24-hour expiration.
183
184## References
185
186- See `references/api_reference.md` for full HTTP API details.
187- See `references/sources.md` for source links.