Triqai client accepts a configuration object as the second argument. All options are optional and have sensible defaults.
Full Configuration
Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | https://api.triqai.com | API base URL |
maxRetries | number | 3 | Maximum number of retry attempts for transient errors |
retryDelay | number | 500 | Base delay between retries in milliseconds |
maxRetryDelay | number | 30000 | Maximum delay between retries in milliseconds |
timeout | number | 60000 | Request timeout in milliseconds |
defaultHeaders | Record<string, string> | {} | Extra headers sent with every request |
onRequest | (info) => void | — | Called before each request with method, URL, and headers |
onResponse | (info) => void | — | Called after each response with status, duration, and headers |
Debug Hooks
UseonRequest and onResponse to log or monitor API calls without modifying your application logic:
Environment Variables
A common pattern is to read the API key from an environment variable:.env