generate-image
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenerate Image Skill
Generate Image Skill
中文说明
中文说明
功能概述
功能概述
generate-image/gi-setup/gi默认行为:
- 默认模型:(兼容旧配置里的
gpt-image-2/gpt-image2,helper 会映射为auto)gpt-image-2 - 默认出图比例:(从提示词获取;未获取到则使用 API
custom)auto - 默认清晰度:(指定明确比例时会换算为实际 API
1k)size - 默认输出目录:项目目录下
.claybe/.generate-image/ - 默认配置文件:
~/.claude/generate-image/config.json
generate-image/gi-setup/gi默认行为:
- 默认模型:(兼容旧配置里的
gpt-image-2/gpt-image2,helper 会映射为auto)gpt-image-2 - 默认出图比例:(从提示词获取;未获取到则使用 API
custom)auto - 默认清晰度:(指定明确比例时会换算为实际 API
1k)size - 默认输出目录:项目目录下
.claybe/.generate-image/ - 默认配置文件:
~/.claude/generate-image/config.json
Slash 命令
斜杠命令
/gi-setup
/gi-setup/gi-setup
/gi-setup用于保存 API 配置。按步骤引导用户提供:
- URL(API Base URL)
- API Key
- 是否使用默认模型
gpt-image-2
如果用户已提供部分参数,只追问缺失项。也支持直接读取项目 :
setting.jsontext
/gi-setup --use-settings对应 helper:
bash
node skill/generate-image/scripts/generate-image.mjs setup --use-settings或:
bash
node skill/generate-image/scripts/generate-image.mjs setup --url <url> --apikey <apikey> --model gpt-image-2setting.jsonapiBaseUrlapiKeymodelurlapikeygenerateImagegenerate-image用于保存 API 配置。按步骤引导用户提供:
- URL(API Base URL)
- API Key
- 是否使用默认模型
gpt-image-2
如果用户已提供部分参数,只追问缺失项。也支持直接读取项目 :
setting.jsontext
/gi-setup --use-settings对应 helper:
bash
node skill/generate-image/scripts/generate-image.mjs setup --use-settings或:
bash
node skill/generate-image/scripts/generate-image.mjs setup --url <url> --apikey <apikey> --model gpt-image-2setting.jsonapiBaseUrlapiKeymodelurlapikeygenerateImagegenerate-image/gi
/gi/gi
/gi用于生成图片。支持 CLI 风格参数,也支持从自然语言中提取参数:
text
/gi 一张赛博朋克风格的上海夜景,出图比例 3:2,清晰度 1k,quality=high output-file=./.claybe/.generate-image/shanghai.png当配置缺失时,不要只报错;进入 引导用户配置 URL/API Key,或询问是否使用项目 。
/gi-setupsetting.json用于生成图片。支持 CLI 风格参数,也支持从自然语言中提取参数:
text
/gi 一张赛博朋克风格的上海夜景,出图比例 3:2,清晰度 1k,quality=high output-file=./.claybe/.generate-image/shanghai.png当配置缺失时,不要只报错;进入 引导用户配置 URL/API Key,或询问是否使用项目 。
/gi-setupsetting.jsonAgent 执行规则
Agent 执行规则
- 从 输入中提取:
/giprompt- /
aspect-ratio/ratio比例 - /
resolution/清晰度档位 modeloutputoutput-fileindex- /
urlapikey - 其他 参数,作为
key=value透传--param key=value
- 如果未指定出图比例,使用 :优先从提示词提取
custom、16:9、9:16、3:2、4:3;如果提示词没有比例,则使用 API1:1。如果未指定清晰度,使用auto。1k - 如果未指定 ,使用
model。gpt-image-2 - 组织 prompt 时保留用户意图,并补齐资产描述结构:
[资产名称/用途] + [资产类型] + [具体主体] + [艺术风格] + [视角] + [光影细节] + [背景要求]
- 每张图只生成一个主体。不要把多个资产、多个变体或多个主体放在同一张图里;多个资产应分别调用 ,生成独立贴图。
/gi - 生成时启动名为 的后台 subagent,让它运行 helper 的
painter命令。helper 会创建占位图、调用 API、保存最终图并更新索引。generate模型默认先尝试流式生成:如果流式响应没有最终完成图但包含草稿/中间图,会使用最后一张可用图片;如果流式响应完全没有图片或接口拒绝 stream,会自动回退一次普通非流式生成。gpt-image* - 完成后,报告生成图路径、占位图路径和索引路径。
painter - 如果失败,报告明确错误,并说明占位图已保留。响应中没有图片数据通常表示接口/代理返回空 、流式事件缺少可用图片,或连接在最终图片事件前中断;生成请求本身不能续传,只能重新发起。
data
helper 调用格式:
bash
node skill/generate-image/scripts/generate-image.mjs generate --prompt "<prompt>" --aspect-ratio <custom|16:9|9:16|3:2|4:3|1:1> --resolution <1k|2k|4k> [other args]- 从 输入中提取:
/giprompt- /
aspect-ratio/ratio比例 - /
resolution/清晰度档位 modeloutputoutput-fileindex- /
urlapikey - 其他 参数,作为
key=value透传--param key=value
- 如果未指定出图比例,使用 :优先从提示词提取
custom、16:9、9:16、3:2、4:3;如果提示词没有比例,则使用 API1:1。如果未指定清晰度,使用auto。1k - 如果未指定 ,使用
model。gpt-image-2 - 组织 prompt 时保留用户意图,并补齐资产描述结构:
[资产名称/用途] + [资产类型] + [具体主体] + [艺术风格] + [视角] + [光影细节] + [背景要求]
- 每张图只生成一个主体。不要把多个资产、多个变体或多个主体放在同一张图里;多个资产应分别调用 ,生成独立贴图。
/gi - 生成时启动名为 的后台 subagent,让它运行 helper 的
painter命令。helper 会创建占位图、调用 API、保存最终图并更新索引。generate模型默认先尝试流式生成:如果流式响应没有最终完成图但包含草稿/中间图,会使用最后一张可用图片;如果流式响应完全没有图片或接口拒绝 stream,会自动回退一次普通非流式生成。gpt-image* - 完成后,报告生成图路径、占位图路径和索引路径。
painter - 如果失败,报告明确错误,并说明占位图已保留。响应中没有图片数据通常表示接口/代理返回空 、流式事件缺少可用图片,或连接在最终图片事件前中断;生成请求本身不能续传,只能重新发起。
data
helper 调用格式:
bash
node skill/generate-image/scripts/generate-image.mjs generate --prompt "<prompt>" --aspect-ratio <custom|16:9|9:16|3:2|4:3|1:1> --resolution <1k|2k|4k> [other args]参数表
参数表
| 参数 | 说明 | 默认值 |
|---|---|---|
| 图片提示词,也可作为位置参数传入 | 必填 |
| 出图比例: | |
| 清晰度档位: | |
| 图片模型名称 | |
| API base URL 覆盖值 | 初始化配置中的值 |
| API Key 覆盖值 | 初始化配置中的值 |
| 输出目录;如果以 | |
| 最终图片文件路径 | 无 |
| 图片索引字典文件路径 | |
| 透传给生成接口的额外参数,可重复 | 无 |
| 自定义配置文件路径 | |
| 参数 | 说明 | 默认值 |
|---|---|---|
| 图片提示词,也可作为位置参数传入 | 必填 |
| 出图比例: | |
| 清晰度档位: | |
| 图片模型名称 | |
| API base URL 覆盖值 | 初始化配置中的值 |
| API Key 覆盖值 | 初始化配置中的值 |
| 输出目录;如果以 | |
| 最终图片文件路径 | 无 |
| 图片索引字典文件路径 | |
| 透传给生成接口的额外参数,可重复 | 无 |
| 自定义配置文件路径 | |
输出行为
输出行为
- PNG 占位图:先写入最终图片路径
- 生成图:生成成功后用真实图片覆盖同一路径,路径默认会从资产名称/用途或具体主体生成,例如 或
小飞机-<timestamp>.png/ 文件型--output-file指定路径--output - 索引字典:默认
<输出目录>/image-index.json
索引键为图片路径;成功时 与 相同,值包含 、、、、、、 和时间戳。失败时会记录错误,并在同一路径保留占位图。
placeholderPathgeneratedPathpromptplaceholderPathgeneratedPathresultmodelsizeparams- PNG 占位图:先写入最终图片路径
- 生成图:生成成功后用真实图片覆盖同一路径,路径默认会从资产名称/用途或具体主体生成,例如 或
小飞机-<timestamp>.png/ 文件型--output-file指定路径--output - 索引字典:默认
<输出目录>/image-index.json
索引键为图片路径;成功时 与 相同,值包含 、、、、、、 和时间戳。失败时会记录错误,并在同一路径保留占位图。
placeholderPathgeneratedPathpromptplaceholderPathgeneratedPathresultmodelsizeparams安全注意事项
安全注意事项
- 不要把 API Key 写进项目代码、README、issue、PR 或聊天摘要。
- 临时覆盖 API Key 时优先使用命令参数。
- helper 只把 API Key 写入用户目录 。
~/.claude/generate-image/config.json
- 不要把 API Key 写进项目代码、README、issue、PR 或聊天摘要。
- 临时覆盖 API Key 时优先使用命令参数。
- helper 只把 API Key 写入用户目录 。
~/.claude/generate-image/config.json
English Guide
英文指南(翻译后)
Overview
概述
generate-image/gi-setup/giDefaults:
- Model: (legacy
gpt-image-2/gpt-image2config values are mapped toautoby the helper)gpt-image-2 - Aspect ratio: (extract from the prompt; if none is found, API
customis used)auto - Resolution tier: (converted to the actual API
1kwhen a concrete ratio is available)size - Output directory: under the project directory
.claybe/.generate-image/ - Config file:
~/.claude/generate-image/config.json
generate-image/gi-setup/gi默认设置:
- 模型:(旧配置中的
gpt-image-2/gpt-image2会被 helper 映射为auto)gpt-image-2 - 出图比例:(从提示词提取;未提取到则使用 API
custom)auto - 清晰度档位:(指定明确比例时会换算为实际 API
1k)size - 输出目录:项目目录下的
.claybe/.generate-image/ - 配置文件:
~/.claude/generate-image/config.json
Slash commands
斜杠命令
/gi-setup
/gi-setup/gi-setup
/gi-setupSaves API settings. Guide the user step by step for:
- URL (API Base URL)
- API Key
- Whether to keep the default model
gpt-image-2
If the user already provided some values, only ask for the missing ones. The project can also be used:
setting.jsontext
/gi-setup --use-settingsHelper command:
bash
node skill/generate-image/scripts/generate-image.mjs setup --use-settingsor:
bash
node skill/generate-image/scripts/generate-image.mjs setup --url <url> --apikey <apikey> --model gpt-image-2setting.jsonapiBaseUrlapiKeymodelurlapikeygenerateImagegenerate-image用于保存 API 设置。按步骤引导用户提供:
- URL(API Base URL)
- API Key
- 是否保留默认模型
gpt-image-2
如果用户已提供部分参数,仅询问缺失项。也可使用项目的 :
setting.jsontext
/gi-setup --use-settings对应 helper 命令:
bash
node skill/generate-image/scripts/generate-image.mjs setup --use-settings或:
bash
node skill/generate-image/scripts/generate-image.mjs setup --url <url> --apikey <apikey> --model gpt-image-2setting.jsonapiBaseUrlapiKeymodelurlapikeygenerateImagegenerate-image/gi
/gi/gi
/giGenerates an image. It accepts CLI-style parameters and can also extract parameters from natural language:
text
/gi a cyberpunk night view of Shanghai, aspect-ratio 3:2, resolution 1k, quality=high output-file=./.claybe/.generate-image/shanghai.pngIf configuration is missing, do not only fail. Enter the flow and ask for URL/API Key, or ask whether to use the project .
/gi-setupsetting.json用于生成图片。支持 CLI 风格参数,也可从自然语言中提取参数:
text
/gi a cyberpunk night view of Shanghai, aspect-ratio 3:2, resolution 1k, quality=high output-file=./.claybe/.generate-image/shanghai.png如果配置缺失,不要直接报错。进入 流程,请求用户提供 URL/API Key,或询问是否使用项目的 。
/gi-setupsetting.jsonAgent rules
Agent 执行规则
- Extract from input:
/giprompt- /
aspect-ratio/ratio比例 - /
resolution/清晰度档位 modeloutputoutput-fileindex- /
urlapikey - other pairs as passthrough
key=value--param key=value
- Use when aspect ratio is not specified: extract
custom,16:9,9:16,3:2, or4:3from the prompt first; if no ratio is found, use API1:1. Useautowhen resolution tier is not specified.1k - Use when
gpt-image-2is not specified.model - Preserve the user's intent while completing this asset prompt structure:
[asset name/purpose] + [asset type] + [specific subject] + [art style] + [view angle] + [lighting details] + [background requirements]
- Generate one subject per image. Do not put multiple assets, variants, or subjects into one image; call separately for independent textures.
/gi - Start a background subagent named and have it run the helper
paintercommand. The helper creates the placeholder, calls the API, saves the final image, and updates the index.generatemodels try streaming first by default: if the stream has no final completed image but includes draft/intermediate image data, the helper uses the latest available image; if the stream contains no image at all or the endpoint rejects streaming, it automatically retries once without streaming.gpt-image* - When finishes, report the generated image path, placeholder path, and index path.
painter - On failure, report the clear error and mention that the placeholder remains available. No image data in the response usually means the endpoint/proxy returned empty , stream events had no usable image, or the connection ended before the final image event; the generation request itself cannot be resumed and must be started again.
data
Helper command format:
bash
node skill/generate-image/scripts/generate-image.mjs generate --prompt "<prompt>" --aspect-ratio <custom|16:9|9:16|3:2|4:3|1:1> --resolution <1k|2k|4k> [other args]- 从 输入中提取:
/giprompt- /
aspect-ratio/ratio比例 - /
resolution/清晰度档位 modeloutputoutput-fileindex- /
urlapikey - 其他 键值对,作为
key=value透传--param key=value
- 未指定出图比例时使用 :优先从提示词提取
custom、16:9、9:16、3:2或4:3;未提取到则使用 API1:1。未指定清晰度档位时使用auto。1k - 未指定 时使用
model。gpt-image-2 - 保留用户意图的同时,补全资产提示词结构:
[资产名称/用途] + [资产类型] + [具体主体] + [艺术风格] + [视角] + [光影细节] + [背景要求]
- 每张图仅生成一个主体。不要将多个资产、变体或主体放入同一张图;多个资产需分别调用 ,生成独立贴图。
/gi - 启动名为 的后台 subagent,让其运行 helper 的
painter命令。helper 会创建占位图、调用 API、保存最终图片并更新索引。generate模型默认优先尝试流式生成:如果流式响应无最终完成图但包含草稿/中间图数据,helper 会使用最新可用图片;如果流式响应完全无图片或端点拒绝流式请求,会自动重试一次非流式生成。gpt-image* - 完成后,报告生成图片路径、占位图路径和索引路径。
painter - 生成失败时,报告明确错误并说明占位图已保留。响应中无图片数据通常表示端点/代理返回空 、流式事件无可用图片,或连接在最终图片事件前中断;生成请求无法续传,只能重新发起。
data
helper 调用格式:
bash
node skill/generate-image/scripts/generate-image.mjs generate --prompt "<prompt>" --aspect-ratio <custom|16:9|9:16|3:2|4:3|1:1> --resolution <1k|2k|4k> [other args]Parameters
参数表
| Parameter | Meaning | Default |
|---|---|---|
| Image prompt; can also be positional text | Required |
| Aspect ratio: | |
| Resolution tier: | |
| Image model name | |
| API base URL override | Config value |
| API key override | Config value |
| Output directory; image-extension paths are treated as final file paths | |
| Final image file path | None |
| Image index dictionary path | |
| Extra API parameter; repeatable | None |
| Custom config file path | |
| 参数 | 说明 | 默认值 |
|---|---|---|
| 图片提示词;也可作为位置文本传入 | 必填 |
| 出图比例: | |
| 清晰度档位: | |
| 图片模型名称 | |
| API base URL 覆盖值 | 配置值 |
| API Key 覆盖值 | 配置值 |
| 输出目录;带图片扩展名的路径会被视为最终文件路径 | |
| 最终图片文件路径 | 无 |
| 图片索引字典路径 | |
| 额外 API 参数;可重复使用 | 无 |
| 自定义配置文件路径 | |
Output behavior
输出行为
- PNG placeholder: first written to the final image path
- Generated image: on success, the real image overwrites the same path derived from the asset name/purpose or specific subject, for example or the path specified by
small-airplane-<timestamp>.png/ file-style--output-file--output - Index dictionary: defaults to
<output directory>/image-index.json
The index key is the image path. On success, and are the same path. Values include , , , , , , , and timestamps. On failure, the error is recorded and the placeholder remains at that same path.
placeholderPathgeneratedPathpromptplaceholderPathgeneratedPathresultmodelsizeparams- PNG 占位图:先写入最终图片路径
- 生成图片:成功生成后,真实图片会覆盖同一路径,该路径默认从资产名称/用途或具体主体生成,例如 ,或由
small-airplane-<timestamp>.png/ 文件型--output-file指定路径--output - 索引字典:默认路径为
<输出目录>/image-index.json
索引键为图片路径。生成成功时, 与 为同一路径。值包含 、、、、、、 和时间戳。生成失败时,会记录错误并保留该路径下的占位图。
placeholderPathgeneratedPathpromptplaceholderPathgeneratedPathresultmodelsizeparamsSecurity notes
安全注意事项
- Do not commit API keys to source code, docs, issues, PRs, or summaries.
- Prefer runtime overrides for temporary keys.
- The helper only stores the API key in .
~/.claude/generate-image/config.json
- 不要将 API Key 提交到源代码、文档、issue、PR 或摘要中。
- 临时使用其他 API Key 时,优先使用命令行参数覆盖。
- helper 仅将 API Key 存储在 中。
~/.claude/generate-image/config.json