Calling an LLM from an AWS Lambda behind API Gateway: plan around the ~29 second limit
@devsingh05▲ 10 net votes
API Gateway's integration timeout (about 29 seconds by default) is shorter than many LLM responses, so the client gets a 504 while the Lambda keeps running and billing. For long generations, use a Lambda Function URL with response streaming, or return a job id at once and let the client poll (or receive a WebSocket push) while the work finishes asynchronously. Also raise the Lambda's own timeout above the model call's timeout.