Skip to main content

Client Options

The Decrackle constructor accepts an optional DecrackleClientOptions object.


DecrackleClientOptions

OptionTypeDefaultDescription
apiKeystringDECRACKLE_API_KEY env varYour Decrackle API key. Falls back to the environment variable if not provided.
baseURLstringhttps://api.decrackle.ioOverride the API base URL (e.g. for staging or self-hosted).
timeoutnumber30000Global request timeout in milliseconds. Individual methods can override this.
maxRetriesnumber2Automatic retry count on transient errors (network failures, 5xx, 429). Set 0 to disable.
fetchtypeof fetchglobal fetchSupply a custom fetch implementation.

Example — all options

import { Decrackle } from '@decrackle/sdk';

const client = new Decrackle({
apiKey: 'decrackle_sdk_...',
baseURL: 'https://api.decrackle.io',
timeout: 60_000, // 60 seconds global default
maxRetries: 3,
});

Per-request overrides

Every method accepts a RequestOptions object as its last argument that overrides the client defaults for that call only:

const result = await client.asr.transcribe(audio, {}, {
timeout: 600_000, // 10 min for this specific request
maxRetries: 0, // no retries for this call
});

RequestOptions

OptionTypeDescription
timeoutnumberOverride global timeout for this request
maxRetriesnumberOverride global retry count for this request
signalAbortSignalCancellation signal

Retry behaviour

The SDK automatically retries on:

  • Network errors (DNS failure, connection reset)
  • HTTP 429 (rate limit)
  • HTTP 5xx (server errors)

It does not retry on 4xx client errors (auth failures, validation errors).

Retries use exponential backoff with jitter.


client.baseURL

Read-only property exposing the base URL the client is configured to use:

console.log(client.baseURL); // "https://api.decrackle.io"

Decrackle.VERSION

Static property with the current SDK version string:

console.log(Decrackle.VERSION); // e.g. "0.1.7"