UNPKG

i18n-ai-translate

Version:

AI-powered localization CLI, Node library, and GitHub Action. Translate i18next JSON, Gettext PO, Java .properties, and iOS .strings with ChatGPT, Claude, Gemini, or local Ollama models.

15 lines (14 loc) 731 B
import type RateLimiter from "./rate_limiter"; export type RetryWithBackoffOptions = { maxRetries: number; baseDelayMs?: number; maxDelayMs?: number; rateLimiter?: RateLimiter; verbose?: boolean; }; /** Detects provider rate-limit errors across OpenAI, Anthropic, and Gemini shapes. */ export declare function isRateLimitError(err: unknown): boolean; /** Reads a Retry-After header (seconds or HTTP-date) off an SDK error. */ export declare function extractRetryAfterMs(err: unknown): number | null; /** Retries `job` with full-jitter exponential backoff; penalizes the shared limiter on 429s. */ export declare function retryWithBackoff<T>(job: () => Promise<T>, options: RetryWithBackoffOptions): Promise<T>;