Short Answer
- Set a 360-second timeout for synchronous image endpoints. Image generation has no async task ID — disconnecting early means you are still billed but get no image.
- Give reasoning models enough time.
gemini-3.1-pro-preview,gpt-5.6-sol, andgpt-5.5-procan take several minutes, whether you stream or not. - Never run long requests through the CDN node.
api-cf.apiyi.comsits behind Cloudflare and returns524past roughly 100 seconds; it only suits fast text calls.
429 (insufficient concurrency), contact support to review your quota.Timeout cheat sheet
The four keys in detail
① Synchronous image endpoints: set the timeout to 360 seconds
① Synchronous image endpoints: set the timeout to 360 seconds
- GPT-Image-2 at
highquality with 2K/4K takes 3-5 minutes in practice - Nano Banana 4K generation starts around 50 seconds and runs longer at peak
- Multi-image reference tasks often exceed 5 minutes
② Reasoning models: slow with and without streaming
② Reasoning models: slow with and without streaming
gemini-3.1-pro-previewgpt-5.6-solgpt-5.5-pro(pricier and slower)- Any model running at a high thinking budget (high reasoning effort)
stream=True means data arrives immediately, but a reasoning model can emit no tokens at all during the thinking phase, so your read timeout still fires — and the total time from first token to last is still long.Recommendation: set the timeout to 300-600 seconds for reasoning models, and match your thinking tier (reasoning_effort / thinking) to the time you have allowed — a higher tier needs more headroom.③ Base URL selection: the CDN node cannot carry long requests
③ Base URL selection: the CDN node cannot carry long requests
api-cf.apiyi.com is fronted by the Cloudflare global CDN. It offers worldwide acceleration and low latency from overseas, but it has a request timeout of roughly 100 seconds, past which you get a 524 error.⚠️ This affects more than image endpoints. Any call that might exceed 100 seconds is a poor fit, including:- ❌ Image generation / editing
- ❌ Video generation
- ❌ Long text output (long articles, large translations, big code generations)
- ❌ Deep-thinking tasks on reasoning models
api.apiyi.com (recommended in mainland China) or vip.apiyi.com (recommended overseas). Full node comparison in the Base URL guide.④ Hitting 429 concurrency limits: contact support
④ Hitting 429 concurrency limits: contact support
429 Too Many Requests, the problem is usually concurrency quota, not your timeout.Concurrency limits apply per model, not across your whole account. A specific model — especially a newly launched or supply-constrained one — may have a lower quota.What to do:- Implement exponential backoff so you do not saturate the limit in bursts
- If 429s persist, contact APIYI support — we can check that model’s actual quota and help adjust it
Code examples
- Python
- Node.js
- cURL
Still timing out after raising the timeout? Check every hop
Step 1: Confirm the SDK timeout actually applies
Step 2: Check every hop in the path
- Self-hosted reverse proxy: Nginx
proxy_read_timeout(60s by default) - Cloud load balancer: idle connection timeout
- API gateway / CDN: origin timeout
- Serverless functions: execution limit (often 30-60s by default)
- Task queue workers: per-task timeout
Step 3: Confirm you are not on the CDN node
api-cf.apiyi.com. For long requests, switch to api.apiyi.com or vip.apiyi.com.Rule of thumb: a 524 almost always means a Cloudflare-layer timeout, not a slow model.Step 4: Distinguish timeouts from concurrency limits
524 and dropped connections are timeout problems; 429 is a quota problem. The fixes are entirely different.Step 5: Check call logs for actual latency
Common questions
Can I get a refund for a request that timed out?
Can I get a refund for a request that timed out?
Can you offer an async endpoint so I can fetch results by ID after a disconnect?
Can you offer an async endpoint so I can fetch results by ID after a disconnect?
Does streaming prevent timeouts?
Does streaming prevent timeouts?
Is there a downside to setting a very large timeout?
Is there a downside to setting a very large timeout?
What is the difference between 524 and 429?
What is the difference between 524 and 429?
524: a Cloudflare-layer timeout, meaning you usedapi-cf.apiyi.comand the request exceeded roughly 100 seconds. Switch nodes.429: a concurrency or rate limit, unrelated to duration. Add exponential backoff, and contact support if it persists.
