Installation
Core package
Section titled “Core package”The main client library for browser text-to-speech. Both paths deliver the same package — pick the one that fits your project:
- Browser bundle (CDN) — no build step; add one script tag and use the global
responsiveVoice. Best for plain HTML, prototypes, CMS sites, and legacy pages. Callinit()with your API key — without it you get demo mode (browser default voice only). - npm — for apps with a bundler (Vite, webpack, Next). Install and import.
<script src="https://cdn.responsivevoice.org/sdk/latest/responsivevoice.js"></script><script> responsiveVoice.init({ apiKey: 'YOUR_API_KEY' }); responsiveVoice.speak('Hello, world!');</script>npm install @responsivevoice/core# or: pnpm add @responsivevoice/core# or: yarn add @responsivevoice/coreimport { getResponsiveVoice } from '@responsivevoice/core';
const rv = await getResponsiveVoice({ apiKey: 'YOUR_API_KEY' });API client
Section titled “API client”REST API client for direct server communication.
npm install @responsivevoice/api-clientpnpm add @responsivevoice/api-clientyarn add @responsivevoice/api-clientTypes package
Section titled “Types package”@responsivevoice/types (TypeScript types + Zod schemas) ships automatically as a dependency of the packages above, and api-client re-exports the common ones — so you rarely install it directly. If you want the schemas standalone: npm install @responsivevoice/types.
Requirements
Section titled “Requirements”Browsers
Section titled “Browsers”Chrome 66+, Firefox 57+, Safari 12+, Edge 17+, iOS Safari 12+, Chrome Android 66+.
The browser bundle (CDN) includes all necessary polyfills and works in these browsers without any additional setup. ESM/CJS packages are syntax-compatible but leave browser polyfilling to your bundler.
Node.js
Section titled “Node.js”| Package | Minimum | Full functionality |
|---|---|---|
@responsivevoice/types | 14+ | All features |
@responsivevoice/text | 14+ | All features |
@responsivevoice/api-client | 16+ | HTTP synthesis requires Node 18+ for native fetch and Blob. On Node 16–17, pass a fetch implementation via the fetch config option (e.g. node-fetch or undici). |
@responsivevoice/core | 16+ | Browser-only (Web Speech API + audio playback); Node is the build environment (bundle with Vite/webpack), not a runtime target |
@responsivevoice/features | 14+ | Browser-only (DOM APIs) |
WebSocket streaming requires Node 22+ for the native WebSocket global, or pass any W3C-compatible WebSocket implementation (e.g. the ws package) via the WebSocket config option.
TypeScript
Section titled “TypeScript”5.0+ (optional, but recommended). Full type definitions included in all packages.