ElevenLabs: Code to Voice and Complete Features for Creators & Developers
By Tim APIPedia, Tim Engineering APIPedia · Published · Updated · 7 min read
Get to know ElevenLabs: change text to sound via code (code to voice), plus voice cloning, dubbing, music, sound effects and voice agent features.
ElevenLabs is an audio AI platform that transforms text into a very natural human voice, complete with emotion, intonation, and dozens of languages. Initially known as a text-to-speech tool, now ElevenLabs has developed into a complete audio ecosystem: voice cloning, video dubbing, transcription, music, sound effects, even voice agents that can be chatted with.
For developers, the most interesting part is code to voice: just a few lines of code, your application can "talk". This article discusses how it works, ready-to-use code examples, and a summary of ElevenLabs' most useful features.
No ElevenLabs account yet?Click here to register for free.
What is "code to voice" in ElevenLabs?
Code to voice means you produce sound directly from the code, not by clicking on the dashboard. All ElevenLabs packages, including the free package, have API access. The ElevenLabs website itself is basically just a frontend for the same API, so the sound quality through the code is identical to what you hear in the app.
The flow is simple:
- Send text + voice ID (voice_id) + model to Text to Speech endpoint.
- ElevenLabs returns audio files (e.g. MP3).
- Save, play, or stream that audio in your app.
Examples of use: voice notifications in applications, automatic narration for blog articles, voice-over for mass video content, WhatsApp bots that reply with voice notes, to games with characters who can talk.
Step 1: Prepare API key
- Create an ElevenLabs account (free).
- Open the API Keys menu on the dashboard, then create a new key.
- Store keys in environment variables, don't write them directly in the code or in the frontend application.
export ELEVENLABS_API_KEY="sk_xxxxxxxxxxxxxxxx"Step 2: Code to voice with cURL
The fastest way to try without installing anything. The command below uses the voice "George" and model eleven_v3, then saves the result to halo.mp3.
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/JBFqnCBsd6RMkjVDRZzb?output_format=mp3_44100_128" \
-H "xi-api-key: $ELEVENLABS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Halo! Ini suara pertama saya yang dibuat lewat kode.",
"model_id": "eleven_v3"
}' \
--output halo.mp3Step 3: Code to voice in Python
For real projects, use the official SDK to make it neater.
pip install elevenlabs python-dotenvimport os
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs
load_dotenv()
client = ElevenLabs(api_key=os.getenv("ELEVENLABS_API_KEY"))
audio = client.text_to_speech.convert(
text="Selamat datang di blog kami. Artikel ini dibacakan oleh AI.",
voice_id="JBFqnCBsd6RMkjVDRZzb", # ganti dengan suara favoritmu dari Voice Library
model_id="eleven_v3",
output_format="mp3_44100_128",
)
# SDK mengembalikan potongan-potongan byte; gabungkan lalu simpan
with open("narasi.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
print("Audio tersimpan di narasi.mp3")Want another sound? Browse over 10,000 voices in the Voice Library, copy voice_id of them, then replace them in the code. An official SDK is also available for JavaScript/TypeScript ( @elevenlabs/elevenlabs-js).
Bonus: use from AI coding assistant
If you code with an AI assistant, ElevenLabs also provides text-to-speech skills that can be installed with one command:
npx skills add elevenlabs/skills --skill text-to-speechElevenLabs features that you must know
Currently ElevenLabs is divided into two product lines: ElevenCreative for creators and content teams, and ElevenAgents for product and customer service teams who need voice agents. Almost all of the features below can also be accessed via API.
1. Text to Speech (Eleven v3)
Flagship feature. The Eleven v3 model produces expressive sounds with emotional control via audio tags (e.g. whispering, laughing, or excited) and supports more than 70 languages, including Indonesian. Suitable for YouTube narration, audiobooks, podcasts and e-learning.
2. Voice Cloning
Create your own voice imitations from short recordings. Instant Voice Cloning requires about a minute of audio, while Professional Voice Cloning requires more recording for nearly indistinguishable results. For security reasons, professional cloning requires verification that the uploaded voice is indeed yours.
3. Voice Design
Don't have a sound sample? Just describe the voice you want ("middle-aged man, warm, relaxed accent") and ElevenLabs creates a new voice from scratch.
4. Voice Changer (Speech to Speech)
Record your own voice, then change it to another voice. Your original intonation, pauses and emotions remain intact, only the color of your voice changes. Suitable for character content or voice acting.
5. Dubbing (Dubbing v2)
Translate video or audio into another language while preserving the speaker's original voice. Dubbing v2 released mid-2026 supports more than 90 languages. There is a Dubbing Studio for editing results per segment.
6. Speech to Text (Scribe v2)
ElevenLabs transcription model, launching January 2026, supports 90+ languages. Useful for subtitles, meeting minutes, or turning podcasts into articles.
7. Music (Music v2)
Create songs from text prompts, complete with vocals or instrumentals, multilingual lyrics, and the ability to edit specific song parts. Suitable for background sound for content, advertisements or jingles.
8. Sound Effects
Type “sound of creaking wooden door in old house” and get the sound effect in seconds. A lifesaver for video editors and game developers.
9. Voice Isolator
Clean the recording from background noise such as fans, vehicles or crowds, so that the result sounds like it was recorded in a studio.
10. Studios
Timeline-based editor for combining narration, music, and sound effects into complete productions such as audiobooks, podcasts, or videos.
11. Agents (ElevenAgents)
Build AI voice agents that can converse in real-time: customer service, virtual receptionist, or sales assistant. Agents can be connected to your phone, website, and internal systems, and there is a CLI to create and deploy agents from the terminal.
How much does it cost?
ElevenLabs uses a credit system. The Free plan provides around 10,000 credits per month and includes text to speech, speech to text, sound effects, music, agents, and API access. Starter plans start at around $5 per month with 30,000 credits, plus commercial licensing, instant voice cloning, and Dubbing Studio. Prices may change, so check the official pricing page before subscribing.
Tips for making the sound more natural
- Write like people talk. Short sentences, clear punctuation, and avoid ambiguous abbreviations.
- Write the number the way it is read if necessary, for example "two thousand and twenty-six" so that the pronunciation is correct.
- Take advantage of audio tags in Eleven v3 to add emotion to certain parts.
- Choose a voice that matches the language. Try some voices from the Voice Library for Indonesian subtitles.
- Keep the API key on the server. Never put it in frontend code or mobile applications.
FAQs
Does ElevenLabs speak Indonesian?
Can. ElevenLabs text to speech supports more than 70 languages, including Indonesian, and its dubbing and transcription features also include Indonesian.
Is ElevenLabs API free?
API access is available on all plans, including Free. Usage deducts the same monthly credit as usage on the dashboard.
Can the sound results be used for commercial content?
For commercial use, you need a paid plan (starting with Starter). The free plan is intended for trial and personal use.
Can I clone someone else's voice?
Cloning is only permitted for sounds you have rights to. Professional Voice Cloning even requires verification of the owner's voice.
Ready to make your app talk?
Starting from the free plan, try the code examples above, and hear for yourself how natural the results are. In five minutes, your first text can be turned into sound.
No ElevenLabs account yet?Click here to register.
Note: the ElevenLabs links in this article are affiliate links. We may earn a commission if you subscribe via these links, at no additional cost to you.
Source
Topics: #elevenlabs #text to speech #ai voice #tutorial #api #voice cloning
${c.about}
Tim APIPedia — Tim Engineering APIPedia
Tim engineering di balik APIPedia yang membangun dan memelihara API data Indonesia - ongkir, OCR KTP, data wilayah, BMKG, hingga server MCP - dan menulis panduan integrasinya dari pengalaman langsung.