giggle-generation-aimv
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese简体中文 | English
简体中文 | English
MV Trustee Mode API Skill
MV Trustee Mode API Skill
Calls the MV trustee mode API to run the full MV generation workflow. Project creation and task submission are merged into one step in the script—call once only; never call create and submit separately.
execute_workflow调用MV trustee mode API以运行完整的MV生成工作流。脚本中将项目创建与任务提交合并为一步——只需调用一次;切勿分别调用创建和提交操作。
execute_workflow⚠️ Review Before Installing
⚠️ 安装前须知
Please review before installing. This skill will:
- Network – Calls Giggle.pro API for MV generation
Requirements: , (system environment variable), pip packages:
python3 (>=3.6)GIGGLE_API_KEYrequestsNo Retry on Error: If script execution encounters an error, do not retry. Report the error to the user directly and stop.
请在安装前仔细阅读。 本技能将:
- 网络 – 调用Giggle.pro API生成MV
要求:、(系统环境变量)、pip包:
python3 (>=3.6)GIGGLE_API_KEYrequests错误时请勿重试:若脚本执行遇到错误,请勿重试。直接向用户报告错误并停止操作。
Required Setup Before First Use
首次使用前的必要配置
Before performing any operation, confirm the user has configured the API Key.
API Key: Log in to Giggle.pro and obtain the API Key from account settings.
Configuration: Set system environment variable
GIGGLE_API_KEYexport GIGGLE_API_KEY=your_api_key
Verification steps:
- Confirm the user has configured in system environment
GIGGLE_API_KEY - If not configured, guide the user:
Hello! Before using the MV generation feature, you need to configure the API Key. Please go to Giggle.pro to get your API Key, then runin the terminal.
export GIGGLE_API_KEY=your_api_key - Wait for the user to configure before continuing the workflow
在执行任何操作前,请确认用户已配置API Key。
API Key:登录Giggle.pro,从账户设置中获取API Key。
配置:设置系统环境变量
GIGGLE_API_KEYexport GIGGLE_API_KEY=your_api_key
验证步骤:
- 确认用户已在系统环境中配置
GIGGLE_API_KEY - 若未配置,引导用户:
您好!在使用MV生成功能前,您需要配置API Key。请前往Giggle.pro获取您的API Key,然后在终端中运行。
export GIGGLE_API_KEY=your_api_key - 等待用户完成配置后再继续工作流
Two Music Generation Modes
两种音乐生成模式
| Mode | music_generate_type | Required params | Description |
|---|---|---|---|
| Prompt | | prompt, vocal_gender | Describe music in text |
| Custom | | lyrics, style, title | Provide lyrics, style, and title |
| 模式 | music_generate_type | 必填参数 | 描述 |
|---|---|---|---|
| 提示词模式 | | prompt, vocal_gender | 通过文本描述音乐 |
| 自定义模式 | | lyrics, style, title | 提供歌词、风格和标题 |
Shared Parameters (All Modes, Required)
通用参数(所有模式,必填)
- reference_image or reference_image_url: Reference image—provide at least one (asset_id or download URL). Also supports base64 image, e.g. . For base64: pass the raw Base64 string directly; do not add the data:image/xxx;base64 prefix.
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" - aspect: Aspect ratio, or
16:99:16 - scene_description: Visual scene description, default empty—only set when the user explicitly mentions the scene (max 200 chars)
- subtitle_enabled: Enable subtitles, default false
- reference_image 或 reference_image_url:参考图片——至少提供其中一项(asset_id或下载URL)。也支持base64格式图片,例如。对于base64格式:直接传递原始Base64字符串;请勿添加data:image/xxx;base64前缀。
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" - aspect:宽高比,或
16:99:16 - scene_description:视觉场景描述,默认为空——仅当用户明确提及场景时才设置(最多200字符)
- subtitle_enabled:启用字幕,默认false
Mode-Specific Parameters
模式专属参数
Prompt mode:
- : Music description (required)
prompt - : Vocal gender —
vocal_gender/male/female(optional, defaultauto)auto - : Instrumental only (optional, default false)
instrumental
Custom mode:
- : Lyrics content (required)
lyrics - : Music style (required)
style - : Song title (required)
title
提示词模式:
- : 音乐描述(必填)
prompt - : 人声性别 —
vocal_gender/male/female(可选,默认auto)auto - : 仅纯音乐(可选,默认false)
instrumental
自定义模式:
- : 歌词内容(必填)
lyrics - : 音乐风格(必填)
style - : 歌曲标题(必填)
title
Workflow Function
工作流函数
Use to run the full workflow—call once and wait. Internally: create project + submit task (merged) → poll progress (every 3 sec) → detect and pay pending items → wait for completion (max 1 hour).
execute_workflowImportant:
- Never call and
create_projectseparately—always usesubmit_mv_taskorexecute_workflowcreate_and_submit - After calling, just wait for the function to return; all intermediate steps are automatic
使用运行完整工作流——调用一次后等待。内部流程:创建项目+提交任务(合并操作)→ 轮询进度(每3秒一次)→ 检测并支付待付款项→ 等待完成(最长1小时)。
execute_workflow重要提示:
- 切勿分别调用和
create_project——请始终使用submit_mv_task或execute_workflowcreate_and_submit - 调用后只需等待函数返回;所有中间步骤均自动完成
Function Signature
函数签名
python
execute_workflow(
music_generate_type: str, # Mode: prompt / custom
aspect: str, # Aspect ratio: 16:9 or 9:16
project_name: str, # Project name
reference_image: str = "", # Reference image asset_id (mutually exclusive with reference_image_url)
reference_image_url: str = "", # Reference image URL or base64 (mutually exclusive with reference_image)
scene_description: str = "", # Scene description, default empty
subtitle_enabled: bool = False, # Subtitle toggle, default False
# Prompt mode
prompt: str = "",
vocal_gender: str = "auto",
instrumental: bool = False,
# Custom mode
lyrics: str = "",
style: str = "",
title: str = "",
)python
execute_workflow(
music_generate_type: str, # 模式: prompt / custom
aspect: str, # 宽高比: 16:9 or 9:16
project_name: str, # 项目名称
reference_image: str = "", # 参考图片asset_id(与reference_image_url互斥)
reference_image_url: str = "", # 参考图片URL或base64(与reference_image互斥)
scene_description: str = "", # 场景描述,默认空
subtitle_enabled: bool = False, # 字幕开关,默认False
# 提示词模式参数
prompt: str = "",
vocal_gender: str = "auto",
instrumental: bool = False,
# 自定义模式参数
lyrics: str = "",
style: str = "",
title: str = "",
)Parameter Extraction Rules
参数提取规则
- reference_image and reference_image_url: At least one required. Use for asset_id; use
reference_imagefor image URL or base64.reference_image_url - scene_description: Default empty—only fill when the user explicitly mentions "scene", "visual description", or "visual style".
- subtitle_enabled: Default False—only set True when the user explicitly requests subtitles.
- aspect: Use when the user mentions portrait/vertical/9:16; otherwise default
9:16.16:9 - Mode selection: "Describe music / use prompt" → prompt; "Here are my lyrics / lyrics are" → custom;
- reference_image和reference_image_url:至少必填一项。asset_id使用;图片URL或base64使用
reference_image。reference_image_url - scene_description:默认为空——仅当用户明确提及“场景”、“视觉描述”或“视觉风格”时才填写。
- subtitle_enabled:默认False——仅当用户明确要求字幕时才设置为True。
- aspect:当用户提到竖屏/垂直/9:16时使用;否则默认
9:16。16:9 - 模式选择:“描述音乐/使用提示词”→提示词模式;“这是我的歌词/歌词如下”→自定义模式;
Examples
示例
Prompt mode:
python
api = MVTrusteeAPI()
result = api.execute_workflow(
music_generate_type="prompt",
aspect="16:9",
project_name="My MV",
reference_image_url="https://example.com/ref.jpg",
prompt="Upbeat pop, sunny beach vibe",
vocal_gender="female"
)Custom mode (user provides lyrics):
python
result = api.execute_workflow(
music_generate_type="custom",
aspect="9:16",
project_name="Lyrics MV",
reference_image="asset_xxx",
lyrics="Verse 1: Spring breeze on my face...",
style="pop",
title="Spring Song"
)With scene description (when user explicitly describes the scene):
python
result = api.execute_workflow(
music_generate_type="prompt",
aspect="16:9",
project_name="Scene MV",
reference_image_url="https://...",
prompt="Electronic dance music",
scene_description="City nightscape, neon lights, flowing traffic"
)提示词模式:
python
api = MVTrusteeAPI()
result = api.execute_workflow(
music_generate_type="prompt",
aspect="16:9",
project_name="My MV",
reference_image_url="https://example.com/ref.jpg",
prompt="Upbeat pop, sunny beach vibe",
vocal_gender="female"
)自定义模式(用户提供歌词):
python
result = api.execute_workflow(
music_generate_type="custom",
aspect="9:16",
project_name="Lyrics MV",
reference_image="asset_xxx",
lyrics="Verse 1: Spring breeze on my face...",
style="pop",
title="Spring Song"
)包含场景描述(当用户明确描述场景时):
python
result = api.execute_workflow(
music_generate_type="prompt",
aspect="16:9",
project_name="Scene MV",
reference_image_url="https://...",
prompt="Electronic dance music",
scene_description="City nightscape, neon lights, flowing traffic"
)Submit Task API Request Example (Prompt Mode)
提交任务API请求示例(提示词模式)
Submit endpoint () request body:
/api/v1/trustee_mode/mv/submitjson
{
"project_id": "<your-project-id>",
"music_generate_type": "prompt",
"prompt": "A cheerful pop song",
"vocal_gender": "female",
"instrumental": false,
"reference_image_url": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUT...(base64 image data)",
"scene_description": "A romantic beach walk at sunset, waves gently lapping the shore, pink sky gradient",
"aspect": "16:9",
"subtitle_enabled": false
}Note: (asset_id) and (URL or base64) are mutually exclusive.
reference_imagereference_image_urlCustom mode:
json
{
"project_id": "<your-project-id>",
"music_generate_type": "custom",
"lyrics": "Verse 1:\nStanding by the sea watching the sunset\nMemories rush in like waves\n\nChorus:\nLet the sea breeze blow away all worries\nIn this golden moment\nWe found each other\n",
"style": "pop ballad",
"title": "Seaside Memories",
"reference_image": "<asset_id>",
"scene_description": "A couple walking on the beach at dusk, long shadows, orange-red sky gradient",
"aspect": "9:16",
"subtitle_enabled": false
}提交接口()请求体:
/api/v1/trustee_mode/mv/submitjson
{
"project_id": "<your-project-id>",
"music_generate_type": "prompt",
"prompt": "A cheerful pop song",
"vocal_gender": "female",
"instrumental": false,
"reference_image_url": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUT...(base64 image data)",
"scene_description": "A romantic beach walk at sunset, waves gently lapping the shore, pink sky gradient",
"aspect": "16:9",
"subtitle_enabled": false
}注意:(asset_id)和(URL或base64)不可同时使用。
reference_imagereference_image_url自定义模式:
json
{
"project_id": "<your-project-id>",
"music_generate_type": "custom",
"lyrics": "Verse 1:\nStanding by the sea watching the sunset\nMemories rush in like waves\n\nChorus:\nLet the sea breeze blow away all worries\nIn this golden moment\nWe found each other\n",
"style": "pop ballad",
"title": "Seaside Memories",
"reference_image": "<asset_id>",
"scene_description": "A couple walking on the beach at dusk, long shadows, orange-red sky gradient",
"aspect": "9:16",
"subtitle_enabled": false
}Query Progress API Response Example
查询进度API响应示例
Query endpoint () response (all steps completed):
/api/v1/trustee_mode/mv/queryjson
{
"code": 200,
"msg": "success",
"uuid": "<response-uuid>",
"data": {
"project_id": "<your-project-id>",
"video_asset": {
"asset_id": "<asset_id>",
"download_url": "https://assets.giggle.pro/private/...",
"thumbnail_url": "https://assets.giggle.pro/private/...",
"signed_url": "https://assets.giggle.pro/private/...",
"duration": 0
},
"shot_count": 0,
"current_step": "editor",
"completed_steps": "music-generate,storyboard,shot,editor",
"pay_status": "paid",
"status": "completed",
"err_msg": "",
"steps": [...]
}
}Note: When is , call the pay endpoint. When all are done, will have a value—return the full signed URL. Correct format:
pay_statuspendingstepsvideo_asset.download_urlhttps://assets.giggle.pro/private/ai_director/348e4956c7bd4f763b/qzjc7gwkpf.mp4?Policy=...&Key-Pair-Id=...&Signature=...&response-content-disposition=attachmentWrong (unsigned URL only):
https://assets.giggle.pro/private/ai_director/348e4956c7bd4f763b/qzjc7gwkpf.mp4查询接口()响应(所有步骤完成):
/api/v1/trustee_mode/mv/queryjson
{
"code": 200,
"msg": "success",
"uuid": "<response-uuid>",
"data": {
"project_id": "<your-project-id>",
"video_asset": {
"asset_id": "<asset_id>",
"download_url": "https://assets.giggle.pro/private/...",
"thumbnail_url": "https://assets.giggle.pro/private/...",
"signed_url": "https://assets.giggle.pro/private/...",
"duration": 0
},
"shot_count": 0,
"current_step": "editor",
"completed_steps": "music-generate,storyboard,shot,editor",
"pay_status": "paid",
"status": "completed",
"err_msg": "",
"steps": [...]
}
}注意:当为时,调用支付接口。当所有完成后,将有值——返回完整的签名URL。正确格式:
pay_statuspendingstepsvideo_asset.download_urlhttps://assets.giggle.pro/private/ai_director/348e4956c7bd4f763b/qzjc7gwkpf.mp4?Policy=...&Key-Pair-Id=...&Signature=...&response-content-disposition=attachment错误格式(仅无签名URL):
https://assets.giggle.pro/private/ai_director/348e4956c7bd4f763b/qzjc7gwkpf.mp4Pay API Request and Response
支付API请求与响应
Pay endpoint ():
/api/v1/trustee_mode/mv/payRequest body:
json
{
"project_id": "<your-project-id>"
}Response:
json
{
"code": 200,
"msg": "success",
"uuid": "<response-uuid>",
"data": {
"order_id": "<order-id>",
"price": 580
}
}支付接口():
/api/v1/trustee_mode/mv/pay请求体:
json
{
"project_id": "<your-project-id>"
}响应:
json
{
"code": 200,
"msg": "success",
"uuid": "<response-uuid>",
"data": {
"order_id": "<order-id>",
"price": 580
}
}Retry API Request Example
重试API请求示例
When a step fails, guide the user to call the retry endpoint to resume from that step:
json
{
"project_id": "<your-project-id>",
"current_step": "shot"
}Note: is the step name to retry (e.g. , , , ).
current_stepmusic-generatestoryboardshoteditor当某一步骤失败时,引导用户调用重试接口从该步骤恢复:
json
{
"project_id": "<your-project-id>",
"current_step": "shot"
}注意:是要重试的步骤名称(例如、、、)。
current_stepmusic-generatestoryboardshoteditorcreate_and_submit (Optional)
create_and_submit(可选)
If you only need to create the project and submit the task without waiting for completion, use . Never call and separately:
create_and_submitcreate_projectsubmit_mv_taskpython
api = MVTrusteeAPI()
r = api.create_and_submit(
project_name="My MV",
music_generate_type="prompt",
aspect="16:9",
reference_image_url="https://...",
prompt="Upbeat pop"
)如果您仅需要创建项目并提交任务,无需等待完成,请使用。切勿分别调用和:
create_and_submitcreate_projectsubmit_mv_taskpython
api = MVTrusteeAPI()
r = api.create_and_submit(
project_name="My MV",
music_generate_type="prompt",
aspect="16:9",
reference_image_url="https://...",
prompt="Upbeat pop"
)Returns project_id for manual query/pay later
返回project_id用于后续手动查询/支付
undefinedundefinedReturn Value
返回值
Success:
json
{
"code": 200,
"msg": "success",
"data": {
"project_id": "...",
"download_url": "https://...",
"video_asset": {...},
"status": "completed"
}
}Returns error message on failure.
成功时:
json
{
"code": 200,
"msg": "success",
"data": {
"project_id": "...",
"download_url": "https://...",
"video_asset": {...},
"status": "completed"
}
}失败时返回错误信息。
Troubleshooting
故障排除
| Scenario | Cause | Solution |
|---|---|---|
| | Verify the key at Giggle.pro account settings and re-export: |
| API rate limit exceeded | Wait a few minutes and retry; avoid submitting multiple projects in rapid succession |
| Network timeout / connection error | Unstable network or API service temporarily unavailable | The script auto-retries up to 5 times with 5-second intervals; check your network if it still fails |
| The project requires payment before proceeding | The workflow function handles this automatically; if running manually, call the pay endpoint with the |
Task step failed ( | A generation step (e.g. | Use the retry endpoint: |
| Workflow timeout (> 1 hour) | MV generation took too long | Query progress manually with the |
| 场景 | 原因 | 解决方案 |
|---|---|---|
| | 在Giggle.pro账户设置中验证密钥,重新执行导出命令: |
| 超出API调用频率限制 | 等待几分钟后重试;避免短时间内提交多个项目 |
| 网络超时/连接错误 | 网络不稳定或API服务暂时不可用 | 脚本会自动重试最多5次,间隔5秒;若仍失败请检查网络 |
| 项目需要付费才能继续 | 工作流函数会自动处理此情况;若手动运行,请使用 |
任务步骤失败( | 某一生成步骤(如 | 使用重试接口: |
| 工作流超时(超过1小时) | MV生成耗时过长 | 使用 |