用途
gpt-image 用于通过 inference.sh CLI(belt)调用 OpenAI 的 GPT-Image-2 模型,完成图像生成与图像编辑任务。用户可以从文本提示词生成图像,也可以基于参考图进行编辑,或通过蒙版对指定区域进行局部重绘。
主要能力
根据资料,GPT-Image-2 通过单一模型支持以下能力:
- 文生图(Text-to-Image):根据文本提示词生成图像。
- 图像编辑(Image Editing):使用参考图编辑图像。
- 局部重绘(Inpainting):基于蒙版编辑特定区域。
- 批量生成(Batch Generation):一次最多生成 10 张图像。
- 多种格式(Multiple Formats):支持 PNG、JPEG、WebP 输出。
- 灵活分辨率(Flexible Resolution):支持 256–4096 之间、以 32 像素为步长的任意尺寸。
使用方式
先安装 belt CLI 技能,并安装 inference.sh CLI(belt):
npx skills add belt-sh/cli
登录:
belt login
基础调用命令为:
belt app run openai/gpt-image-2 --input '{"prompt": "a cat astronaut floating in space"}'
资料中给出的示例如下。
文生图:
belt app run openai/gpt-image-2 --input '{
"prompt": "professional product photo of sneakers on a white background, studio lighting",
"quality": "high"
}'
一次生成多张:
belt app run openai/gpt-image-2 --input '{
"prompt": "minimalist logo design for a coffee shop",
"n": 4,
"quality": "medium"
}'
使用参考图编辑:
belt app run openai/gpt-image-2 --input '{
"prompt": "change the background to a beach at sunset",
"images": ["https://your-image.jpg"]
}'
多图参考:
belt app run openai/gpt-image-2 --input '{
"prompt": "combine these two characters into one scene",
"images": ["https://character1.jpg", "https://character2.jpg"]
}'
蒙版局部重绘:
belt app run openai/gpt-image-2 --input '{
"prompt": "replace with a red sports car",
"images": ["https://street-scene.jpg"],
"mask": "https://car-mask.png"
}'
自定义分辨率:
belt app run openai/gpt-image-2 --input '{
"prompt": "wide cinematic landscape, mountains at golden hour",
"width": 1920,
"height": 1080,
"quality": "high"
}'
快速草稿:
belt app run openai/gpt-image-2 --input '{
"prompt": "quick concept sketch of a robot",
"quality": "low"
}'
参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| prompt | string | required | 描述图像的文本提示词 |
| images | array | - | 用于编辑的参考图像 |
| mask | string | - | 用于局部重绘的蒙版图像 |
| n | integer | 1 | 图像数量(1–10) |
| quality | string | - | low、medium 或 high |
| width | integer | - | 输出宽度(256–4096,32 的倍数) |
| height | integer | - | 输出高度(256–4096,32 的倍数) |
| output_format | string | png | png、jpeg 或 webp |
| output_compression | integer | - | jpeg/webp 的压缩级别(0–100) |
价格
资料给出的参考价格如下(分辨率越大费用越高,完整价格可通过 belt app get openai/gpt-image-2 查看):
| 质量 | 每张图像约价格 |
|---|---|
| Low | $0.006 |
| Medium | $0.024 |
| High | $0.21 |
相关技能
# 完整平台技能(所有应用)
npx skills add inference-sh/skills@infsh-cli
# 所有图像生成模型
npx skills add inference-sh/skills@ai-image-generation
# FLUX 模型
npx skills add inference-sh/skills@flux-image
# Pruna P-Image(快速且经济)
npx skills add inference-sh/skills@p-image
浏览所有图像应用:
belt app list --category image
限制与未提供信息
资料未说明该技能的并发限制、速率限制、可用区域、账号配额或失败重试机制。除上述价格档位外,其他计费细节暂未提供。