What happens when an image generation times out?

Understanding timeout types
HTTP timeouts (client-side) occur when your code stops waiting. Server timeouts happen when the API stops processing before completing. API timeouts are usually documented—check if your provider allows increases or has different tier limits.
Handling in your code
Set explicit timeouts slightly longer than the API's stated limit. Catch timeout exceptions and log the job ID if available—don't immediately retry. Some APIs offer status endpoints to check if a job is still running or failed.
Prevention strategies
For complex generations, request a smaller output size or fewer steps upfront. Start with default settings, monitor actual times, then increase parameters. If you regularly hit limits, contact support about higher timeout allowances or switch to async/webhook endpoints that don't have client timeouts.