#Hello
1 messages · Page 1 of 1 (latest)
Hi! How can I help you with ElevenLabs products or APIs today?
Hy
Hi! How can I help you with ElevenLabs today?
I need code
Happy to help—what do you need code for and in which language?
- Text-to-Speech over HTTP (one-off file)
- Low-latency streaming playback (HTTP chunked)
- Real-time via WebSocket
- Something else (STT, dubbing, voice cloning)?
Quick starts you can copy-paste:
-
HTTP TTS with cURL (returns MP3)
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":"The first move is what sets everything in motion.","model_id":"eleven_multilingual_v2"}'
Source: Create speech endpoint. (elevenlabs.io) -
Python SDK — generate and play audio
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs
from elevenlabs.play import play
import os
load_dotenv()
client = ElevenLabs(api_key=os.getenv("ELEVENLABS_API_KEY"))
audio = client.text_to_speech.convert(
text="The first move is what sets everything in motion.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_v3",
output_format="mp3_44100_128",
)
play(audio)
Source: ElevenAPI quickstart. (elevenlabs.io)
- Node/TypeScript — stream TTS audio (HTTP chunked)
import { ElevenLabsClient, stream } from "@elevenlabs/elevenlabs-js";
import { Readable } from "stream";
const client = new ElevenLabsClient();
async function main() {
const audioStream = await client.textToSpeech.stream("JBFqnCBsd6RMkjVDRZzb", {
text: "This is a test",
modelId: "eleven_v3",
});
await stream(Readable.from(audioStream)); // play locally
// Or iterate chunks:
// for await (const chunk of audioStream) { /* handle bytes */ }
}
main();
Source: Streaming (HTTP chunked) guide. (elevenlabs.io)
Note on real-time WebSockets: use the TTS WebSocket endpoint when you need bi‑directional, turn‑by‑turn audio; WebSockets are not available for the eleven_v3 model. If you want this mode, I can provide the Python/TS sample from the Realtime TTS guide. (elevenlabs.io)
Tell me:
- Your target language/runtime (Python, Node, browser, iOS, etc.)
- Mode (HTTP file, HTTP streaming, WebSocket real-time)
- Any specific model/voice or output format you need
I’ll tailor the code accordingly.
Sources:
Create speech | ElevenLabs Documentation
ElevenAPI quickstart | ElevenLabs Documentation
Streaming | ElevenLabs Documentation
Generate audio in real-time | ElevenLabs Documentation
I need redeemed code