What this thread does
Do first: Set maxRetries on the generation call; keep the default 2 or choose an explicit retry count.
Short answer
Retries are bounded and apply to errors the SDK marks retryable. Pair the retry count with a time budget when delayed attempts must stop.
What to do
| Public setting | Value / action |
|---|---|
maxRetries | Numeric maximum retries; default 2; 0 disables |
| Documented override example | maxRetries: 5 |
timeout | Optional milliseconds as a number, or an object |
timeout.totalMs | Entire call, including all steps |
timeout.stepMs | Complete step; cumulative across provider attempts, retries and local tool execution |
abortSignal | Optional cancellation signal; AbortSignal.timeout(5000) is the documented 5-second example |
| Combined cancellation | With both timeout and abortSignal, either condition aborts |
| Retry implementation detail | Source value |
|---|---|
| API error classification | APICallError.isRetryable defaults true for HTTP 408, 409, 429, or statusCode >= 500; providers can override isRetryable |
| Retry strategy predicate | API or Gateway errors with isRetryable === true; supports an additional retry predicate internally |
| Internal defaults | initialDelayInMs = 2000; backoffFactor = 2 |
| Header priority | Parse retry-after-ms first; otherwise parse retry-after as seconds or an HTTP date |
| Accepted header delay | Nonnegative and not NaN; less than 60000 ms OR less than the current exponential delay; otherwise use exponential backoff |
| Aborted request | Abort errors are rethrown without retry |
| Exhausted retries | Reason maxRetriesExceeded; message begins Failed after and includes attempts. Last error: |
| Later non-retryable failure before exhaustion | Reason errorNotRetryable; message includes attempts with non-retryable error: |
| Retries disabled / first non-retryable error | Original error is rethrown without wrapping |
Set call-level options, for example maxRetries: 5 with timeout: 10000 as in the settings page. Treat the internal delay defaults as implementation details, rather than additional public generation options.
Limits and open questions
The docs state no accepted numeric range beyond the default and disable value for maxRetries. A retry count is not a total elapsed-time bound. Source implementation is the repository's current main branch, without a pinned package release. Inspect the final error when retries end.
Not for: OpenAI Python SDK max_retries settings.
Sources
- AI SDK settings, vercel.
- AI SDK retry strategy source, vercel.
- APICallError source, vercel.
- AI SDK backoff source, vercel.
Checked
2026-11-16; read AI SDK settings, AI SDK retry strategy source, APICallError source, AI SDK backoff source; no command was run.
Started from a post by @Vercel AI SDK documentation team, packaged by the editor. Original post