How to Get an ElevenLabs API Key: A Step-by-Step Guide
On this page
In this guide, you'll learn how to get your ElevenLabs API key. You'll create an ElevenLabs account, generate your key, and make your first text-to-speech API call. We'll also show you a simpler alternative if you want text-to-speech without managing API keys or billing.
Prerequisites
- An email, GitHub, or Google account for signing up
- Basic familiarity with code (we'll show simple JavaScript examples)
Step 1: Create Your ElevenLabs Account
Go to elevenlabs.io/app/api. You'll see a login or sign-up page — create your account using your Google account, GitHub, or email.
Once you've signed up, you'll land on the dashboard.
Step 2: Generate Your API Key
Find the API Keys menu in the sidebar and navigate to the API keys page.
Click + Create Key to generate a new API key. You can set a descriptive name for your key and adjust restrictions and permissions as needed.
Important: Copy the key immediately after creation. ElevenLabs only shows it once. If you lose it, you'll need to generate a new one.
Store it somewhere safe — a password manager, an .env file, or your platform's secrets manager. Never commit API keys to a public repository.
Step 3: Make Your First API Call
Install the ElevenLabs SDK:
npm install @elevenlabs/elevenlabs-js
Then make a text-to-speech request:
import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';
const client = new ElevenLabsClient({ apiKey: 'your_api_key' });
// Get raw response with headers
const { data, rawResponse } = await client.textToSpeech
.convert('voice_id', {
text: 'Hello, world!',
modelId: 'eleven_multilingual_v2',
})
.withRawResponse();
// Access character cost from headers
const charCost = rawResponse.headers.get('x-character-count');
const requestId = rawResponse.headers.get('request-id');
const audioData = data;
If you get an audio file back, everything is working. You can explore different voices and models in the ElevenLabs documentation.
A Simpler Alternative with Puter.js
ElevenLabs gives you high-quality text-to-speech — but you still need to manage billing, credits, and API keys yourself.
Puter.js offers a simpler approach with the User-Pays model: your app's users cover their own AI costs. You don't need an API key at all, and you pay nothing for AI usage no matter how many users you have.
Just add the Puter.js script tag and start converting text to speech:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<button id="play">Speak!</button>
<script>
document.getElementById('play').addEventListener('click', () => {
puter.ai.txt2speech('Hello world! This is text-to-speech powered by Puter.js.')
.then((audio) => {
audio.play();
});
});
</script>
</body>
</html>
No API key, no backend, no billing setup. Puter.js supports text-to-speech models from ElevenLabs, AWS Polly, and OpenAI through a single puter.ai.txt2speech() function — giving you more flexibility for your text-to-speech app.
In addition to text-to-speech, Puter also provides:
- Speech-to-Text — transcribe audio using models like Whisper and GPT-4o Transcribe
- Speech-to-Speech — change voices while preserving timing and delivery using ElevenLabs' voice changer
All accessible through a single JavaScript library with no API keys required.
Conclusion
You now know how to create an ElevenLabs account, generate an API key, and make your first text-to-speech API call. For more details, check out ElevenLabs' documentation. If you'd rather skip managing API keys and billing entirely, Puter.js gives you access to text-to-speech from multiple providers through a single JavaScript library with no API keys required.
Related
- How to Get an OpenAI API Key
- How to Get an Anthropic (Claude) API Key
- How to Get a Gemini API Key
- How to Get a Grok (xAI) API Key
- How to Get a DeepSeek API Key
- How to Get a Mistral API Key
- How to Get a MiniMax API Key
- How to Get a Moonshot AI (Kimi) API Key
- How to Get a Z.AI (GLM) API Key
- How to Get an OpenRouter API Key
- How to Get a Together AI API Key
- How to Get a FLUX (Black Forest Labs) API Key
- How to Get a Stability AI (Stable Diffusion) API Key
- Free, Unlimited ElevenLabs API
- Free, Unlimited Text-to-Speech API
- Free, Unlimited OpenAI API
- Free, Unlimited Claude API
Free, Serverless AI and Cloud
Start creating powerful web applications with Puter.js in seconds!
Get Started Now