How To Avoid Timeouts in Completion API
We use CloudFlare as our CDN provider and API gateway, which enforces a default 120-second timeout for all requests. As a result, when using the non-streaming mode in the text completion API, the process may exceed this time limit. To prevent time-out errors and avoid wasting tokens, you can try one of the following workarounds:1. Enable Stream Mode#
Include stream: true in the request payload as shown in LLM API | Basic Completions. This allows you to receive partial results as soon as the connection with the server is established, effectively bypassing the time-out issue.2. Use the Alternative Domain proxy.piapi.ai#
This endpoint does not use CloudFlare, providing longer time-out limits. However, it may introduce slightly higher latency. Modified at 2024-10-21 10:56:18