OpenAI API Request Timed Out / 504 Gateway Timeout

Share
Workaround available API Updated November 14, 2026Based on 4 user reportsHow we research

Quick answer

Timeouts usually come from slow long generations hitting a client or proxy timeout. Stream the response, lower max_tokens and raise client timeouts.

Most likely fix: Stream the response

How to fix it

Try these in order — the most common fix is first.

  1. 1. Stream the response

    1. Set stream: true so tokens arrive immediately
    Did this fix it?
  2. 2. Lower max_tokens and shorten prompts

    1. Cap output length
    Did this fix it?
  3. 3. Raise timeouts in the chain

    1. SDK timeout option, load balancer and serverless limits
    Did this fix it?
  4. 4. Use background mode or Batch for long jobs

    1. Poll for results instead of holding one connection
    Did this fix it?

Symptoms

APITimeoutError "Request timed out" or 504 from a proxy.

Why it happens

  • Long outputs or reasoning models
  • Client or gateway timeout too short
  • Serverless function limits
  • Network or proxy issues

This guide also covers

  • openai api request timed out
  • openai 504 gateway timeout
  • openai apitimeouterror

Still not working?

If OpenAI keeps failing, you're not alone. See every OpenAI problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All ai & editing tools not working guides →

Other OpenAI errors

All 11 OpenAI errors and fixes →