Modern, TypeScript-first text-to-speech for the browser.
# npm
npm install @responsivevoice/core
# yarn
yarn add @responsivevoice/core
# pnpm
pnpm add @responsivevoice/coreOut of the box, core runs in demo mode — it speaks with the browser's default voice only. Registering and verifying your website unlocks the full server voice catalog:
- Register for a free ResponsiveVoice account.
- A default website is created for you automatically — its identifier is your API key. Copy it from the dashboard.
- Initialize core with your API key.
- Verify your website's domain in the dashboard so requests from your site are recognized — this unlocks the full set of voices.
import { getResponsiveVoice } from '@responsivevoice/core';
const rv = await getResponsiveVoice({ apiKey: 'YOUR_API_KEY' });
// Basic usage
rv.speak('Hello world', 'UK English Female');
// With options
rv.speak('Hello world', 'UK English Female', {
pitch: 1.0,
rate: 1.0,
volume: 1.0,
onstart: () => console.log('Started'),
onend: () => console.log('Finished'),
});<script src="https://cdn.responsivevoice.org/sdk/latest/responsivevoice.js"></script>
<script>
responsiveVoice.init({ apiKey: 'YOUR_API_KEY' });
responsiveVoice.speak('Hello world', 'UK English Female');
</script>// Recommended: async factory (creates singleton, calls init internally)
const rv = await getResponsiveVoice({ apiKey: 'YOUR_KEY' });
// Alternative: manual construction + init
const rv = new ResponsiveVoice();
await rv.init({ apiKey: 'YOUR_KEY' });| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
— | Your registered website/origin identifier |
defaultVoice |
string |
'UK English Female' |
Default voice name |
forceFallback |
boolean |
false |
Force HTTP audio (skip native TTS) |
characterLimit |
number |
100 |
Text chunk character limit |
transport |
string |
'chunks' |
Audio transport: chunks/stream/websocket |
Speaks the given text.
rv.speak('Hello world');
rv.speak('Hello world', 'US English Male');
rv.speak('Hello world', 'UK English Female', {
rate: 1.2,
onend: () => console.log('Done'),
});Stops all speech.
rv.cancel();Pauses current speech.
rv.pause();Resumes paused speech.
rv.resume();Returns available voices.
const voices = rv.getVoices();
// [{ name: 'UK English Female', lang: 'en-GB', gender: 'f' }, ...]Returns whether speech is currently playing.
if (rv.isPlaying()) {
rv.cancel();
}rv.speak('Hello', 'UK English Female', {
onstart: () => console.log('Started'),
onend: () => console.log('Finished'),
onerror: (error) => console.error('Error:', error),
});For detailed compatibility information, see the Browser Support documentation.
Minimum browser versions:
| Browser | Min Version | Native TTS | Fallback API |
|---|---|---|---|
| Chrome | 66+ | Yes | Yes |
| Firefox | 57+ | Limited | Yes |
| Safari | 14+ | Yes | Yes |
| Edge | 16+ | Yes | Yes |
| iOS Safari | 14+ | Yes | Yes |
| Chrome Android | 66+ | Yes | Yes |
Core targets the browser. Install it from npm and bundle it with Vite, webpack, or any modern bundler — it runs in the browser, not server-side. For server-side or headless TTS (HTTP synthesis without a browser), use @responsivevoice/api-client directly.
<!-- Before -->
<script src="https://code.responsivevoice.org/responsivevoice.js?key=YOUR_KEY"></script>
<script>
responsiveVoice.speak('Hello');
</script>
<!-- After — only change: remove ?key from URL, add init() call -->
<script src="https://cdn.responsivevoice.org/sdk/latest/responsivevoice.js"></script>
<script>
responsiveVoice.init({ apiKey: 'YOUR_KEY' });
responsiveVoice.speak('Hello');
</script>See the Migration Guide for details.
Full documentation at docs.responsivevoice.org.
Other language SDKs: Python · Go · PHP · Java
AI coding agents: install the ResponsiveVoice skill — npx skills add responsivevoice/skills