Client Options
The Decrackle constructor accepts an optional DecrackleClientOptions object.
DecrackleClientOptions
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | DECRACKLE_API_KEY env var | Your Decrackle API key. Falls back to the environment variable if not provided. |
baseURL | string | https://api.decrackle.io | Override the API base URL (e.g. for staging or self-hosted). |
timeout | number | 30000 | Global request timeout in milliseconds. Individual methods can override this. |
maxRetries | number | 2 | Automatic retry count on transient errors (network failures, 5xx, 429). Set 0 to disable. |
fetch | typeof fetch | global fetch | Supply 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
| Option | Type | Description |
|---|---|---|
timeout | number | Override global timeout for this request |
maxRetries | number | Override global retry count for this request |
signal | AbortSignal | Cancellation 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"