简体中文 | English
⚠️ Review Before Installing
Please review before installing. This skill will:
- 1. Network – Calls Giggle.pro API for video generation
Requirements: python3, GIGGLE_API_KEY (system environment variable), pip packages: INLINECODE2
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 to avoid workflow failure due to auth errors.
- - API Key: Log in to Giggle.pro and obtain the API Key from account settings.
- Configuration: Set system environment variable INLINECODE3
- INLINECODE4
Verification steps:
- 1. Confirm the user has configured
GIGGLE_API_KEY in system environment. - If not configured, guide the user:
> Hello! Before using the video 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.
Generation Modes
Supports three modes. Ask the user to select a mode before starting the workflow. If not specified, default to Episodes mode (director).
| Mode | project_type | Description |
|---|
| Episodes | INLINECODE8 | AI-directed short drama with storyboards and shot language |
| Narration |
narration | Narration-focused video |
|
Short Film |
short-film | Story and visuals balanced; cinematic short film |
Main Workflow: execute_workflow
Use execute_workflow to run the full workflow: submit + poll + auto-pay (if needed) + wait for completion. Call once and wait for return.
- 1. Submit task
- Poll progress every 3 seconds
- Detect pending payment and auto-pay (if needed)
- Wait for completion (max 1 hour)
- Return video download link or error
Function Signature
CODEBLOCK0
Parameter Description
| Parameter | Required | Description |
|---|
| diy_story | yes | Story or script content |
| aspect |
yes | Aspect ratio:
16:9 or
9:16 |
| project_name | yes | Project name |
| video_duration | no |
auto,
30,
60,
120,
180,
240,
300; default
"auto" |
| style_id | no | Style ID; omit if not specified |
| project_type | no |
director /
narration /
short-film; default
"director" |
| character_info | no | Character image list:
[{"name": "Character name", "url": "Image URL"}, ...] |
Usage Flow
- 1. Introduce and select generation mode (required): Before generating, must introduce the three modes and let the user choose. Display:
> We support three video generation modes. Please choose:
>
> Episodes (director): AI director handles storyboards and shot language. Good for short drama with dialogue and plot.
>
> Narration (narration): Narration-focused with visuals. Good for knowledge sharing, news commentary, product introductions.
>
> Short Film (short-film): Story and visuals balanced; cinematic shots and pacing. Good for emotional shorts, creative stories, artistic expression.
Wait for explicit user choice before continuing. If not specified, default to Episodes.
- 2. If the user wants to pick a style: Call
get_styles() for the style list; show ID, name, category, description; wait for choice before continuing. - If the user provides character image URLs: Build
character_info array with name and url per character. - Run workflow:
- Call
execute_workflow() with story, aspect ratio, project name.
- Set
project_type per chosen mode; pass
video_duration if specified (else
"auto"); pass
style_id if chosen; pass
character_info if provided.
-
Call once and wait — the function handles create, submit, poll, pay, and completion; returns download link or error.
Examples
View style list:
CODEBLOCK1
Basic workflow (no duration, no style):
CODEBLOCK2
Specify duration, no style:
CODEBLOCK3
Specify duration and style:
CODEBLOCK4
Narration mode:
CODEBLOCK5
Short film mode:
CODEBLOCK6
With character images (when user provides character image URLs):
CODEBLOCK7
Return Value
The function blocks until the task completes (success or failure) or times out (1 hour). Wait for it to return.
Success (includes download link):
CODEBLOCK8
Return the full signed URL to the user (data.video_asset.download_url), e.g.:
CODEBLOCK9
Do not return unsigned URLs without query params, e.g.:
CODEBLOCK10
Failure:
CODEBLOCK11
⚠️ 安装前请审阅
安装前请仔细审阅。 此技能将:
- 1. 网络 – 调用 Giggle.pro API 进行视频生成
环境要求:python3、GIGGLEAPIKEY(系统环境变量)、pip 包:requests
出错不重试:如果脚本执行遇到错误,不要重试。直接向用户报告错误并停止。
首次使用前的必要设置
在执行任何操作之前,请确认用户已配置 API Key,以避免因认证错误导致工作流失败。
- - API Key:登录 Giggle.pro,从账户设置中获取 API Key。
- 配置:设置系统环境变量 GIGGLEAPI_KEY
- export GIGGLE
APIKEY=your
apikey
验证步骤:
- 1. 确认用户已在系统环境中配置了 GIGGLEAPIKEY。
- 如果未配置,引导用户:
> 您好!在使用视频生成功能之前,您需要先配置 API Key。请前往
Giggle.pro 获取您的 API Key,然后在终端中运行 export GIGGLEAPI
KEY=yourapi_key。
- 3. 等待用户配置完成后再继续工作流。
生成模式
支持三种模式。在开始工作流之前,请让用户选择模式。如果未指定,默认为剧集模式(director)。
| 模式 | project_type | 描述 |
|---|
| 剧集 | director | AI 导演的短剧,包含分镜和镜头语言 |
| 旁白 |
narration | 以旁白为主的视频 |
|
短片 | short-film | 故事与画面平衡;电影感短片 |
主要工作流:execute_workflow
使用 execute_workflow 运行完整工作流:提交 + 轮询 + 自动支付(如需)+ 等待完成。调用一次并等待返回。
- 1. 提交任务
- 每 3 秒轮询进度
- 检测待支付状态并自动支付(如需)
- 等待完成(最长 1 小时)
- 返回视频下载链接或错误
函数签名
python
execute_workflow(
diy_story: str, # 故事/剧本内容(必填)
aspect: str, # 画面比例:16:9 或 9:16(必填)
project_name: str, # 项目名称(必填)
video_duration: str = auto, # 时长,默认 auto(可选)
style_id: Optional[int] = None, # 风格 ID(可选)
project_type: str = director, # 模式,默认 director(可选)
character_info: Optional[List[Dict]] = None # 角色图片(可选)
)
参数说明
| 参数 | 必填 | 描述 |
|---|
| diy_story | 是 | 故事或剧本内容 |
| aspect |
是 | 画面比例:16:9 或 9:16 |
| project_name | 是 | 项目名称 |
| video_duration | 否 | auto、30、60、120、180、240、300;默认 auto |
| style_id | 否 | 风格 ID;未指定则省略 |
| project_type | 否 | director / narration / short-film;默认 director |
| character_info | 否 | 角色图片列表:[{name: 角色名称, url: 图片URL}, ...] |
使用流程
- 1. 介绍并选择生成模式(必选):生成前,必须介绍三种模式并让用户选择。展示:
> 我们支持三种视频生成模式,请选择:
>
> 剧集(director):AI 导演处理分镜和镜头语言。适合有对话和情节的短剧。
>
> 旁白(narration):以旁白为主,配合画面。适合知识分享、新闻评论、产品介绍。
>
> 短片(short-film):故事与画面平衡;电影感的镜头和节奏。适合情感短片、创意故事、艺术表达。
等待用户明确选择后再继续。如果未指定,默认为剧集模式。
- 2. 如果用户想选择风格:调用 getstyles() 获取风格列表;展示 ID、名称、类别、描述;等待选择后再继续。
- 如果用户提供角色图片 URL:构建 characterinfo 数组,包含每个角色的 name 和 url。
- 运行工作流:
- 使用故事、画面比例、项目名称调用 execute_workflow()。
- 根据所选模式设置 project
type;如果指定了时长则传入 videoduration(否则为 auto);如果选择了风格则传入 style
id;如果提供了角色信息则传入 characterinfo。
-
调用一次并等待 — 该函数处理创建、提交、轮询、支付和完成;返回下载链接或错误。
示例
查看风格列表:
python
api = TrusteeModeAPI()
stylesresult = api.getstyles()
向用户展示风格列表
基础工作流(无时长、无风格):
python
api = TrusteeModeAPI()
result = api.execute_workflow(
diy_story=一个冒险故事...,
aspect=16:9,
project_name=我的视频项目
)
result 包含下载 URL 或错误
指定时长,无风格:
python
result = api.execute_workflow(
diy_story=一个冒险故事...,
aspect=16:9,
project_name=我的视频项目,
video_duration=60
)
指定时长和风格:
python
result = api.execute_workflow(
diy_story=一个冒险故事...,
aspect=16:9,
project_name=我的视频项目,
video_duration=60,
style_id=142
)
旁白模式:
python
result = api.execute_workflow(
diy_story=今天我们来聊聊 AI 的发展...,
aspect=16:9,
project_name=旁白视频,
project_type=narration
)
短片模式:
python
result = api.execute_workflow(
diy_story=夕阳西下。一位老渔夫独自划船回家。海面泛着红光...,
aspect=16:9,
project_name=短片,
project_type=short-film
)
带角色图片(当用户提供角色图片 URL 时):
python
result = api.execute_workflow(
diy_story=小明和小红在公园相遇,他们相视而笑...,
aspect=16:9,
project_name=自定义角色视频,
character_info=[
{name: 小明, url: https://xxx/xiaoming.jpg},
{name: 小红, url: https://xxx/xiaohong.jpg}
]
)
返回值
该函数会阻塞直到任务完成(成功或失败)或超时(1 小时)。等待其返回。
成功(包含下载链接):
json
{
code: 200,
msg: success,
uuid: ...,
data: {
project_id: ...,
video_asset: {...},
status: completed
}
}
向用户返回完整的签名 URL(data.videoasset.downloadurl),例如:
https://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.mp4
失败:
json
{
code: -1,
msg: 错误信息,
data: null
}