SDKs
# SDKs
> Client libraries for the ResponsiveVoice REST API
The REST API is plain HTTP and JSON, so any language that can make a request can use it. These clients are for when you would rather not hand-roll one.
[TypeScript](/sdks/typescript/)@responsivevoice/api-client — typed requests and responses, retries, and WebSocket streaming. Runs on Node.js and in the browser.
[PHP](/sdks/php/)responsivevoice/sdk — synthesis, voices, and configuration from any PHP server, with a Laravel integration example.
## Calling the API directly
[REST API](/rest-api/)The endpoints, request shapes, and response formats.
[Authentication](/rest-api/authentication/)How to authenticate a request from a server or a browser.
## Speaking in the browser
If your target is a web page rather than a server, you probably do not want a REST client at all. [`@responsivevoice/core`](/api/core/src/) speaks through the browser’s own voices and only falls back to the API when it has to — fewer requests, no round trip for most sentences.
# PHP SDK
> Using the PHP SDK for ResponsiveVoice text-to-speech
Official PHP client for the ResponsiveVoice Text-to-Speech API. Source: [`sdk-php`](https://github.com/responsivevoice/sdk-php).
## Installation
```bash
composer require responsivevoice/sdk
```
## Quick Start
```php
setApiKey('X-API-Key', getenv('RESPONSIVEVOICE_API_KEY'))
->setApiKey('X-API-Secret', getenv('RESPONSIVEVOICE_API_SECRET'));
// Synthesize speech — returns raw MP3 bytes.
$audio = (new SynthesisApi(new Client(), $config))
->v2TextSynthesizeGet('Hello world', 'UK English Female');
file_put_contents('hello.mp3', $audio);
// List voices, optionally filtered by language.
$voices = (new VoicesApi(new Client(), $config))->v2VoicesGet()->getVoices();
```
## Authentication
Server-side callers send an API key + secret pair as `X-API-Key` + `X-API-Secret` headers. 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). PHP runs server-side, which is exactly where the secret belongs — browser apps use [`@responsivevoice/core`](/getting-started/quick-start/), which authenticates by origin and needs no secret.
## Reference Documentation
* [Package README on GitHub](https://github.com/responsivevoice/sdk-php#readme) — full walkthrough, error handling, and the voice/synthesis surface
* [Runnable examples](https://github.com/responsivevoice/sdk-php/tree/main/examples) — standalone PHP and a Laravel integration
* [REST API reference](/rest-api/) — the underlying HTTP endpoints, for any language
Tip
Requires PHP 8.2+. For help: .
# TypeScript SDK
> Using @responsivevoice/api-client for typed TTS API access
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: .