[Bug] 使用 OpenAI 的 GPT-5,持续遇到 Gateway time-out Error code 504
📦 Deployment Method
Vercel
📌 Version
v2.16.1
💻 Operating System
Windows
📌 System Version
Windows 11, version 24H2
🌐 Browser
Chrome
📌 Browser Version
138.0.7204.169
🐛 Bug Description
使用 OpenAI 的 gpt-5 时(在 versel 上部署,接 API Key),会报 504: Gateway time-out ,然而用别的模型都不会有这样的报错:
{
"error": {
"code": "504",
"message": "An error occurred with your deployment"
}
}
尝试了将 vercel 的 Function Max Duration 调到 60s,仍然没有变化。然而,有时如果输入 “test”“hello”这样简短的问题,则不会遇到错误,而是能正常回答。
📷 Recurrence Steps
使用 OpenAI 的 GPT-5,询问比较长的问题。
🚦 Expected Behavior
No response
📝 Additional Information
No response
Bot detected the issue body's language is not English, translate it automatically.
Title: [Bug] Using OpenAI's GPT-5, we continue to encounter Gateway time-out Error code 504
Same here
vercel edge runtime 限制 stream 的第一个回复必须 < 25s,参考 #4781
如果官方不回复 think 使得 think 结束超过 25s(一般因此导致),或者到生成 think 的第一个 token 超过 25s(不太可能),就会寄了
解决方法可以看看上面这个 issue 中 SuiYunsy 的评论中提到的另一个 issue https://github.com/vercel/ai/issues/487#issuecomment-1847754042
提供一个自己写的解决方案,不过写在 google.ts 里(我用 gemini 的时候遇到了这个问题),可以自行移动至 openai 相关代码中~
Bot detected the issue body's language is not English, translate it automatically.
Provide a self-written solution