tuzi-image-gen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Generation (AI SDK)
图片生成(AI SDK)
Multi-provider image generation. Default provider: Tuzi (兔子API, api.tu-zi.com).
多供应商图片生成能力。默认供应商:Tuzi(兔子API,api.tu-zi.com)。
Script Directory
脚本目录
Agent Execution:
- = this SKILL.md file's directory
SKILL_DIR - Script path =
${SKILL_DIR}/scripts/main.ts
Agent 执行规则:
- = 本 SKILL.md 文件所在的目录
SKILL_DIR - 脚本路径 =
${SKILL_DIR}/scripts/main.ts
Step 0: Load Preferences ⛔ BLOCKING
步骤0:加载偏好设置 ⛔ 阻塞步骤
CRITICAL: This step MUST complete BEFORE any image generation. Do NOT skip or defer.
关键提示:本步骤必须在任何图片生成操作之前全部完成,禁止跳过或延后执行。
0.1 Check API Key
0.1 检查API密钥
Check if the selected provider's API key is available. For Tuzi (default):
bash
undefined检查选中的供应商的API密钥是否可用。对于默认的Tuzi供应商:
bash
undefinedCheck env, then .tuzi-skills/.env files
先检查环境变量,再检查 .tuzi-skills/.env 文件
echo "${TUZI_API_KEY:-not_set}"
grep -s TUZI_API_KEY .tuzi-skills/.env "$HOME/.tuzi-skills/.env"
| Result | Action |
|--------|--------|
| Key found | Continue to Step 0.2 |
| Key NOT found | ⛔ Run API key setup (see [references/config/first-time-setup.md](references/config/first-time-setup.md) → "API Key Setup") → Store key → Then continue |
**CRITICAL**: If API key is missing, MUST guide user to obtain and store it BEFORE any generation. Generation is BLOCKED until key is configured.echo "${TUZI_API_KEY:-not_set}"
grep -s TUZI_API_KEY .tuzi-skills/.env "$HOME/.tuzi-skills/.env"
| 结果 | 操作 |
|--------|--------|
| 找到密钥 | 继续执行步骤0.2 |
| 未找到密钥 | ⛔ 运行API密钥配置流程(参见[references/config/first-time-setup.md](references/config/first-time-setup.md) → "API Key Setup")→ 存储密钥 → 再继续后续流程 |
**关键提示**:如果缺少API密钥,必须先引导用户获取并存储密钥,才能执行生成操作。密钥配置完成前图片生成功能处于阻塞状态。0.2 Check EXTEND.md
0.2 检查EXTEND.md文件
Check EXTEND.md existence (priority: project → user):
bash
test -f .tuzi-skills/tuzi-image-gen/EXTEND.md && echo "project"
test -f "$HOME/.tuzi-skills/tuzi-image-gen/EXTEND.md" && echo "user"| Result | Action |
|---|---|
| Found | Load, parse, apply settings. If |
| Not found | ⛔ Run first-time setup (references/config/first-time-setup.md) → Save EXTEND.md → Then continue |
CRITICAL: If not found, complete the full setup (provider + model + quality + save location) using AskUserQuestion BEFORE generating any images. Generation is BLOCKED until EXTEND.md is created.
| Path | Location |
|---|---|
| Project directory |
| User home |
EXTEND.md Supports: Default provider | Default quality | Default aspect ratio | Default image size | Default models
Schema:
references/config/preferences-schema.md检查EXTEND.md文件是否存在(优先级:项目目录 > 用户目录):
bash
test -f .tuzi-skills/tuzi-image-gen/EXTEND.md && echo "project"
test -f "$HOME/.tuzi-skills/tuzi-image-gen/EXTEND.md" && echo "user"| 结果 | 操作 |
|---|---|
| 找到文件 | 加载、解析并应用配置。如果 |
| 未找到文件 | ⛔ 运行首次配置流程(references/config/first-time-setup.md)→ 保存EXTEND.md → 再继续后续流程 |
关键提示:如果未找到文件,必须在生成任何图片前通过AskUserQuestion完成完整配置(供应商 + 模型 + 画质 + 保存位置)。EXTEND.md创建完成前图片生成功能处于阻塞状态。
| 路径 | 存放位置 |
|---|---|
| 项目目录 |
| 用户根目录 |
EXTEND.md支持配置项:默认供应商 | 默认画质 | 默认宽高比 | 默认图片尺寸 | 默认模型
配置规范参考:
references/config/preferences-schema.mdUsage
使用方式
bash
undefinedbash
undefinedBasic (uses Tuzi provider by default)
基础用法(默认使用Tuzi供应商)
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image cat.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image cat.png
With aspect ratio
指定宽高比
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9
With quality (Tuzi: 1k/2k/4k)
指定画质(Tuzi支持1k/2k/4k)
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --quality 2k
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --quality 2k
4K VIP model
使用4K VIP模型
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --model gemini-3-pro-image-preview-4k-vip
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --model gemini-3-pro-image-preview-4k-vip
With reference images
使用参考图
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Make it blue" --image out.png --ref source.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Make it blue" --image out.png --ref source.png
From prompt files
从prompt文件读取提示词
npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png
Async model (auto-polls)
异步模型(自动轮询结果)
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --model gemini-3-pro-image-preview-2k-async
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --model gemini-3-pro-image-preview-2k-async
Other providers
使用其他供应商
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider google
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider openai
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "一只可爱的猫" --image out.png --provider dashscope
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate
undefinednpx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider google
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider openai
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "一只可爱的猫" --image out.png --provider dashscope
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate
undefinedOptions
可用参数
| Option | Description |
|---|---|
| Prompt text |
| Read prompt from files (concatenated) |
| Output image path (required) |
| Force provider (default: auto-detect, Tuzi first) |
| Model ID (see Tuzi Models section for full list) |
| Aspect ratio (e.g., |
| Size override (e.g., |
| Quality preset. Tuzi: maps to 1k/2k. Google: maps to 1K/2K |
| Image size (Tuzi and Google). Overrides |
| Reference images. Tuzi: base64 in JSON body. Google: multimodal. OpenAI: edits API |
| Number of images |
| JSON output |
| 参数 | 说明 |
|---|---|
| 提示词文本 |
| 从文件读取提示词(内容自动拼接) |
| 输出图片路径(必填) |
| 强制指定供应商(默认:自动检测,优先使用Tuzi) |
| 模型ID(完整列表参考Tuzi模型章节) |
| 宽高比(例如 |
| 自定义尺寸覆盖(例如 |
| 画质预设。Tuzi对应1k/2k,Google对应1K/2K |
| 图片尺寸(仅Tuzi和Google支持),优先级高于 |
| 参考图片。Tuzi:JSON体中base64编码;Google:多模态输入;OpenAI:编辑API |
| 生成图片数量 |
| 输出JSON格式结果 |
Tuzi Models
Tuzi模型列表
Tuzi API (api.tu-zi.com) is the default provider. Models differ in quality, speed, and supported parameters.
Tuzi API(api.tu-zi.com)是默认供应商,不同模型在画质、速度和支持参数上存在差异。
Recommended
推荐模型
| Model ID | Alias | Quality | Notes |
|---|---|---|---|
| nano-banana-pro | | Default. High quality, supports quality param |
| nano-banana-2 | | Fast, supports extended aspect ratios |
| nano-banana-pro-vip | 1k built-in | High quality, VIP |
| nano-banana-pro-2k-vip | 2k built-in | High quality 2K, VIP |
| nano-banana-pro-4k-vip | 4k built-in | High quality 4K, VIP |
| nano-banana-vip | 1k built-in | Fastest, VIP |
| 模型ID | 别名 | 画质 | 说明 |
|---|---|---|---|
| nano-banana-pro | | 默认模型,画质高,支持画质参数调整 |
| nano-banana-2 | | 速度快,支持更多特殊宽高比 |
| nano-banana-pro-vip | 内置1k | 高画质,VIP专属 |
| nano-banana-pro-2k-vip | 内置2k | 高画质2K,VIP专属 |
| nano-banana-pro-4k-vip | 内置4k | 高画质4K,VIP专属 |
| nano-banana-vip | 内置1k | 速度最快,VIP专属 |
More Models
更多模型
| Model ID | Alias | Notes |
|---|---|---|
| nano-banana-pro | |
| nano-banana | Fast |
| nano-banana-pro-hd | HD built-in |
| nano-banana-pro-2k | 2K built-in |
| nano-banana-pro-4k | 4K built-in |
| — | Size: 1:1, 3:2, 2:3 only |
| flux-2-pro | Flux |
| flux-2-max | Flux highest quality |
| kontext-pro | Multi-ref editing |
| kontext-max | Multi-ref editing (max) |
| Seedream 4.0 | 2K/4K |
| Seedream 4.5 | 2K/4K |
| Seedream 5.0 lite | 2K/3K |
| 模型ID | 别名 | 说明 |
|---|---|---|
| nano-banana-pro | |
| nano-banana | 速度快 |
| nano-banana-pro-hd | 内置HD画质 |
| nano-banana-pro-2k | 内置2K画质 |
| nano-banana-pro-4k | 内置4K画质 |
| — | 仅支持1:1、3:2、2:3尺寸 |
| flux-2-pro | Flux系列 |
| flux-2-max | Flux系列最高画质 |
| kontext-pro | 支持多参考图编辑 |
| kontext-max | 支持多参考图编辑(最高规格) |
| Seedream 4.0 | 支持2K/4K |
| Seedream 4.5 | 支持2K/4K |
| Seedream 5.0 lite | 支持2K/3K |
Async Models
异步模型
Auto-detected. Script submits task and polls until complete (5s interval, max 30min).
| Model ID | Notes |
|---|---|
| 1K async |
| 2K async |
| 4K async |
| Midjourney, MJ params in prompt |
自动识别,脚本会提交任务后自动轮询结果(轮询间隔5秒,最长等待30分钟)。
| 模型ID | 说明 |
|---|---|
| 1K异步 |
| 2K异步 |
| 4K异步 |
| Midjourney模型,提示词中支持MJ参数 |
Model-Specific Parameters
模型专属参数
Quality ( or ):
--quality--imageSize 1K|2K|4K| Applies to | Values | Notes |
|---|---|---|
| 1k / 2k / 4k | Default model, quality adjustable |
| 1k / 2k / 4k | Quality adjustable |
| — | Quality built into model name, param ignored |
| Other models | — | Param ignored |
Aspect ratio ():
--ar| Applies to | Supported ratios |
|---|---|
| Gemini models (default) | 1:1, 16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 21:9 |
| Above + 1:4, 4:1, 1:8, 8:1 (extreme ratios) |
| 1:1, 3:2, 2:3 |
| Omitted | Model auto-decides |
Reference images ():
--ref- Sync models: base64 data URL in JSON field
image - Async models: in FormData
input_reference - All Tuzi models support reference images
画质( 或 ):
--quality--imageSize 1K|2K|4K| 适用模型 | 可选值 | 说明 |
|---|---|---|
| 1k / 2k / 4k | 默认模型,支持画质调整 |
| 1k / 2k / 4k | 支持画质调整 |
| — | 画质已内置在模型名称中,参数无效 |
| 其他模型 | — | 参数无效 |
宽高比():
--ar| 适用模型 | 支持比例 |
|---|---|
| 默认Gemini系列模型 | 1:1、16:9、9:16、3:2、2:3、4:3、3:4、5:4、4:5、21:9 |
| 以上比例 + 1:4、4:1、1:8、8:1(极端比例) |
| 1:1、3:2、2:3 |
| 未指定 | 模型自动决定 |
参考图片():
--ref- 同步模型:JSON的字段传入base64格式的data URL
image - 异步模型:FormData的字段传入
input_reference - 所有Tuzi模型均支持参考图片功能
Environment Variables
环境变量
| Variable | Description |
|---|---|
| Tuzi API key (https://api.tu-zi.com) |
| Tuzi default model (default: gemini-3-pro-image-preview) |
| Custom Tuzi endpoint (default: https://api.tu-zi.com/v1) |
| Google API key |
| OpenAI API key |
| DashScope API key (阿里云) |
| Replicate API token |
| Google model override |
| OpenAI model override |
| DashScope model override |
| Replicate model override |
| Custom Google endpoint |
| Custom OpenAI endpoint |
| Custom DashScope endpoint |
| Custom Replicate endpoint |
Load Priority: CLI args > EXTEND.md > env vars > >
<cwd>/.tuzi-skills/.env~/.tuzi-skills/.env| 变量名 | 说明 |
|---|---|
| Tuzi API密钥(https://api.tu-zi.com) |
| Tuzi默认模型(默认:gemini-3-pro-image-preview) |
| 自定义Tuzi接口地址(默认:https://api.tu-zi.com/v1) |
| Google API密钥 |
| OpenAI API密钥 |
| DashScope(阿里云)API密钥 |
| Replicate API令牌 |
| Google模型自定义覆盖 |
| OpenAI模型自定义覆盖 |
| DashScope模型自定义覆盖 |
| Replicate模型自定义覆盖 |
| 自定义Google接口地址 |
| 自定义OpenAI接口地址 |
| 自定义DashScope接口地址 |
| 自定义Replicate接口地址 |
加载优先级:CLI参数 > EXTEND.md配置 > 环境变量 > >
<cwd>/.tuzi-skills/.env~/.tuzi-skills/.envModel Resolution
模型选择规则
Priority (highest → lowest), all providers:
- CLI:
--model <id> - EXTEND.md:
default_model.[provider] - Env var:
<PROVIDER>_IMAGE_MODEL - Built-in default
Agent MUST display model info before each generation:
- Show:
Using [provider] / [model] - Show switch hint:
Switch model: --model <id> | EXTEND.md default_model.[provider] | env <PROVIDER>_IMAGE_MODEL
所有供应商通用,优先级从高到低:
- CLI参数:
--model <id> - EXTEND.md配置:
default_model.[provider] - 环境变量:
<PROVIDER>_IMAGE_MODEL - 内置默认值
Agent必须在每次生成前展示模型信息:
- 展示内容:
Using [provider] / [model] - 展示切换提示:
Switch model: --model <id> | EXTEND.md default_model.[provider] | env <PROVIDER>_IMAGE_MODEL
Provider Selection
供应商选择规则
- specified → use it
--provider - provided + no
--ref→ Tuzi > Google > OpenAI > Replicate--provider - Only one API key available → use that provider
- Multiple available → Tuzi first
- 指定了→ 使用指定供应商
--provider - 提供了且未指定
--ref→ 优先级Tuzi > Google > OpenAI > Replicate--provider - 仅存在一个可用API密钥 → 使用对应供应商
- 多个可用密钥 → 优先使用Tuzi
Quality Presets
画质预设映射
| Preset | Tuzi | OpenAI | |
|---|---|---|---|
| 1k | 1K | 1024px |
| 2k | 2K | 2048px |
--imageSize 1K|2K|4K| 预设值 | Tuzi | OpenAI | |
|---|---|---|---|
| 1k | 1K | 1024px |
| 2k | 2K | 2048px |
--imageSize 1K|2K|4KGeneration Mode
生成模式
Default: Sequential (one at a time).
Parallel: Only when user explicitly requests. Use Task tool with , recommended 4 subagents (max 8).
run_in_background=true默认:串行生成(一次生成一张)
并行生成:仅当用户明确要求时启用。使用Task工具设置,推荐最多4个子Agent(上限8个)。
run_in_background=trueError Handling
错误处理
- Missing API key → ⛔ MUST run API key setup from Step 0.1 (guide user to https://api.tu-zi.com/token, store in .tuzi-skills/.env). Do NOT suggest GOOGLE_API_KEY or other provider keys unless user explicitly chose a different provider.
- Generation failure → auto-retry once
- Tuzi → content rejection error
PROHIBITED_CONTENT - Tuzi → prompt too vague, suggest more explicit prompt
NO_IMAGE - Async timeout → error after 30 minutes
- Invalid aspect ratio → warning, proceed with default
- 缺少API密钥 → ⛔ 必须执行步骤0.1的API密钥配置流程(引导用户访问https://api.tu-zi.com/token,存储到.tuzi-skills/.env)。除非用户明确选择其他供应商,否则不要推荐GOOGLE_API_KEY或其他供应商的密钥。
- 生成失败 → 自动重试1次
- Tuzi返回→ 返回内容违规错误
PROHIBITED_CONTENT - Tuzi返回→ 提示词太模糊,建议用户提供更明确的提示词
NO_IMAGE - 异步任务超时 → 30分钟后返回超时错误
- 宽高比无效 → 输出警告,使用默认比例继续执行
Replicate Models
Replicate模型使用
Format: or
owner/nameowner/name:versionbash
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate --model google/nano-banana格式: 或
owner/nameowner/name:versionbash
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate --model google/nano-bananaExtension Support
扩展支持
Custom configurations via EXTEND.md. See Step 0 for paths and supported options.
通过EXTEND.md实现自定义配置,路径和支持的配置项参考步骤0。