> ## Documentation Index
> Fetch the complete documentation index at: https://docs.responsivevoice.org/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

Official TypeScript REST client with full typing, retry logic, WebSocket streaming, and Node.js/browser support. Source: [`api-client`](https://github.com/responsivevoice/api-client).

## Installation

```bash
npm install @responsivevoice/api-client
```

## Quick Start

```typescript
import { ResponsiveVoiceAPIClient } from '@responsivevoice/api-client';

const client = new ResponsiveVoiceAPIClient({
  apiKey: process.env.RESPONSIVEVOICE_API_KEY,
  apiSecret: process.env.RESPONSIVEVOICE_API_SECRET,
});

// Synthesize
const audio = await client.synthesize({
  text: 'Hello world',
  voice: 'UK English Female',
  format: 'mp3',
});
console.log(audio.blob, audio.url, audio.format);

// List voices (with optional filters)
const { voices } = await client.getVoices({ lang: 'en-GB', gender: 'female' });

// Cancel a request
const controller = new AbortController();
setTimeout(() => controller.abort(), 5_000);
await client.synthesize(
  { text: 'Long text…', voice: 'UK English Female' },
  { signal: controller.signal },
);
```

## Authentication

Server-side callers send an `apiKey` + `apiSecret` pair (the client attaches them as `X-API-Key` + `X-API-Secret`). Get both from your website's settings in the [ResponsiveVoice dashboard](https://app.responsivevoice.org) ([sign up](https://responsivevoice.org/register)): the **API key** from the "Your site code" snippet, and the **API secret** under "Server-to-server API secrets" (shown only once, revocable). Keep the secret server-side — browser apps use [`@responsivevoice/core`](/getting-started/quick-start/), which authenticates by origin and needs no secret.

## Runtime Notes

- **Node 18+**: works out of the box (native `fetch`, `Blob`, `AbortController`).
- **Node 16–17**: pass a `fetch` polyfill via the `fetch` config option.
- **Node \< 22 + WebSocket streaming**: pass a `WebSocket` implementation (e.g. `ws`) to `WebSocketConnection`.

## Reference Documentation

- [API Reference (TypeDoc)](/api/api-client/src/) — complete typed API surface
- [Package README on GitHub](https://github.com/responsivevoice/api-client#readme) — full walkthrough, all configuration options, error taxonomy, retry tuning

> [!TIP]
> The client defaults to the v2 API base URL. For help:
> [support@responsivevoice.org](mailto:support@responsivevoice.org).
