简体中文 | English
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 execute_workflow once only; never call create and submit separately.
⚠️ Review Before Installing
Please review before installing. This skill will:
- 1. Network – Calls Giggle.pro API for MV generation
Requirements: python3 (>=3.6), GIGGLE_API_KEY (system environment variable), pip packages: INLINECODE3
No Retry on Error: If script execution encounters an error, do not retry. Report the error to the user directly and stop.
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_KEY
Verification steps:
- 1. Confirm the user has configured
GIGGLE_API_KEY in system environment - 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 run
export GIGGLE_API_KEY=your_api_key in the terminal.
- 3. Wait for the user to configure before continuing the workflow
Two Music Generation Modes
| Mode | musicgeneratetype | Required params | Description |
|---|
| Prompt | INLINECODE8 | prompt, vocal_gender | Describe music in text |
| Custom |
custom | lyrics, style, title | Provide lyrics, style, and title |
Shared Parameters (All Modes, Required)
- - referenceimage or referenceimageurl: Reference image—provide at least one (assetid or download URL). Also supports base64 image, e.g.
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==". For base64: pass the raw Base64 string directly; do not add the data:image/xxx;base64 prefix. - aspect: Aspect ratio,
16:9 or INLINECODE12 - scenedescription: Visual scene description, default empty—only set when the user explicitly mentions the scene (max 200 chars)
- subtitleenabled: Enable subtitles, default false
Mode-Specific Parameters
Prompt mode:
- -
prompt: Music description (required) - INLINECODE14 : Vocal gender —
male / female / auto (optional, default auto) - INLINECODE19 : Instrumental only (optional, default false)
Custom mode:
- -
lyrics: Lyrics content (required) - INLINECODE21 : Music style (required)
- INLINECODE22 : Song title (required)
Workflow Function
Use execute_workflow 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).
Important:
- - Never call
create_project and submit_mv_task separately—always use execute_workflow or INLINECODE27 - After calling, just wait for the function to return; all intermediate steps are automatic
Function Signature
CODEBLOCK0
Parameter Extraction Rules
- 1. referenceimage and referenceimageurl: At least one required. Use
reference_image for assetid; use reference_image_url for image URL or base64. - scenedescription: Default empty—only fill when the user explicitly mentions "scene", "visual description", or "visual style".
- subtitleenabled: Default False—only set True when the user explicitly requests subtitles.
- aspect: Use
9:16 when the user mentions portrait/vertical/9:16; otherwise default 16:9. - Mode selection: "Describe music / use prompt" → prompt; "Here are my lyrics / lyrics are" → custom;
Examples
Prompt mode:
CODEBLOCK1
Custom mode (user provides lyrics):
CODEBLOCK2
With scene description (when user explicitly describes the scene):
CODEBLOCK3
Submit Task API Request Example (Prompt Mode)
Submit endpoint (/api/v1/trustee_mode/mv/submit) request body:
CODEBLOCK4
Note: reference_image (asset_id) and reference_image_url (URL or base64) are mutually exclusive.
Custom mode:
CODEBLOCK5
Query Progress API Response Example
Query endpoint (/api/v1/trustee_mode/mv/query) response (all steps completed):
CODEBLOCK6
Note: When pay_status is pending, call the pay endpoint. When all steps are done, video_asset.download_url will have a value—return the full signed URL. Correct format:
https://assets.giggle.pro/private/ai_director/348e4956c7bd4f763b/qzjc7gwkpf.mp4?Policy=...&Key-Pair-Id=...&Signature=...&response-content-disposition=attachment
Wrong (unsigned URL only):
CODEBLOCK8
Pay API Request and Response
Pay endpoint (/api/v1/trustee_mode/mv/pay):
Request body:
CODEBLOCK9
Response:
CODEBLOCK10
Retry API Request Example
When a step fails, guide the user to call the retry endpoint to resume from that step:
CODEBLOCK11
Note: current_step is the step name to retry (e.g. music-generate, storyboard, shot, editor).
createandsubmit (Optional)
If you only need to create the project and submit the task without waiting for completion, use create_and_submit. Never call create_project and submit_mv_task separately:
CODEBLOCK12
Return Value
Success:
CODEBLOCK13
Returns error message on failure.
Troubleshooting
| Scenario | Cause | Solution |
|---|
| INLINECODE49 or "invalid API key" | INLINECODE50 is missing, expired, or incorrect | Verify the key at Giggle.pro account settings and re-export: INLINECODE51 |
| INLINECODE52 |
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 |
|
pay_status: pending | The project requires payment before proceeding | The workflow function handles this automatically; if running manually, call the pay endpoint with the
project_id |
| Task step failed (
status: failed) | A generation step (e.g.
music-generate,
shot) encountered an error | Use the retry endpoint:
{"project_id": "<your-project-id>", "current_step": "<failed-step>"} to resume from the failed step |
| Workflow timeout (> 1 hour) | MV generation took too long | Query progress manually with the
project_id to check current status; contact support if the task is stuck |
MV Trustee Mode API 技能
调用MV trustee模式API以运行完整的MV生成工作流。项目创建和任务提交在脚本中合并为一步——仅调用一次execute_workflow;切勿分别调用创建和提交。
⚠️ 安装前请审阅
安装前请审阅。 此技能将:
- 1. 网络 – 调用Giggle.pro API进行MV生成
要求:python3 (>=3.6)、GIGGLEAPIKEY(系统环境变量)、pip包:requests
出错不重试:如果脚本执行遇到错误,请勿重试。直接向用户报告错误并停止。
首次使用前的必要设置
在执行任何操作前,确认用户已配置API Key。
API Key:登录Giggle.pro并从账户设置中获取API Key。
配置:设置系统环境变量GIGGLEAPIKEY
- - export GIGGLEAPIKEY=yourapikey
验证步骤:
- 1. 确认用户已在系统环境中配置GIGGLEAPIKEY
- 如果未配置,引导用户:
> 您好!在使用MV生成功能前,您需要配置API Key。请前往
Giggle.pro获取您的API Key,然后在终端中运行export GIGGLEAPI
KEY=yourapi_key。
- 3. 等待用户配置完成后继续工作流
两种音乐生成模式
| 模式 | musicgeneratetype | 必需参数 | 描述 |
|---|
| 提示词 | prompt | prompt, vocal_gender | 用文字描述音乐 |
| 自定义 |
custom | lyrics, style, title | 提供歌词、风格和标题 |
共享参数(所有模式,必需)
- - referenceimage 或 referenceimageurl:参考图片——至少提供一个(assetid或下载URL)。也支持base64图片,例如iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==。对于base64:直接传递原始Base64字符串;不要添加data:image/xxx;base64前缀。
- aspect:宽高比,16:9或9:16
- scenedescription:视觉场景描述,默认为空——仅在用户明确提及场景时设置(最多200字符)
- subtitleenabled:启用字幕,默认为false
模式特定参数
提示词模式:
- - prompt:音乐描述(必需)
- vocal_gender:人声性别——male/female/auto(可选,默认auto)
- instrumental:纯音乐(可选,默认false)
自定义模式:
- - lyrics:歌词内容(必需)
- style:音乐风格(必需)
- title:歌曲标题(必需)
工作流函数
使用execute_workflow运行完整工作流——调用一次并等待。内部流程:创建项目+提交任务(合并)→轮询进度(每3秒)→检测并支付待处理项→等待完成(最长1小时)。
重要提示:
- - 切勿分别调用createproject和submitmvtask——始终使用executeworkflow或createandsubmit
- 调用后,只需等待函数返回;所有中间步骤均为自动执行
函数签名
python
execute_workflow(
musicgeneratetype: str, # 模式:prompt / custom
aspect: str, # 宽高比:16:9或9:16
project_name: str, # 项目名称
referenceimage: str = , # 参考图片assetid(与referenceimageurl互斥)
referenceimageurl: 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 = ,
)
参数提取规则
- 1. referenceimage和referenceimageurl:至少需要一个。使用referenceimage传递assetid;使用referenceimageurl传递图片URL或base64。
- scenedescription:默认为空——仅在用户明确提及场景、视觉描述或视觉风格时填写。
- subtitle_enabled:默认为False——仅在用户明确要求字幕时设置为True。
- aspect:当用户提及竖屏/垂直/9:16时使用9:16;否则默认为16:9。
- 模式选择:描述音乐/使用提示词→prompt;这是我的歌词/歌词是→custom;
示例
提示词模式:
python
api = MVTrusteeAPI()
result = api.execute_workflow(
musicgeneratetype=prompt,
aspect=16:9,
project_name=我的MV,
referenceimageurl=https://example.com/ref.jpg,
prompt=欢快的流行乐,阳光沙滩氛围,
vocal_gender=female
)
自定义模式(用户提供歌词):
python
result = api.execute_workflow(
musicgeneratetype=custom,
aspect=9:16,
project_name=歌词MV,
referenceimage=assetxxx,
lyrics=第一段:春风拂面...,
style=流行,
title=春之歌
)
带场景描述(当用户明确描述场景时):
python
result = api.execute_workflow(
musicgeneratetype=prompt,
aspect=16:9,
project_name=场景MV,
referenceimageurl=https://...,
prompt=电子舞曲,
scene_description=城市夜景,霓虹灯,车流
)
提交任务API请求示例(提示词模式)
提交端点(/api/v1/trustee_mode/mv/submit)请求体:
json
{
project_id: ,
musicgeneratetype: prompt,
prompt: 一首欢快的流行歌曲,
vocal_gender: female,
instrumental: false,
referenceimageurl: /9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUT...(base64图片数据),
scene_description: 日落时分的浪漫海滩漫步,海浪轻拍海岸,粉色天空渐变,
aspect: 16:9,
subtitle_enabled: false
}
注意:referenceimage(assetid)和referenceimageurl(URL或base64)互斥。
自定义模式:
json
{
project_id: ,
musicgeneratetype: custom,
lyrics: 第一段:\n站在海边看日落\n回忆如潮水般涌来\n\n副歌:\n让海风吹走所有烦恼\n在这金色时刻\n我们找到了彼此\n,
style: 流行情歌,
title: 海边回忆,
referenceimage: id>,
scene_description: 黄昏时分一对情侣在海滩漫步,长影,橙红色天空渐变,
aspect: 9:16,
subtitle_enabled: false
}
查询进度API响应示例
查询端点(/api/v1/trustee_mode/mv/query)响应(所有步骤完成):
json
{
code: 200,
msg: success,
uuid: ,
data: {
project_id: ,
video_asset: {
assetid: 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: [...]
}
}
注意:当pay_status为pending时,调用支付端点。当所有