Connection Interruption Troubleshooting
Image generation is a long request (10–60 seconds), and connection interruptions are mostly caused by client-side or intermediary timeouts. Troubleshoot in the following order.
Troubleshooting Checklist
-
HTTP client timeout: The default timeout for requests / axios / fetch is generally 30 seconds, which is shorter than the generation time and will definitely cause failures. Set it uniformly to ≥120 seconds:
client = OpenAI(base_url="...", api_key="...", timeout=180) -
Self-hosted reverse proxy timeout: nginx defaults to
proxy_read_timeout 60s, which also needs to be increased:proxy_read_timeout 180s;proxy_send_timeout 180s; -
Response body size limit: When returning base64, the response can reach several MB. Check the proxy and gateway
client_max_body_size/ body limits; -
Company network / VPN: Some corporate proxies will cut off long connections; compare with a direct network connection;
-
Too much concurrency: Under heavy concurrency, some requests are queued. After the total time is prolonged, timeouts are triggered— reduce concurrency or add a queue.
Correct Handling After Interruption
- Failed requests are not billed (the pre-authorization is automatically refunded), so it is safe to retry;
- Retry with exponential backoff (5s → 15s → 45s), do not resend immediately in quick succession;
- Occasional 5xx errors during peak periods are upstream instability. Retrying 1–2 times usually recovers; see Error Codes and Retries.
Still Not Resolved
Check the status of the request in the console “Logs”; attach the request time and model name, and contact support to investigate channel-side issues.