ElevenLabs API: How to Get Started With Python
The ElevenLabs API lets developers turn text into speech, transcribe audio, generate music and run voice agents from their own code. Getting started takes three things: an API key from the dashboard, the official elevenlabs Python package, and a voice ID. API usage is priced from $0.04 to $0.08 per 1,000 characters for text to speech, depending on the model.
Last updated: October 2026. Plans and credit costs checked against ElevenLabs’ official pricing page.
What is the ElevenLabs API?
The ElevenLabs API is a set of REST endpoints and official SDKs that expose the same models used in the ElevenLabs web app. A developer sends text or audio with an API key in the request header and gets audio, text or agent responses back, which makes it possible to automate voiceovers, narration and voice features inside an app.
“An application programming interface (API) is a connection between computers or between computer programs.”
Source: Wikipedia, API
For ElevenLabs, that connection mostly carries text in and audio out. The text to speech endpoint is the one most projects start with, so this guide uses it as the first working example and then widens out to the other products. If the main goal is narration inside the browser editor rather than code, the ElevenLabs text to speech settings guide is the better starting point.
In short, the API is the programmable side of ElevenLabs, and text to speech is the natural first call.
What do you need before your first request?
A first ElevenLabs API request needs an account, an API key, a working Python install and a voice ID to speak with. Any plan, including Free, can create a key, but Free usage is limited to non-commercial purposes under the Terms, so production apps should plan on a paid tier from the start.
Here are the 5 prerequisites to have ready before writing any code:
- An ElevenLabs account: The account owns the API key, the credit balance and every voice the code can call, so sign-up comes first, ideally with a work email for commercial projects.
- An API key: The key is created in the dashboard’s API keys settings page and travels in the xi-api-key header, so it should be stored as a secret and never committed to Git.
- Python and pip: The official Python SDK installs from PyPI with pip, and the quickstart also uses python-dotenv to load the key from a local .env file at runtime.
- A voice ID: Every text to speech call targets one voice by its ID, either a default library voice or a custom voice saved in the account’s own voice list.
- Audio playback tools: The SDK’s play helper may need MPV or ffmpeg installed locally, according to the ElevenLabs quickstart, so installing one of them avoids a confusing first error.
With these five pieces in place, the first request is a ten-line script.
How to create an ElevenLabs API key
Creating an ElevenLabs API key is a short dashboard task that produces a secret string the SDK reads at runtime. The key identifies the account for billing and permissions, so anyone holding it can spend credits. Treat it like a password: store it in an environment variable or a secrets manager, not in source code.
- Sign in to ElevenLabs and open the API keys page in the dashboard settings.
- Create a new key and give it a recognizable name, such as the project it belongs to.
- Copy the key once and paste it into a
.envfile asELEVENLABS_API_KEY. - Add
.envto.gitignoreso the key never reaches a public repository. - Rotate the key from the same page if it is ever exposed.
.env
ELEVENLABS_API_KEY=paste-your-key-here
One key per project keeps usage easy to trace and makes rotation painless.
Need an API key? Create a free ElevenLabs account first.
Open ElevenLabs Free →Free plan available, no credit card needed to start.
Install the ElevenLabs Python SDK
The ElevenLabs Python SDK is the official client published on PyPI under the package name elevenlabs. It wraps the REST endpoints in typed methods, handles authentication from the key you pass in, and ships a small play helper for local playback. Install it together with python-dotenv in a fresh virtual environment.
Terminal
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install elevenlabs python-dotenv
A virtual environment keeps the SDK version pinned per project, which matters because ElevenLabs ships new models often and model IDs change. The ElevenLabs CLI (npm package @elevenlabs/cli) is an alternative for quick one-off generations from the terminal, but the Python SDK is the better base for anything that runs repeatedly.
Two packages, one virtual environment, and the setup is done.
How do you make your first text to speech request?
A first text to speech request with the ElevenLabs API loads the key, creates a client, and calls text_to_speech.convert with text, a voice ID, a model ID and an output format. The script below follows the official quickstart and plays the result through the speakers, which confirms that authentication and audio both work.
example.py
import os
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs
from elevenlabs.play import play
load_dotenv()
elevenlabs = ElevenLabs(api_key=os.getenv("ELEVENLABS_API_KEY"))
audio = elevenlabs.text_to_speech.convert(
text="The first move is what sets everything in motion.",
voice_id="JBFqnCBsd6RMkjVDRZzb", # "George", a default voice in the docs
model_id="eleven_v4",
output_format="mp3_44100_128",
)
play(audio)
Save the file as example.py and run python example.py. Each parameter has a clear job: text is what gets spoken, voice_id picks the voice, model_id picks the engine, and output_format sets codec and quality. Swapping the voice ID for one copied from the account’s voice list is the fastest way to hear a different speaker.
If the script plays a sentence, the account, key and SDK are all wired correctly.
Calling the REST endpoint directly with curl
The ElevenLabs REST endpoint for text to speech is POST /v1/text-to-speech/{voice_id} on api.elevenlabs.io, authenticated with the xi-api-key header. Calling it directly is useful for languages without an official SDK, for serverless functions, and for debugging what the SDK sends under the hood.
Terminal
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/JBFqnCBsd6RMkjVDRZzb" \
-H "xi-api-key: $ELEVENLABS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "The first move is what sets everything in motion.", "model_id": "eleven_v4"}' \
--output speech.mp3
The response body is the audio itself, so --output writes it straight to a file. The optional voice_settings object accepts stability, similarity_boost, style, use_speaker_boost and speed, the same controls the web app exposes as sliders.
Raw HTTP and the SDK hit the same endpoint; the SDK just saves typing.
Which model should the API call use?
The model ID decides quality, latency, language coverage and price for every ElevenLabs API call. Eleven v4 and Eleven v3 favor expressive output, Flash models favor speed, and the API pricing page charges the expressive models twice the Flash rate per 1,000 characters. Picking the model per use case is the biggest cost lever available.
“Models control the quality, latency, and language coverage of generated audio.”
Source: ElevenLabs Docs
| Model ID | Languages | Latency | Character limit | API price per 1,000 chars |
|---|---|---|---|---|
| eleven_v4 | 90+ | Not listed | 10,000 | $0.08 |
| eleven_v4_turbo | 90+ | ~100ms | Not stated | $0.04 |
| eleven_v3 | 70+ | Not listed | 5,000 | $0.08 |
| eleven_multilingual_v2 | 29 | Not listed | 10,000 | $0.08 |
| eleven_flash_v2_5 | 32 | ~75ms | 40,000 | $0.04 |
| eleven_flash_v2 | English only | ~75ms | 30,000 | $0.04 |
Source: ElevenLabs models docs (elevenlabs.io/docs/models) and API pricing (elevenlabs.io/pricing/api), checked October 2026. Latency excludes application and network latency.
The pattern is simple: pay double for expressiveness, or pay half for speed and very long character limits.
Here are the 5 model choices that cover most API projects:
- Eleven v4 for narration: The most emotionally rich model in the lineup suits YouTube voiceovers, ads and audiobook chapters where delivery matters more than response time or cost per character.
- Eleven v4 Turbo for live apps: This model pairs 90+ language coverage with roughly 100ms model latency, making it a strong default for interactive products that still need expressive speech.
- Eleven v3 for expressive scripts: Human-like, expressive generation across 70+ languages fits character dialogue and storytelling, though its 5,000 character limit means longer scripts need splitting into chunks.
- Flash v2.5 for real-time voice: Around 75ms model latency, 32 languages and a 40,000 character limit make Flash the practical pick for chatbots, phone flows and high-volume batch jobs.
- Multilingual v2 for legacy pipelines: The previous-generation model still works and is not deprecated, so existing integrations can keep it while new builds move to v4 or Flash.
Older Turbo v2 and v2.5 IDs are deprecated, and the docs point to the matching Flash model as the replacement. The full ElevenLabs model comparison goes deeper on voice quality differences.
Choose v4 for quality, Flash for speed, and avoid deprecated Turbo IDs in new code.
ElevenLabs API pricing per 1,000 characters
ElevenLabs API pricing for text to speech is listed per 1,000 characters: $0.08 for Eleven v4, Eleven v3 and Multilingual v2, and $0.04 for Eleven v4 Turbo, Eleven v3 Conversational and Flash. Because billing follows characters rather than seconds, script length is the number to watch when estimating spend for an app or content pipeline.
A worked example makes the math concrete. Assume roughly 1,000 characters per minute of speech (an approximation; real pace varies by voice and script). A 10-minute voiceover is then about 10,000 characters, which costs about $0.80 on Eleven v4 or $0.40 on Flash at API rates.
Subscription credits work alongside this. ElevenLabs’ docs describe credits as shared across every product, and text to speech on Multilingual v2 costs about one credit per character, so that same script would use roughly 10,000 credits, the entire monthly allowance of the Free plan. Startups can also apply to the Startup Grants Program, which ElevenLabs lists as free for 12 months with 33,000,000 characters. Plan-level math lives in the ElevenLabs pricing breakdown.
At API rates, a full 10-minute script costs well under a dollar, so model choice matters more than script length for most budgets.
How do plan credits and concurrency limit API usage?
Plan credits and concurrency are the two limits that shape real API throughput on ElevenLabs. Credits cap how much audio the account can generate each month, while concurrency caps how many text to speech requests can run at the same time. A busy app usually hits the concurrency ceiling before it runs out of credits.
| Plan | Monthly price | Credits per month | Concurrent TTS requests (approx.) |
|---|---|---|---|
| Free | $0 | 10,000 | 2 |
| Starter | $6 | 30,000 | 3 |
| Creator | $22 | 121,000 | 5 |
| Pro | $99 | 600,000 | 10 |
| Scale | $299 | 1,800,000 | 15 |
| Business | $990 | 6,000,000 | 25 |
Source: ElevenLabs pricing page (elevenlabs.io/pricing), checked October 2026. Concurrency shown on the page as approximate values.
Concurrency grows faster than price at the low end, so moving from Free to Creator more than doubles parallel requests.
Two other plan details matter for developers. Pro adds 44.1kHz PCM output via the API, which helps when audio feeds into further editing. Unused credits on paid plans roll over for up to two months, but cancelling or downgrading forfeits them, as explained in the guide to how ElevenLabs credits work.
Size the plan on peak parallel requests first and monthly characters second.
Compare credits and concurrency before you ship.
See ElevenLabs Plans →Monthly or annual billing; annual works out to two months free.
Official SDKs and libraries beyond Python
ElevenLabs official SDKs cover Python and JavaScript for the core REST API, plus a wider set of agent SDKs for web, mobile and Flutter. Community libraries extend support to .NET, Unity and the Vercel AI SDK. Choosing an official package means faster access to new models and fewer breaking surprises when endpoints change.
| Use | Package | Maintained by |
|---|---|---|
| REST API, Python | elevenlabs (PyPI) | ElevenLabs |
| REST API, JavaScript/TypeScript | @elevenlabs/elevenlabs-js (npm) | ElevenLabs |
| Agents, web | @elevenlabs/client, @elevenlabs/react | ElevenLabs |
| Agents, mobile | @elevenlabs/react-native, ElevenLabsSwift, io.elevenlabs/elevenlabs-android | ElevenLabs |
| Agents, Flutter | elevenlabs_agents | ElevenLabs |
| Command line | @elevenlabs/cli (npm) | ElevenLabs |
| .NET, Unity, Vercel AI SDK | ElevenLabs-DotNet, com.rest.elevenlabs, ai | Community |
Source: ElevenLabs libraries page (elevenlabs.io/docs/developers/resources/libraries), checked October 2026.
Official packages cover every mainstream stack, so community libraries are only needed for game engines and .NET.
Here are the 5 package choices most teams make:
- Python backend services: The elevenlabs package on PyPI suits batch narration, content pipelines and Django or FastAPI backends that generate audio files and store them for later playback.
- Node and TypeScript apps: The @elevenlabs/elevenlabs-js package brings the same endpoints to Next.js routes, serverless functions and Node workers, with typed responses for safer integration code.
- Browser voice agents: The @elevenlabs/client and @elevenlabs/react packages connect a web front end to a conversational agent, handling the live audio session instead of single file generation.
- Native mobile apps: ElevenLabsSwift, the Android Kotlin package and the React Native SDK bring agent conversations into iOS and Android apps without writing raw streaming code.
- Terminal workflows: The ElevenLabs CLI from npm generates audio from the command line, handy for scripts, quick checks and teams that prefer shell tooling over application code.
Match the package to where the audio is consumed, not to the language the team likes most.
What else can the API do beyond text to speech?
Beyond text to speech, the ElevenLabs API exposes speech to text, music, sound effects, voice changing, voice isolation, dubbing and conversational agents. Each product has its own API price on the pricing page, billed per minute or per hour of audio rather than per character, so budgeting differs from the text to speech math above.
Here are the 6 non-TTS endpoints and their listed API rates:
- Speech to text with Scribe v2: Transcription is listed at $0.22 per hour of audio, with the realtime variant at $0.39 per hour and optional add-ons such as keyterm prompting billed on top.
- Music generation: Text-to-music is listed at $0.15 per minute of generated audio, with a separate $1.50 fee for creating a music finetune that steers style.
- Sound effects: Text-to-SFX generation is listed at $0.12 per minute, suited to games, apps and video tools that need short effects generated on demand.
- Voice changer and isolator: Both speech-to-speech conversion and background-noise removal are listed at $0.12 per minute, useful for cleaning or restyling recorded user audio.
- Dubbing: Automatic dubbing starts at $0.33 per minute with a watermark and $0.50 without, while Dubbing v2 is listed at $2.20 per minute.
- Agents speech engine: The voice layer for conversational agents is listed at $0.08 per minute, with LLM costs described only as at cost and varying by model.
Voice agents are a big enough topic to stand alone; the ElevenLabs Agents build guide covers setup, included minutes and overage. Developers weighing a second provider can compare per-character rates in ElevenLabs vs OpenAI text to speech.
One API key unlocks the whole audio stack, each product with its own unit of billing.
Common first-request problems and fixes
Common ElevenLabs API problems on day one are configuration issues, not model issues. Most failures trace back to a key that did not load, a voice ID typo, missing playback tools, text longer than the model allows, or too many parallel calls for the plan. Each has a quick fix once the cause is known.
Here are the 5 issues that show up most often:
- Missing or unloaded key: When load_dotenv runs from a different working directory, the environment variable comes back empty and requests fail authentication, so printing a masked key length helps confirm loading.
- Wrong voice ID: Voice IDs are long opaque strings, not display names, so copying the ID from the voice list avoids sending a name like George where an ID belongs.
- Playback errors: The play helper depends on MPV or ffmpeg according to the quickstart, so a missing player looks like an SDK failure even though generation succeeded.
- Text over the character limit: Each model caps characters per request, such as 5,000 for Eleven v3, so long scripts should be split at paragraph boundaries before sending.
- Concurrency limits: Parallel requests above the plan’s concurrent limit get throttled, so batch jobs need a small worker pool sized to the plan rather than unlimited threads.
Fix configuration first; the models themselves rarely cause first-run failures.
Bottom line: is the ElevenLabs API worth building on?
The ElevenLabs API is worth building on for teams that need expressive voices, many languages and a single key for speech, transcription, music and agents. Official Python and JavaScript SDKs keep setup short, and per-character pricing makes small projects cheap. The main trade-off is managing concurrency and credits as usage grows.
“The API matters most when one key has to cover narration, transcription and live agents together.”
Source: GrowthStackKit, ElevenLabs Review
For a broader verdict on the product as a whole, read the complete ElevenLabs review. For developers ready to ship, the next step is simple: create a key, run the quickstart script, then swap in the model that fits the use case.
Start on Free to prove the integration, then move to a paid plan before any commercial launch.
Run your first ElevenLabs API call today.
Open ElevenLabs Free →Free plan available, no credit card needed to start.
Frequently asked questions
The 12 most-asked questions about the ElevenLabs API.
Is the ElevenLabs API free to use?
Yes, the Free plan can create an API key and includes 10,000 credits per month, enough for roughly 10 minutes of text to speech on Multilingual v2. Free usage is limited to non-commercial purposes under the ElevenLabs Terms, so commercial apps need a paid plan, starting with Starter at $6 per month.
How much does the ElevenLabs API cost per 1,000 characters?
The API pricing page lists text to speech at $0.08 per 1,000 characters for Eleven v4, Eleven v3 and Multilingual v2, and $0.04 per 1,000 characters for Eleven v4 Turbo, Eleven v3 Conversational and the Flash models. Other products such as music and transcription are billed per minute or per hour instead.
Which Python package is the official ElevenLabs SDK?
The official Python SDK is the elevenlabs package on PyPI, installed with pip. The quickstart pairs it with python-dotenv to load the ELEVENLABS_API_KEY variable from a .env file, then creates an ElevenLabs client and calls text_to_speech.convert with text, a voice ID, a model ID and an output format.
Where do I find my ElevenLabs API key?
API keys are created on the API keys page in the ElevenLabs dashboard settings. After creating a key, copy it into a .env file or a secrets manager as ELEVENLABS_API_KEY. Keep it out of source control, and rotate it from the same page if it is ever exposed publicly.
What header does the ElevenLabs REST API use for authentication?
Requests authenticate with the xi-api-key header carrying the API key. The text to speech endpoint is POST /v1/text-to-speech/{voice_id} on api.elevenlabs.io, with a JSON body containing the text and an optional model_id and voice_settings object. The response body is the generated audio.
Which model should I use for real-time apps?
For real-time apps, Flash v2.5 lists about 75ms model latency across 32 languages, and Eleven v4 Turbo lists about 100ms with 90+ languages. Both cost $0.04 per 1,000 characters via the API. These latency figures exclude application and network latency, so real response times will be higher.
Does the ElevenLabs API support JavaScript?
Yes. ElevenLabs maintains @elevenlabs/elevenlabs-js on npm for the REST API, plus @elevenlabs/client and @elevenlabs/react for browser-based voice agents. A React Native SDK, Swift and Kotlin packages and a Flutter package cover mobile, while community libraries add .NET and Unity support.
How many API requests can run at the same time?
Concurrency depends on the plan. The pricing page shows about 2 concurrent text to speech requests on Free, 3 on Starter, 5 on Creator, 10 on Pro, 15 on Scale and 25 on Business. Batch jobs should use a worker pool sized to that limit to avoid throttling.
Do API calls use the same credits as the web app?
ElevenLabs’ docs describe credits as the unit of consumption shared across every product, so subscription credits apply to usage in general. Text to speech on Multilingual v2 costs about one credit per character. The separate API pricing page also lists per-character and per-minute usage rates for each product.
Is there a character limit per API request?
Yes, limits vary by model. The docs list 10,000 characters for Eleven v4 and Multilingual v2, 5,000 for Eleven v3, 40,000 for Flash v2.5 and 30,000 for Flash v2. Limits for Eleven v4 Turbo and Eleven v3 Conversational are not stated, so long scripts should be split into chunks.
Can startups get free ElevenLabs API usage?
ElevenLabs runs a Startup Grants Program, which its API pricing page describes as free for 12 months with 33,000,000 characters. Eligibility rules are set by ElevenLabs, so teams should check the program page before planning around it. Everyone else pays standard plan or usage pricing.
Can I use ElevenLabs API audio commercially?
Commercial use requires a paid plan, as the Commercial License is listed from Starter upward, while free use is restricted to non-commercial purposes in the Terms. The Terms also state that users retain all rights in their output, which covers audio generated through the API on an eligible plan.
