HTTP Server
A minimal HTTP server that exposes REST endpoints for text-to-speech synthesis. Useful as a reverse proxy — keeps your API key off the browser and lets your frontend call your own origin.
Quick start
Section titled “Quick start”export RESPONSIVEVOICE_API_KEY="your-api-key" # https://app.responsivevoice.orgexport RESPONSIVEVOICE_API_SECRET="your-api-secret" # "Server-to-server API secrets"npm installnpm run server# Server on http://localhost:3001Endpoints
Section titled “Endpoints”| Method | Path | Description |
|---|---|---|
| GET | / | API documentation |
| GET | /voices | List all voices |
| GET | /voices/:lang | Voices by language |
| POST | /synthesize | Synthesize speech (JSON body) |
| GET | /synthesize?text=... | Synthesize via query params |
Calling from a frontend
Section titled “Calling from a frontend”async function speak(text) { const response = await fetch('http://localhost:3001/synthesize', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text, voice: 'UK English Female' }), }); const audio = new Audio(URL.createObjectURL(await response.blob())); audio.play();}The server ships with permissive CORS headers (Access-Control-Allow-Origin: *). Tighten to your domain(s) before deploying anything public-facing.
Next Steps
Section titled “Next Steps”- CLI Tool — same API client, command-line form
- REST API Overview — direct HTTP usage
- API Client Reference — full client documentation