Documentation
    Preparing search index...

    Per-call budget for the shared rate limiter. Providers that do not rate-limit ignore the budget; providers that retry internally await beforeRetry before each retry.

    The budget bounds the limiter, not the provider's own network retries: each of the attempts provider calls may itself retry a transient (non-429) failure up to NETWORK_RETRY_POLICY.attempts times in all, with backoff sleeps, so one embed() can issue up to attempts x 5 HTTP requests.

    interface EmbedOptions {
        attempts?: number;
        beforeRetry?: () => Promise<void>;
        maxWaitMs?: number;
    }
    Index
    attempts?: number

    Maximum provider calls for this call: a 429 ends a provider call and costs one attempt. Transient network retries inside a provider call do not count against it (see the interface note).

    beforeRetry?: () => Promise<void>

    Awaited by a provider before each retry it makes internally (any HTTP request after the first of an embed() call), so every request draws from the shared limiter. Supplied by the rate-limited wrapper; it may reject (e.g. EmbeddingUnavailableError), which the provider must propagate without retrying.

    maxWaitMs?: number

    Maximum total time to wait for the limiter (token or Retry-After pause), in ms. When a wait would exceed it, the call fails fast. The provider's own network-retry backoff sleeps are not counted.