APIrove

怎么用 API 生成图片?为什么用聊天接口画图报错?

Viewed 7

选了 gpt-image 模型发聊天请求,结果报错。图片生成应该怎么调用?

1 Answers

图片生成不走聊天接口,要用专门的图片接口:

curl https://apirove.com/v1/images/generations \
  -H "Authorization: Bearer $APIROVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-flare",
    "prompt": "a simple red circle on white background",
    "size": "1024x1024",
    "n": 1
  }'
  • 文本组和完整组 Key 都可以出图。
  • 不写 model 时默认使用 Image 2.6(gpt-image-2.6-flare)。
  • 反过来也一样:不要用 gpt-image-* 模型来聊天。
  • 报 404 / 没有图片模型:先到 密钥页面 看这把 Key 是否关掉了出图。
  • 尺寸、清晰度等可用选项与计费见 模型目录 和 价格页。
Related