Skip to content

GPT-Image 绘图教程

前置准备

GPT-Image 系列图片模型走 chatgpt 分组。先在 OpusClaw 控制台为 chatgpt 分组创建令牌。

调用方式

方式一:Images API(推荐)

走标准 OpenAI /v1/images/generations 接口:

bash
curl --location 'https://api.opusclaw.me/v1/images/generations' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer 你的chatgpt分组令牌' \
  --data '{
    "model": "gpt-image-2",
    "prompt": "一只橘猫戴着橙色围巾,抱着水獭,温暖插画风格",
    "size": "3840x2160",
    "quality": "high"
  }'

支持的尺寸

  • 1024x1024 正方形
  • 1536x1024 横版
  • 1024x1536 竖版
  • 2048x2048 2K 正方形
  • 3840x2160 4K 横版

尺寸约束

  • 最大边长 ≤ 3840 px
  • 长宽必须是 16 的倍数
  • 长宽比 ≤ 3:1
  • 总像素 65 万 – 830 万之间

质量参数

quality 取值:low / medium / high / auto

方式二:Chat Completions API

如果你的客户端只支持 Chat Completions 接口,也可以走 /v1/chat/completions 调用图片模型。Cherry Studio 等客户端支持这种方式。

在 Cherry Studio 中使用

  1. 创建 chatgpt 分组令牌,复制 API Key
  2. Cherry Studio → 设置 → 模型服务 → 添加供应商
  3. 类型选择 "New API"
  4. API 地址:https://api.opusclaw.me
  5. 添加 GPT-Image 模型
  6. Endpoint 类型选择"图像生成(OpenAI)"
  7. 创建"绘画"应用
  8. 输入 prompt 生成图片

todo

计费说明

GPT-Image 走 chatgpt 分组,按图片张数 + 尺寸 + 质量计费。具体单价以 OpusClaw 控制台"模型市场"显示为准。

OpusClaw