OpenParable
Skip to content
← Back to skills

Elevenlabs Hello World

Apps & Automation
elevenlabs-hello-world

Elevenlabs Hello World is an Agent Skill for apps & automation published in the jeremylongshore/claude-code-plugins-plus-skills repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Generate your first ElevenLabs text-to-speech audio file. Use when starting a new ElevenLabs integration, testing your setup, or learning basic TTS API patterns. Trigger: "elevenlabs hello world", "elevenlabs example", "elevenlabs quick start", "first elevenlabs TTS", "text to speech demo".

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/HEAD/plugins/saas-packs/elevenlabs-pack/skills/elevenlabs-hello-world/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/elevenlabs-hello-world, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

ElevenLabs Hello World

Overview

Generate speech from text using the ElevenLabs TTS API. This skill covers the core POST /v1/text-to-speech/{voice_id} endpoint with real voice IDs, model selection, and audio output.

Prerequisites

  • Completed elevenlabs-install-auth setup
  • Valid API key in ELEVENLABS_API_KEY

Instructions

Step 1: Text-to-Speech with the SDK

TypeScript (recommended):

import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";
import { Readable } from "stream";
import { pipeline } from "stream/promises";

const client = new ElevenLabsClient();

async function generateSpeech() {
  // Use a pre-made voice — "Rachel" is a default voice available on all accounts
  // Find voice IDs via: GET /v1/voices
  const audio = await client.textToSpeech.convert("21m00Tcm4TlvDq8ikWAM", {
    text: "Hello! This is your first ElevenLabs text-to-speech generation.",
    model_id: "eleven_multilingual_v2",  // Best quality, 29 languages
    voice_settings: {
      stability: 0.5,           // 0-1: lower = more expressive
      similarity_boost: 0.75,   // 0-1: higher = closer to original voice
      style: 0.0,               // 0-1: higher = more dramatic (costs more latency)
      speed: 1.0,               // 0.7-1.2: speech speed multiplier
    },
  });

  // audio is a ReadableStream — pipe to file
  await pipeline(
    Readable.fromWeb(audio as any),
    createWriteStream("output.mp3")
  );

  console.log("Audio saved to output.mp3");
}

generateSpeech().catch(console.error);

Python:

from elevenlabs.client import ElevenLabsClient

client = ElevenLabsClient()

audio = client.text_to_speech.convert(
    voice_id="21m00Tcm4TlvDq8ikWAM",  # Rachel
    text="Hello! This is your first ElevenLabs text-to-speech generation.",
    model_id="eleven_multilingual_v2",
    voice_settings={
        "stability": 0.5,
        "similarity_boost": 0.75,
        "style": 0.0,
    },
)

with open("output.mp3", "wb") as f:
    for chunk in audio:
        f.write(chunk)

print("Audio saved to output.mp3")

Step 2: Using cURL (Raw REST API)

curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM" \
  -H "xi-api-key: ${ELEVENLABS_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from the ElevenLabs API!",
    "model_id": "eleven_multilingual_v2",
    "voice_settings": {
      "stability": 0.5,
      "similarity_boost": 0.75
    }
  }' \
  --output output.mp3

Step 3: Streaming TTS (Low Latency)

For real-time playback, use the streaming endpoint:

async function streamSpeech() {
  const audioStream = await client.textToSpeech.stream("21m00Tcm4TlvDq8ikWAM", {
    text: "This audio is streamed in real-time for low-latency playback.",
    model_id: "eleven_flash_v2_5",  // Optimized for streaming (~75ms latency)
    output_format: "mp3_22050_32",  // codec_sampleRate_bitrate
  });

  // Stream chunks arrive as they're generated
  const writer = createWriteStream("streamed.mp3");
  for await (const chunk of audioStream) {
    writer.write(chunk);
  }
  writer.end();
  console.log("Streamed audio saved to streamed.mp3");
}

Available Models

Model IDQualityLatencyLanguagesCost (credits/char)
eleven_v3Highest expressivenessMedium70+1.0
eleven_multilingual_v2High quality, emotionalMedium291.0
eleven_flash_v2_5Good, ultra-fast~75ms320.5
eleven_turbo_v2_5Good, fastLow320.5
eleven_monolingual_v1English onlyLow10.5

Common Default Voice IDs

VoiceIDStyle
Rachel21m00Tcm4TlvDq8ikWAMCalm, narration
DomiAZnzlk1XvdvUeBnXmlldStrong, assertive
BellaEXAVITQu4vr4xnSDxMaLSoft, warm
AntoniErXwobaYiN019PkySvjVWell-rounded, male
JoshTxGEqnHWrfWFTfGW9XjXDeep, narrative

Output Formats

Specified as codec_sampleRate_bitrate:

  • mp3_44100_128 (default, high quality)
  • mp3_22050_32 (smaller file, streaming)
  • pcm_16000 (raw PCM for processing)
  • pcm_44100 (high-quality raw)
  • ulaw_8000 (telephony)

Error Handling

ErrorHTTPCauseSolution
voice_not_found404Invalid voice_idUse GET /v1/voices to list valid IDs
invalid_api_key401Bad or missing keyCheck ELEVENLABS_API_KEY env var
model_not_found400Wrong model_id stringUse exact IDs from models table
text_too_long400Exceeds 5,000 charsSplit into chunks; use streaming for long text
quota_exceeded401Monthly character limit hitCheck usage at elevenlabs.io/app/usage

Resources

Next Steps

Proceed to elevenlabs-local-dev-loop for development workflow setup, or elevenlabs-core-workflow-a for voice cloning.