Call OpenAI's latest gpt-image-2 model to generate high-quality images. Just paste a prompt and it works.
Skill Features
- Supports command-line batch generation, parameterized control of aspect ratio and resolution tier
- Text-to-image + image-to-image dual mode,
--imageone parameter enables edit mode (up to 2 reference images)
Capabilities Overview
- Text-to-image: Enter a prompt to generate a brand-new image
- Image-to-image: Upload reference images (up to 2) + prompt, edit and generate based on the original image
- Model: gpt-image-2 (OpenAI's latest image model)
- API: RedFox new version
gptImage2Submit/gptImage2Result - Output format: PNG (fixed output for the new API)
- Aspect ratio:
1:1/3:2/2:3/4:3/3:4/5:4/4:5/16:9(default) /9:16/2:1/1:2/21:9/9:21 - Resolution tier:
1k/2k(default) /4k - Batch generation: Up to 4 images per request (new API limit)
- Compatible with legacy pixel format: Still accepts
1792x1024and other legacy formats; scripts automatically map them to aspect ratio + tier internally
Usage
Text-to-image — Enter text to generate an image
# 基本生成(默认 16:9 + 2k)
python3 "$SKILL_PATH/assets/imagegen.py" "一只橘色的猫咪坐在窗台上看着窗外的夕阳"
# 横版 4k 高清
python3 "$SKILL_PATH/assets/imagegen.py" "futuristic city skyline" --size 16:9 --resolution 4k
# 竖版小红书封面(3:4 + 2k)
python3 "$SKILL_PATH/assets/imagegen.py" "product cover, minimal style" --size 3:4 --resolution 2k
# 方形 1k 快速档
python3 "$SKILL_PATH/assets/imagegen.py" "minimalist cat logo, flat design" --size 1:1 --resolution 1k
# 批量生成 4 张(新接口上限)
python3 "$SKILL_PATH/assets/imagegen.py" "icon set, flat style" -n 4
# 兼容旧像素写法(自动映射为 16:9 + 1k)
python3 "$SKILL_PATH/assets/imagegen.py" "cyberpunk street" --size 1792x1024
Image-to-image — Upload reference images to edit and generate
# 单张参考图(自动上传 OSS → 提交任务)
python3 "$SKILL_PATH/assets/imagegen.py" "把猫咪改成白色,背景换成星空" --image ~/Pictures/cat.png
# 两张参考图(新接口最多支持 2 张)
python3 "$SKILL_PATH/assets/imagegen.py" "融合两张图的风格" --image ref1.png --image ref2.jpg
# 直接使用 URL 参考图(跳过上传步骤)
python3 "$SKILL_PATH/assets/imagegen.py" "把海报主体换成手表" --image "https://example.com/poster.jpg"
Other operations
# 仅提交任务(返回 taskId,不等待)
python3 "$SKILL_PATH/assets/imagegen.py" "complex scene" --no-download
# 查询已有任务结果
python3 "$SKILL_PATH/assets/imagegen.py" "" --task-id 5f100fcb8f3c4e3087c6aba93e121f7e
# 指定输出目录和文件名前缀
python3 "$SKILL_PATH/assets/imagegen.py" "illustration" -o ~/Pictures/AI --prefix artwork
Parameter Description
| Parameter | Description | Default value |
|---|---|---|
prompt |
Generation/edit prompt (required, up to 500 characters) | - |
--size |
Aspect ratio (e.g. 16:9); also compatible with legacy pixel formats (e.g. 1792x1024) |
16:9 |
--resolution |
Resolution tier:1k / 2k / 4k |
Pixel format is automatically matched; aspect ratio defaults to 2k |
-n, --count |
Number of images to generate (1-4, new API limit is 4) | 1 |
--image |
Reference image path or URL (can be passed multiple times, up to 2) | - |
-o, --output-dir |
Output directory | ~/Downloads/QoderImages |
--prefix |
Filename prefix | image |
--no-download |
Submit only without waiting | - |
--task-id |
Query an existing task | - |
--api-key |
Specify API Key | - |
Deprecated parameters (no longer supported by the new API; if passed, they will be ignored with a notice)
| Parameter | Description |
|---|---|
--quality |
Use --resolution instead |
--format |
The new API has fixed PNG output |
--bg / --background |
The new API no longer supports background control |
--compression |
The new API no longer supports compression ratio |
--fidelity |
The new API no longer supports fidelity control |
Dependency Installation
| Dependency | Installation command |
|---|---|
requests |
pip3 install requests |
First Use
Configure the API Key first, then run:
# 设置环境变量
export REDFOX_API_KEY=ak_你的密钥
# 运行
python3 "$SKILL_PATH/assets/imagegen.py" "一只橘色的猫咪"
Go to redfox.hk to register and get an API Key.
⚠️ The new API only supportspaid calls, and free account credits cannot be used for this API. If error code
3203is returned, please go to the top-up page to add paid credits.
Subsequent Use
Go to redfox.hk to register an account and get your own API Token. Choose any one of the three configuration methods:
| Configuration method | Description | Command |
|---|---|---|
| Environment variables(Recommended) | Set once, takes effect globally | export REDFOX_API_KEY=ak_你的密钥 |
| Command-line arguments | Temporary use, takes effect for a single run | python3 "$SKILL_PATH/assets/imagegen.py" "prompt" --api-key ak_你的密钥 |
| Configuration file | Persistent storage, retained across sessions | mkdir -p ~/.qoder/apis && echo '{"api_key":"ak_你的密钥"}' > ~/.qoder/apis/redfox.json |
API specification (new)
Submit task
POST https://redfox.hk/story/api/parseWork/imageGen/gptImage2Submit
Request headers:REDFOX_API_KEY: ak_xxx + Content-Type: application/json
Request body:
{
"prompt": "把这个海报的主体变为手表 并把文字都用中文",
"resolution": "2k",
"size": "16:9",
"n": 2,
"referenceImages": ["https://example.com/poster.jpg"]
}
Response:data.taskId used for subsequent polling.
Query result
POST https://redfox.hk/story/api/parseWork/imageGen/gptImage2Result
Request body:{"taskId": "..."}
Key response fields:
| Field | Description |
|---|---|
data.status |
completed / processing / queued / failed |
data.progress |
Generation progress 0-100 |
data.imageUrls |
Array of generated result URLs (count matches n consistent) |
data.failReason |
Failure reason (null on success) |
data.model |
Model used (gpt-image-2) |
data.resolution / data.size |
Actual tier and aspect ratio used |
FAQ
Q: What are the features of this Skill? A: Directly call the gpt-image-2 model from the command line, supporting batch generation, aspect ratio and resolution tier control, and image-to-image (up to 2 reference images).
Q: How long does it take to generate an image?
A: Usually 10-60 seconds,4k tier or complex scenes may take longer. The script automatically polls and waits and displays progress.
Q: What is the difference between the new resolution and the old quality ?
A:resolution is a resolution tier (1k/2k/4k), which directly determines the clarity of the output image and the generation time; the old quality parameter is deprecated and will be ignored if passed in.
Q: Why was --size changed from pixels to aspect ratio?
A: The new API gptImage2Submit 's size field is the aspect ratio (e.g. 16:9). For compatibility with old calls, the script still accepts 1792x1024 and other pixel formats, and internally maps them automatically to aspect ratio + recommended tier.
Q: How many reference images can be passed for image-to-image?
A: The new API supports up to 2. Just pass --image multiple times; any excess will be truncated with a prompt.
Q: Why does the call return error code 3203? A: The new API only supports paid calls; free account credits cannot be used. Please go to redfox.hk/dashboard/recharge to top up paid credits.
Q: How do I get an API Key? A: Go to redfox.hk to register and get your own API Token.
Q: Which image formats are supported as reference images? A: Local files or HTTP(S) URLs in PNG, JPEG, and WebP formats are supported.
Q: Is there a length limit for prompts? A: Prompts support up to 500 characters; anything over that will be blocked with a prompt to shorten it.