Interface layer: defines trigger conditions, input parameters, execution stages, output specifications, and error policies, independent of any specific video generation service. See the
impl/directory for each platform's API endpoints and authentication methods:
impl/giggle.md— giggle.pro implementationWhen integrating other video generation platforms, you only need to add the corresponding
impl/{platform}.md, and this file does not need to be modified.
Overview
Call AI video generation services to create and track video generation tasks.
Trigger conditions
- The user requests video generation
- The user provides a script/idea and requests production
- The user queries the progress of a submitted video generation task
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Video description/prompt |
| platform | string | No | Target platform id (see the impl/ directory), default giggle |
| style | string | No | Visual style (cinematic / anime / realistic, etc.) |
| duration | number | No | Target duration (seconds), default 15 |
| aspect_ratio | string | No | Aspect ratio, default 16:9 |
| resolution | string | No | Resolution, default 1080p |
Execution stages
阶段 1 — 参数确认
收集并验证所有输入参数,缺失项使用默认值。
单次调用费用超过 $5 时,向用户告知预估费用并获取确认。
阶段 2 — 提交任务
根据 platform 参数加载 impl/{platform}.md。
调用实现层提交生成任务,获取 task_id。
阶段 3 — 进度追踪
轮询任务状态,默认间隔 10s,超时上限 600s。
超时后记录 task_id,告知用户可稍后查询。
阶段 4 — 结果处理
成功:提取视频 URL,保存元数据。
失败:记录错误码,建议用户调整参数。
Output
{
"taskId": "platform_task_id",
"platform": "giggle",
"status": "completed | failed | timeout",
"videoUrl": "https://...",
"metadata": {
"prompt": "...",
"style": "cinematic",
"duration": 15,
"aspect_ratio": "16:9",
"resolution": "1080p",
"generationSeconds": 120
}
}
Archive path:shared/outputs/director/{date}_{project}_video.json
Error handling policy
| Error type | Handling method |
|---|---|
| Rate limiting (429) | Wait 60s and retry, up to 3 times |
| Parameter error (400) | Prompt the user to modify the prompt or parameters |
| Service failure (5xx) | Log the error and notify the user to retry later |
| Polling timeout | Save the task_id and inform the user that progress can be queried later |
Security constraints
- Only access whitelisted domains defined in impl/
- Confirm the user's intent before calling
- All API calls are recorded by the gateway to the audit log