sub2api
sub2api copied to clipboard
Bug:/v1/images/edits 使用 gpt-image-2 通过 OAuth 账号转发失败
问题描述
使用 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 曾成功
问题+1, 大佬解决了么?
目前好像还是存在这个问题
+1,还有这种问题,尤其是生成高分辨率高质量图片的时候
+1到现在还是存在
依旧无法转发图片