Setting the file. One moment.
Subchapter 8.1
references/installation.mdMarkdown3 KBView on GitHub
The ElevenLabs CLI is the fastest way to call the API from the terminal or scripts.
# npm (any platform with Node.js)
# macOS / Linux (Homebrew)
brew install elevenlabs/tap/elevenlabs# Windows (Scoop)
scoop bucket add elevenlabs https://github.com/elevenlabs/scoop-bucket
scoop install elevenlabs# Shell installer (any platform)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/elevenlabs/cli/releases/latest/download/elevenlabs-cli-installer.sh | shAuthenticate with either:
# Option 1: Environment variable (picked up automatically)
export ELEVENLABS_API_KEY="your-api-key"
# Option 2: OAuth login (stores credentials in the OS keyring)
elevenlabs auth loginnpm install @elevenlabs/elevenlabs-jsImportant: Always use
@elevenlabs/elevenlabs-js. The oldelevenlabsnpm package (v1.x) is deprecated and should not be used.
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
// Option 1: Environment variable (recommended)
// Set ELEVENLABS_API_KEY in your environment
const client = new ElevenLabsClient();
// Option 2: Pass directly
const client = new ElevenLabsClient({ apiKey: "your-api-key" });If you have old packages installed, remove them:
# Remove deprecated packages
npm uninstall elevenlabs
# Install the current packages
npm install @elevenlabs/elevenlabs-jsImport changes:
// OLD (deprecated)
import { ElevenLabsClient } from "elevenlabs";
// NEW (current)
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";pip install elevenlabsfrom elevenlabs import ElevenLabs
# Option 1: Environment variable (recommended)
# Set ELEVENLABS_API_KEY in your environment
client = ElevenLabs()
# Option 2: Pass directly
client = ElevenLabs(api_key="your-api-key")Once installed and authenticated, no headers or keys are needed on the command line:
elevenlabs text-to-speech convert --voice-id JBFqnCBsd6RMkjVDRZzb \
--text "Hello world" --model-id eleven_multilingual_v2 --output output.mp3Or use the setup-api-key skill for guided setup.
| Variable | Description |
|---|---|
ELEVENLABS_API_KEY | Your ElevenLabs API key (required) |