问题描述
在自定义 OpenAI 兼容网关环境下,gpt-5.4 并不总能通过默认的 OpenAI 兼容调用方式正常返回文本内容。
本地复现中发现:
chat/completions:HTTP 200,但 choices[0].message.content = null
responses + stream = false:HTTP 200,但 output = [],output_text = null
responses + stream = true:可以正常通过 SSE 返回文本内容
这意味着:对于部分自定义 provider,gpt-5.4 实际上需要走 Responses API + 流式输出 才能正常工作。
复现环境
- 项目:
GenericAgent
- 系统:Windows
- Python:3.12
- provider 类型:自定义 OpenAI 兼容网关
- base URL:
http://localhost:8317/v1
- 模型:
gpt-5.4
注:这里的 8317 是本地私有网关,仅用于说明复现条件,不涉及密钥公开。
复现步骤
情况 1:chat/completions
使用类似如下配置:
oai_config = {
'apikey': '***',
'apibase': 'http://localhost:8317/v1',
'model': 'gpt-5.4',
'api_mode': 'chat_completions',
'stream': False,
}
发送一个最简单请求,例如:
情况 2:responses 非流式
oai_config = {
'apikey': '***',
'apibase': 'http://localhost:8317/v1',
'model': 'gpt-5.4',
'api_mode': 'responses',
'stream': False,
}
同样发送:
情况 3:responses 流式
oai_config = {
'apikey': '***',
'apibase': 'http://localhost:8317/v1',
'model': 'gpt-5.4',
'api_mode': 'responses',
'stream': True,
'reasoning_effort': 'xhigh',
}
发送:
实际结果
1. chat/completions
请求成功返回 HTTP 200,但正文中:
{
"choices": [
{
"message": {
"role": "assistant",
"content": null,
"reasoning_content": null,
"tool_calls": null
}
}
]
}
也就是“看起来成功”,但没有实际文本输出。
2. responses + stream = false
同样返回 HTTP 200,但正文中:
{
"output": [],
"output_text": null
}
也没有实际文本输出。
3. responses + stream = true
可以收到正常的 SSE 事件,例如:
event: response.output_text.delta
data: {"delta":"OK", ...}
event: response.output_text.done
data: {"text":"OK", ...}
最终可以正常得到:
预期结果
对于自定义 OpenAI 兼容网关下的 gpt-5.4:
- 如果
chat/completions 不受支持,文档或代码层应有更明确提示
- 如果
responses 需要强制流式,最好有更清晰的兼容说明
- 若项目默认示例主要使用
chat/completions,可能会让这类 provider 用户误以为接入失败
补充发现
1. gpt-5.4 在该网关上可工作的组合
当前本地验证可工作的组合是:
api_mode = 'responses'
stream = True
2. reasoning.summary = experimental 不兼容
该网关对 reasoning.summary 的支持也比较严格。
当传入:
{"reasoning": {"summary": "experimental"}}
会返回 400,提示只接受:
这说明不同 custom provider 对 Responses 参数的兼容程度差异较大。
临时绕过方案
当前可行的本地绕过方案是:
oai_config = {
'apikey': '***',
'apibase': 'http://localhost:8317/v1',
'model': 'gpt-5.4',
'api_mode': 'responses',
'stream': True,
'reasoning_effort': 'xhigh',
}
在这组配置下,本地已经验证可以正常返回内容。
建议方向
我觉得这个问题更像是“兼容性/文档问题”,不一定是单纯代码 bug。比较合适的改进方向可能包括:
-
在文档中补充:
- 部分 custom provider 上,
gpt-5.x 可能需要 responses 模式
- 部分 provider 需要
stream = true 才能正常返回文本
-
在配置模板 mykey_template.py 中增加更明确示例:
gpt-5.x + custom provider + responses
-
如果项目愿意做更激进一点的兼容:
- 当
responses + stream = false 返回空 output 时,提示用户尝试流式模式
- 或在 README / GETTING_STARTED 中补充 custom provider 的接入注意事项
问题描述
在自定义 OpenAI 兼容网关环境下,
gpt-5.4并不总能通过默认的 OpenAI 兼容调用方式正常返回文本内容。本地复现中发现:
chat/completions:HTTP 200,但choices[0].message.content = nullresponses+stream = false:HTTP 200,但output = [],output_text = nullresponses+stream = true:可以正常通过 SSE 返回文本内容这意味着:对于部分自定义 provider,
gpt-5.4实际上需要走 Responses API + 流式输出 才能正常工作。复现环境
GenericAgenthttp://localhost:8317/v1gpt-5.4复现步骤
情况 1:
chat/completions使用类似如下配置:
发送一个最简单请求,例如:
情况 2:
responses非流式同样发送:
情况 3:
responses流式发送:
实际结果
1.
chat/completions请求成功返回
HTTP 200,但正文中:{ "choices": [ { "message": { "role": "assistant", "content": null, "reasoning_content": null, "tool_calls": null } } ] }也就是“看起来成功”,但没有实际文本输出。
2.
responses+stream = false同样返回
HTTP 200,但正文中:{ "output": [], "output_text": null }也没有实际文本输出。
3.
responses+stream = true可以收到正常的 SSE 事件,例如:
最终可以正常得到:
预期结果
对于自定义 OpenAI 兼容网关下的
gpt-5.4:chat/completions不受支持,文档或代码层应有更明确提示responses需要强制流式,最好有更清晰的兼容说明chat/completions,可能会让这类 provider 用户误以为接入失败补充发现
1.
gpt-5.4在该网关上可工作的组合当前本地验证可工作的组合是:
api_mode = 'responses'stream = True2.
reasoning.summary = experimental不兼容该网关对
reasoning.summary的支持也比较严格。当传入:
{"reasoning": {"summary": "experimental"}}会返回 400,提示只接受:
autoconcisedetailed这说明不同 custom provider 对 Responses 参数的兼容程度差异较大。
临时绕过方案
当前可行的本地绕过方案是:
在这组配置下,本地已经验证可以正常返回内容。
建议方向
我觉得这个问题更像是“兼容性/文档问题”,不一定是单纯代码 bug。比较合适的改进方向可能包括:
在文档中补充:
gpt-5.x可能需要responses模式stream = true才能正常返回文本在配置模板
mykey_template.py中增加更明确示例:gpt-5.x + custom provider + responses如果项目愿意做更激进一点的兼容:
responses + stream = false返回空output时,提示用户尝试流式模式