Skip to content
AniLink

AniList client configuration

Complete options table

OptionTypeDefaultBehaviorWhen to change it
timeoutnumber30000Milliseconds before a request is aborted. 0 disables. Timeout errors carry timeoutMsSlow endpoints or strict latency budgets
signalAbortSignalCancels in-flight requestsUser-driven cancellation
retryboolean | Partial<RetryPolicy>built-in policyAutomatic retries. false opts out. Partial policy merges over defaultsNon-idempotent workflows, custom backoff
paceWithRateLimitbooleanfalseWaits for window reset when remaining quota drops below rateLimitFloorHigh-volume schedulers
rateLimitFloornumber1Remaining-quota threshold that triggers pacing (minimum 1)Start pacing earlier than the last request
circuitBreaker{ threshold, cooldownMs }offFail fast with CIRCUIT_OPEN_ERROR after threshold consecutive failures until cooldownMs elapsesProtect against sustained outages
onErrorOnErrorHandlerFires per failed attempt and when retries are exhaustedLogging, metrics
onRetryOnErrorHandlerFires when a failed attempt will be retriedRetry telemetry
onRequestStartOnRequestStartHandlerFires immediately before each attemptRequest counting
onResponseOnResponseHandlerFires after each attempt with durationMsLatency metrics
exposeRawAxiosErrorbooleanfalseAttaches the raw Axios error as rawAxiosError/causeLocal debugging only

Caution

exposeRawAxiosError: true attaches request configuration that includes bearer-token headers. Never enable it in production or log rawAxiosError.

Usage

typescript
import { AniLink } from "anilink-api-wrapper";

const aniLink = new AniLink("anilist-token", {
    timeout: 10_000,
    retry: { maxRetries: 3, baseDelayMs: 250 },
    paceWithRateLimit: true,
    onResponse: ({ url, durationMs }) => console.log(url, durationMs),
});

Details per mechanism: Retries & resilience, Observability, Cancellation & timeouts.

Next steps

AniLink — typed AniList & MyAnimeList client for TypeScript.