sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

Bug:/v1/images/edits 使用 gpt-image-2 通过 OAuth 账号转发失败

Open zhangrui1001 opened this issue 6 months ago • 6 comments

问题描述

使用 gpt-image-2 调用 /v1/images/edits 图片编辑接口时失败,sub2api 返回 502。

但服务本身是正常的:

  • /health 返回 200
  • /responses 文本模型请求正常
  • /v1/images/generations 使用 gpt-image-2 曾成功返回 200

所以问题看起来集中在 /v1/images/edits 的转发逻辑上。

环境信息

  • 部署方式:Docker Compose
  • 镜像:weishaw/sub2api:latest
  • 运行模式:production
  • 系统:Windows
  • 出错接口:/v1/images/edits
  • 模型:gpt-image-2
  • 账号类型:OpenAI OAuth

错误日志

第一次失败时,上游返回了 400:

OpenAI upstream error 400 (account=36 platform=openai type=oauth): {
 "error": {
 "message": "Tool choice 'image_generation' not found in 'tools' parameter.",
 "type": "invalid_request_error",
 "param": "tool_choice",
 "code": null
 }
}


随后 sub2api 返回 502:

openai.images.forward_failed
path="/v1/images/edits"
method="POST"
model="gpt-image-2"
stream=true
multipart=true
capability="images-native"
account_id=36
error="upstream error: 400 message=Tool choice 'image_generation' not found in 'tools' parameter."
status_code=502
换另一个 OAuth 账号后,流式请求也失败:

openai.images.forward_failed
path="/v1/images/edits"
model="gpt-image-2"
stream=true
multipart=true
account_id=43
error="stream disconnected before image generation completed"
非流式 fallback 也失败:

openai.images.forward_failed
path="/v1/images/edits"
model="gpt-image-2"
stream=false
multipart=true
account_id=43
fallback_error_response_written=true
error="upstream did not return image output"
status_code=502
latency_ms=139266
预期行为
/v1/images/edits 应该正常返回编辑后的图片,或者至少正确透传上游错误。

实际行为
sub2api 返回 502。

从上游错误看,转发请求里可能带了 tool_choice=image_generation,但没有同时带对应的 tools 参数,导致上游拒绝请求。

补充说明
这不像是服务整体异常:

Docker 容器状态 healthy
/health 正常
文本模型 /responses 请求正常
/v1/images/generations 使用 gpt-image-2 曾成功

zhangrui1001 avatar May 06 '26 15:05 zhangrui1001

Image

zhangrui1001 avatar May 06 '26 15:05 zhangrui1001

问题+1, 大佬解决了么?

toolAssistant avatar May 07 '26 04:05 toolAssistant

目前好像还是存在这个问题

wuxinzhiren2391-coder avatar May 08 '26 11:05 wuxinzhiren2391-coder

+1,还有这种问题,尤其是生成高分辨率高质量图片的时候

DRHuDL avatar May 08 '26 15:05 DRHuDL

+1到现在还是存在

vevila2020 avatar May 11 '26 07:05 vevila2020

依旧无法转发图片

Gq66 avatar Jun 15 '26 14:06 Gq66