Skip to content

GPT-Image-2 绘图教程

前置准备

  • 创建 AveMujicaAPI API Key。
  • 确认账号套餐支持 /v1/images/generations
  • 模型 ID 使用 gpt-image-2
  • Base URL 使用 https://api.avemujica.moe/v1

Images API

bash
curl --location 'https://api.avemujica.moe/v1/images/generations'   --header 'Content-Type: application/json'   --header 'Authorization: Bearer <YOUR_AVEMUJICA_API_KEY>'   --data '{
    "model": "gpt-image-2",
    "prompt": "一只橘猫戴着橙色围巾,温暖插画风格",
    "size": "1024x1024",
    "quality": "high",
    "output_format": "png",
    "response_format": "url",
    "n": 1
  }'

常用参数

参数可选值说明
size1024x10241536x10241024x1536auto选择正方形、横图、竖图或自动尺寸
qualitystandardhighauto高质量会更慢、消耗更高
output_formatpngjpegwebp选择图片文件格式
response_formaturlb64_jsonurl 便于预览,b64_json 便于程序内处理

Chat Completions 兼容路径

部分客户端只提供对话接口。遇到这种客户端时,先切换到支持 Images API 的插件或工具;客户端明确支持图片兼容路径时,再用 Chat Completions 形式发起请求。

bash
curl 'https://api.avemujica.moe/v1/chat/completions'   -H 'Content-Type: application/json'   -H 'Authorization: Bearer <YOUR_AVEMUJICA_API_KEY>'   -d '{
    "model": "gpt-image-2",
    "messages": [
      {"role": "user", "content": "生成一张可爱的猫咪图片"}
    ]
  }'

在 Cherry Studio 中使用

  • Provider:OpenAI-compatible。
  • Base URL:https://api.avemujica.moe/v1
  • API Key:<YOUR_AVEMUJICA_API_KEY>
  • 模型 ID:gpt-image-2

排查

  • 403:套餐不支持图片模型或余额不足。
  • 400:尺寸、质量、输出格式不被支持。
  • URL 打不开:文件链接过期或外部资源域名被网络拦截。

GPT and OpenAI Responses API for Codex and compatible tools.