400

model_not_supported_for_endpoint:图片模型不能用对话接口调用

图片生成模型要调用 /v1/images/generations,不是 /v1/chat/completions。

报错原文2026-10-23 实测

把 gpt-image-2.5 发到了 /v1/chat/completions
{
  "error": {
    "message": "model 'gpt-image-2.5' is a image model and cannot be used with this endpoint",
    "type": "invalid_request_error",
    "param": null,
    "code": "model_not_supported_for_endpoint"
  }
}

原因

很多客户端只认对话接口,把图片模型名填进去就会得到这个报错。图片接口的请求体也不一样:用的是 prompt、size、n,不是 messages。

排查步骤

  1. 确认调用的是 /v1/images/generations(改图用 /v1/images/edits)。
  2. 请求体用 prompt 字段写描述。
  3. 客户端不支持图片接口的,换一个支持图片生成的客户端,或者直接用代码调用。

正确写法

curl https://api.xisu.ai/v1/images/generations \
  -H "Authorization: Bearer $XISU_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"gpt-image-2.5","prompt":"一只放在木桌上的红苹果,自然光","size":"1024x1024","n":1}'

补充

图片按张计费。上面这条是能正常出图的示例,运行会产生费用。