ai-image

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI Image Generation Skill

AI图像生成Skill

Generate high-quality AI images using OpenAI's gpt-image-1 model with customizable styles and themes.
使用OpenAI的gpt-image-1模型生成高质量AI图像,支持自定义风格和主题。

When to Use This Skill

何时使用本Skill

Use this skill when the user wants to:
  • Generate images from text descriptions
  • Create artwork with specific artistic styles
  • Generate images with particular aspect ratios (vertical, horizontal, square)
  • Apply themed visual styles (Studio Ghibli, futuristic, Pixar, oil painting, Chinese painting)
当用户有以下需求时,可使用本Skill:
  • 根据文本描述生成图像
  • 创建带有特定艺术风格的作品
  • 生成特定宽高比(竖版、横版、正方形)的图像
  • 应用主题视觉风格(吉卜力工作室、未来主义、皮克斯、油画、中国画)

Instructions

使用说明

  1. Check for API Key: Verify that the OPENAI_API_KEY environment variable is set
  2. Gather Requirements: Ask the user for:
    • Image prompt (required)
    • Style/aspect ratio: vertical (1024x1536), horizontal (1536x1024), or square (1024x1024)
    • Theme: ghibli, futuristic, pixar, oil-paint, or chinese-paint (optional)
    • Output location (optional, defaults to ./generated_image.png)
  3. Run the CLI: Execute the main.py script with the appropriate parameters
  4. Report Results: Show the user where the image was saved and any relevant details
  1. 检查API密钥:确认已设置OPENAI_API_KEY环境变量
  2. 收集需求信息:向用户询问以下内容:
    • 图像提示词(必填)
    • 风格/宽高比:竖版(1024x1536)、横版(1536x1024)或正方形(1024x1024)
    • 主题:ghibli、futuristic、pixar、oil-paint或chinese-paint(可选)
    • 输出位置(可选,默认值为./generated_image.png)
  3. 运行CLI:使用相应参数执行main.py脚本
  4. 反馈结果:告知用户图像的保存位置及相关细节

Available Options

可用选项

Aspect Ratios (--style)

宽高比(--style)

  • vertical
    : 1024x1536 pixels (portrait orientation)
  • horizontal
    : 1536x1024 pixels (landscape orientation)
  • square
    : 1024x1024 pixels (default)
  • vertical
    : 1024x1536像素(竖版方向)
  • horizontal
    : 1536x1024像素(横版方向)
  • square
    : 1024x1024像素(默认)

Artistic Themes (--theme)

艺术主题(--theme)

  • ghibli
    : Studio Ghibli animation style with whimsical, dreamlike aesthetics
  • futuristic
    : Sci-fi style with sleek designs and neon lights
  • pixar
    : Vibrant 3D animation style with expressive characters
  • oil-paint
    : Classical oil painting with rich textures and brushstrokes
  • chinese-paint
    : Traditional Chinese ink painting with delicate brushwork
  • ghibli
    : 吉卜力工作室动画风格,带有奇幻、梦幻的美学特征
  • futuristic
    : 科幻风格,具有流畅的设计和霓虹灯光效果
  • pixar
    : 充满活力的3D动画风格,角色表现力丰富
  • oil-paint
    : 经典油画风格,具有丰富的纹理和笔触
  • chinese-paint
    : 传统中国水墨画风格,笔触细腻

Usage Examples

使用示例

Basic Usage

基础用法

bash
uv run main.py --prompt "a cat sitting on a tree"
bash
uv run main.py --prompt "a cat sitting on a tree"

With Style and Theme

指定风格和主题

bash
uv run main.py --prompt "a sunset over mountains" --style horizontal --theme oil-paint --output ./sunset.png
bash
uv run main.py --prompt "a sunset over mountains" --style horizontal --theme oil-paint --output ./sunset.png

Futuristic Portrait

未来主义肖像

bash
uv run main.py --prompt "a robot in a city" --style vertical --theme futuristic --output ./robot.png
bash
uv run main.py --prompt "a robot in a city" --style vertical --theme futuristic --output ./robot.png

Studio Ghibli Landscape

吉卜力风格风景

bash
uv run main.py --prompt "a magical forest with spirits" --style horizontal --theme ghibli --output ./forest.png
bash
uv run main.py --prompt "a magical forest with spirits" --style horizontal --theme ghibli --output ./forest.png

Setup Requirements

环境设置要求

This skill requires an OpenAI API key with access to the gpt-image-1 model:
bash
export OPENAI_API_KEY='your-api-key-here'
Note: Using gpt-image-1 requires organization verification on the OpenAI platform.
本Skill需要拥有gpt-image-1模型访问权限的OpenAI API密钥:
bash
export OPENAI_API_KEY='your-api-key-here'
注意:使用gpt-image-1需要在OpenAI平台完成组织验证。

Technical Details

技术细节

  • Model: OpenAI gpt-image-1 (released April 2025)
  • Response Format: Base64 encoded images (b64_json)
  • Supported Sizes: 1024x1024, 1024x1536, 1536x1024
  • Maximum Resolution: Up to 4096x4096 pixels
  • Dependencies: openai>=2.7.1
  • Model: OpenAI gpt-image-1(2025年4月发布)
  • 响应格式: Base64编码图像(b64_json)
  • 支持尺寸: 1024x1024, 1024x1536, 1536x1024
  • 最大分辨率: 最高4096x4096像素
  • 依赖项: openai>=2.7.1

Pricing Information

定价信息

Usage is priced per token:
  • Text tokens: $5 per million
  • Image input tokens: $10 per million
  • Image output tokens: $40 per million
Approximate costs per generated image:
  • Low quality square: ~$0.02
  • Medium quality square: ~$0.07
  • High quality square: ~$0.19
使用按token计费:
  • 文本token:每百万$5
  • 图像输入token:每百万$10
  • 图像输出token:每百万$40
单张生成图像的大致成本:
  • 低质量正方形:约$0.02
  • 中等质量正方形:约$0.07
  • 高质量正方形:约$0.19

Troubleshooting

故障排除

API Key Not Set

API密钥未设置

If you see "Error: OPENAI_API_KEY environment variable not set", ensure your API key is exported in your shell session.
如果出现"Error: OPENAI_API_KEY environment variable not set"错误,请确保已在Shell会话中导出API密钥。

Organization Not Verified

组织未验证

gpt-image-1 requires organization verification on platform.openai.com. Visit your OpenAI account settings to complete verification.
gpt-image-1需要在platform.openai.com完成组织验证。请访问你的OpenAI账户设置完成验证。

Invalid Size Error

尺寸无效错误

Ensure you're using one of the supported sizes: 1024x1024, 1024x1536, or 1536x1024.
确保使用支持的尺寸:1024x1024、1024x1536或1536x1024。