Skip to content

RetryPolicy

Namespace: Vercel.AI.ProviderUtils

public sealed class RetryPolicy

Retry policy aligned with the AI SDK defaults: 2 retries, 500–5000ms backoff, 25% jitter. Retryable statuses are 408, 429, and 500–599. Retry-After is honored up to 60 seconds.

Inheritance: object

View source

public static RetryPolicy Default { get; }

SDK default policy.

Value: RetryPolicy

View source

public TimeSpan InitialDelay { get; set; }

Initial delay.

Value: TimeSpan

View source

public double Jitter { get; set; }

Jitter fraction applied to the delay. 0.25 is 25%.

Value: double

View source

public TimeSpan MaxDelay { get; set; }

Maximum delay.

Value: TimeSpan

View source

public int MaxRetries { get; set; }

Maximum retries after the first attempt.

Value: int

View source

public TimeSpan GetDelay(int attempt, TimeSpan? retryAfter)

Computes the delay before the next attempt. <code class=“paramref”>attempt</code> is zero-based.

Parameters

Name Type Description
attempt int
retryAfter TimeSpan?

Returns: TimeSpan

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product