简体中文 | English
Giggle Image Generation (Multi-Model)
Source: giggle-official/skills · API: giggle.pro
Generates AI images via giggle.pro's Generation API. Supports multiple models (Seedream, Midjourney, Nano Banana). Submit task → query when ready. No polling or Cron.
API Key: Set system environment variable GIGGLE_API_KEY. The script will prompt if not configured.
No inline Python: All commands must be executed via the exec tool. Never use python3 << 'EOF' or heredoc inline code.
No Retry on Error: If script execution encounters an error, do not retry. Report the error to the user directly and stop.
Supported Models
| Model | Description |
|---|
| seedream45 | Seedream, realistic and creative |
| midjourney |
Midjourney style |
| nano-banana-2 | Nano Banana 2 |
| nano-banana-2-fast | Nano Banana 2 fast |
Execution Flow: Submit and Query
Image generation is asynchronous (typically 30–120 seconds). Submit a task to get task_id, then query when the user wants to check status.
Important: Never pass GIGGLE_API_KEY in exec's env parameter. API Key is read from system environment variable.
Step 1: Submit Task
CODEBLOCK0
Response example:
CODEBLOCK1
Store task_id in memory (addMemory):
CODEBLOCK2
Tell the user: "Image generation started. It usually takes 30–120 seconds. You can ask me 'is it ready?' to check the status."
Step 2: Query Task (when user asks for status)
CODEBLOCK3
Behavior:
- - completed: Output image links for user
- failed/error: Output error message
- processing/pending: Output JSON
{"status": "...", "task_id": "xxx"}; user can query again later
New Request vs Query Old Task
When the user initiates a new image generation request, run submit to create a new task. Do not reuse old task_id from memory.
When the user asks about a previous task's progress (e.g. "is it ready?", "check status"), query the task_id from memory.
Parameter Reference
| Parameter | Default | Description |
|---|
| INLINECODE8 | required | Image description prompt |
| INLINECODE9 |
seedream45 | seedream45, midjourney, nano-banana-2, nano-banana-2-fast |
|
--aspect-ratio | 16:9 | 16:9, 9:16, 1:1, 3:4, 4:3, 2:3, 3:2, 21:9 |
|
--resolution | 2K | Text-to-image: 1K, 2K, 4K (image-to-image partially supported) |
|
--generate-count | 1 | Number of images to generate |
|
--reference-images | - | Image-to-image reference; supports URL, base64, asset_id |
|
--watermark | false | Add watermark (image-to-image) |
Image-to-Image Reference: Three Input Methods
The image-to-image API's reference_images is an array of objects. Each element can be one of these three formats (can be mixed):
Method 1: URL
CODEBLOCK4
Method 2: Base64
CODEBLOCK5
Base64 format: Pass the raw Base64 string directly. Do not add the data:image/xxx;base64, prefix.
Method 3: asset_id
CODEBLOCK6
For multiple reference images, add more objects to the reference_images array.
Interaction Guide
When the user request is vague, guide per the steps below. If the user has provided enough info, run the command directly.
Step 1: Model Selection
CODEBLOCK7
Step 2: Aspect Ratio
CODEBLOCK8
Step 3: Generation Mode
CODEBLOCK9
Step 4: Execute and Display
Submit task → store task_id → inform user. When user asks for status, run query and forward stdout to user.
Link return rule: Image links in results must be full signed URLs (with Policy, Key-Pair-Id, Signature query params). Correct: https://assets.giggle.pro/...?Policy=...&Key-Pair-Id=...&Signature=.... Wrong: do not return unsigned URLs with only the base path (no query params).
Giggle 图像生成(多模型)
来源: giggle-official/skills · API: giggle.pro
通过 giggle.pro 的生成 API 生成 AI 图像。支持多种模型(Seedream、Midjourney、Nano Banana)。提交任务 → 就绪时查询。无需轮询或定时任务。
API 密钥: 设置系统环境变量 GIGGLEAPIKEY。若未配置,脚本会提示。
禁止内联 Python: 所有命令必须通过 exec 工具执行。切勿使用 python3 << EOF 或 heredoc 内联代码。
出错不重试: 若脚本执行遇到错误,不要重试。直接向用户报告错误并停止。
支持的模型
| 模型 | 描述 |
|---|
| seedream45 | Seedream,逼真且富有创意 |
| midjourney |
Midjourney 风格 |
| nano-banana-2 | Nano Banana 2 |
| nano-banana-2-fast | Nano Banana 2 快速版 |
执行流程:提交与查询
图像生成是异步的(通常 30–120 秒)。提交任务获取 task_id,然后在用户想查看状态时查询。
重要: 切勿在 exec 的 env 参数中传递 GIGGLEAPIKEY。API 密钥从系统环境变量读取。
步骤 1:提交任务
bash
文生图(默认 seedream45)
python3 scripts/generation_api.py \
--prompt 描述 --aspect-ratio 16:9 \
--model seedream45 --resolution 2K \
--no-wait --json
文生图 - Midjourney
python3 scripts/generation_api.py \
--prompt 描述 --model midjourney \
--aspect-ratio 16:9 --resolution 2K \
--no-wait --json
图生图 - 参考 URL
python3 scripts/generation_api.py \
--prompt 转换为油画风格,保持构图 \
--reference-images https://example.com/photo.jpg \
--model nano-banana-2-fast \
--no-wait --json
批量生成多张图像
python3 scripts/generation_api.py \
--prompt 描述 --generate-count 4 \
--no-wait --json
响应示例:
json
{status: started, task_id: xxx}
将 task_id 存入内存(addMemory):
giggle-generation-image task_id: xxx(提交时间:YYYY-MM-DD HH:mm)
告知用户:图像生成已开始。通常需要 30–120 秒。您可以问我准备好了吗?来查看状态。
步骤 2:查询任务(当用户询问状态时)
bash
python3 scripts/generationapi.py --query --task-id id>
行为:
- - completed:输出图像链接供用户使用
- failed/error:输出错误信息
- processing/pending:输出 JSON {status: ..., task_id: xxx};用户可稍后再次查询
新请求 vs 查询旧任务
当用户发起新的图像生成请求时,运行提交以创建新任务。不要重复使用内存中的旧 task_id。
当用户询问之前任务的进度时(例如准备好了吗?、查看状态),从内存中查询 task_id。
参数参考
| 参数 | 默认值 | 描述 |
|---|
| --prompt | 必填 | 图像描述提示词 |
| --model |
seedream45 | seedream45、midjourney、nano-banana-2、nano-banana-2-fast |
| --aspect-ratio | 16:9 | 16:9、9:16、1:1、3:4、4:3、2:3、3:2、21:9 |
| --resolution | 2K | 文生图:1K、2K、4K(图生图部分支持) |
| --generate-count | 1 | 生成图像数量 |
| --reference-images | - | 图生图参考;支持 URL、base64、asset_id |
| --watermark | false | 添加水印(图生图) |
图生图参考:三种输入方式
图生图 API 的 reference_images 是一个对象数组。每个元素可以是以下三种格式之一(可混合使用):
方式 1:URL
json
{
prompt: 一只可爱的橘猫坐在阳光下的窗台上,写实风格,
reference_images: [
{
url: https://assets.giggle.pro/private/example/image.jpg?Policy=EXAMPLEPOLICY&Key-Pair-Id=EXAMPLEKEYPAIRID&Signature=EXAMPLE_SIGNATURE
}
],
generate_count: 1,
model: nano-banana-2-fast,
aspect_ratio: 16:9,
watermark: false
}
方式 2:Base64
json
{
prompt: 一只可爱的橘猫坐在阳光下的窗台上,写实风格,
reference_images: [
{
base64: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
}
],
generate_count: 1,
model: nano-banana-2-fast,
aspect_ratio: 16:9,
watermark: false
}
Base64 格式:直接传递原始 Base64 字符串。不要添加 data:image/xxx;base64, 前缀。
方式 3:asset_id
json
{
prompt: 一只可爱的橘猫坐在阳光下的窗台上,写实风格,
reference_images: [
{
asset_id: vvsdsfsdf
}
],
generate_count: 1,
model: nano-banana-2-fast,
aspect_ratio: 16:9,
watermark: false
}
如需多张参考图像,在 reference_images 数组中添加更多对象。
交互指南
当用户请求模糊时,按以下步骤引导。如果用户已提供足够信息,直接运行命令。
步骤 1:模型选择
问题:您想使用哪个模型?
标题:图像模型
选项:
- - seedream45 - 逼真且富有创意(推荐)
- midjourney - 艺术风格
- nano-banana-2 - 高质量
- nano-banana-2-fast - 快速生成
multiSelect: false
步骤 2:宽高比
问题:您需要什么宽高比?
标题:宽高比
选项:
- - 16:9 - 横屏(壁纸/封面)(推荐)
- 9:16 - 竖屏(手机)
- 1:1 - 正方形
- 其他比例
multiSelect: false
步骤 3:生成模式
问题:您需要参考图像吗?
标题:生成模式
选项:
- - 不需要 - 仅文生图
- 需要 - 图生图(风格迁移)
multiSelect: false
步骤 4:执行与展示
提交任务 → 存储 task_id → 告知用户。当用户询问状态时,运行查询并将标准输出转发给用户。
链接返回规则:结果中的图像链接必须是完整的签名 URL(包含 Policy、Key-Pair-Id、Signature 查询参数)。正确示例:https://assets.giggle.pro/...?Policy=...&Key-Pair-Id=...&Signature=...。错误示例:不要返回仅包含基础路径(无查询参数)的未签名 URL。