#How can I use voices of eleven labs here
1 messages · Page 1 of 1 (latest)
Short answer: Use a voice_id with ElevenLabs’ Text‑to‑Speech API (or WebSocket streaming) to synthesize audio, then play the returned audio in your app.
How to do it
- Get an API key and send it in the xi-api-key header on every request. (elevenlabs.io)
- Find a voice_id:
- List all voices you can use: GET https://api.elevenlabs.io/v2/voices (returns voice_id, name, preview_url, etc.). (elevenlabs.io)
- Default voices: you can view/copy their IDs from My Voices, or fetch them via the List voices endpoint. (help.elevenlabs.io)
- Synthesize speech (HTTP):
- Endpoint: POST https://api.elevenlabs.io/v1/text-to-speech/:voice_id
- Minimal example (MP3 output):
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/VOICE_ID?output_format=mp3_44100_128"
-H "xi-api-key: YOUR_API_KEY" -H "Content-Type: application/json"
-d '{"text":"Hello!","model_id":"eleven_multilingual_v2"}' > out.mp3 - Details (required/optional fields, models, continuity controls) are in the Create speech reference. (elevenlabs.io)
- Stream in real time (lower latency):
- Use the WebSocket TTS stream-input endpoint (wss://…/text-to-speech/{voice_id}/stream-input) to start playback before the full file is ready. (elevenlabs.io)
- Multi-voice dialogue (single call):
- Send an array of {text, voice_id} pairs to the Text-to-Dialogue API; streaming is also available. (elevenlabs.io)
Notes
- Formats: MP3 by default; PCM and μ-law are available if you need telephony/low-latency pipelines. (elevenlabs.io)
- Voice Library via API: not available to free-tier users. (elevenlabs.io)
- Official SDKs (Python, JavaScript/TypeScript) are provided if you prefer not to call HTTP directly. (elevenlabs.io)
If you share which environment you’re integrating (web app, backend, phone/IVR, etc.), I can point you to the exact SDK/WebSocket guide in the docs. (elevenlabs.io)
Sources:
ElevenAPI - ElevenLabs the most powerful AI audio APIs
List voices | ElevenLabs Documentation
How do I access ElevenLabs Default voices? – ElevenLabs
Create speech | ElevenLabs Documentation
Generate audio in real-time | ElevenLabs Documentation
Text to Dialogue | ElevenLabs Documentation
Text to Speech (TTS) API - ElevenLabs
Voice Library | ElevenLabs Documentation
Introduction | ElevenLabs Documentation
Documentation | ElevenLabs Documentation
/tts [hello]