mirror of
https://github.com/elevenlabs/skills.git
synced 2026-09-14 20:46:33 +08:00
1.4 KiB
1.4 KiB
Installation
Python
pip install elevenlabs
Configure your API key:
from elevenlabs import ElevenLabs
# Option 1: Pass directly
client = ElevenLabs(api_key="your-api-key")
# Option 2: Environment variable (recommended)
# Set ELEVEN_API_KEY in your environment
client = ElevenLabs() # Automatically reads ELEVEN_API_KEY
JavaScript / TypeScript
npm install @elevenlabs/elevenlabs-js
Configure your API key:
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
// Option 1: Pass directly
const client = new ElevenLabsClient({ apiKey: "your-api-key" });
// Option 2: Environment variable (recommended)
// Set ELEVEN_API_KEY in your environment
const client = new ElevenLabsClient();
cURL / REST API
Set your API key as an environment variable:
export ELEVEN_API_KEY="your-api-key"
Include in requests:
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}" \
-H "xi-api-key: $ELEVEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hello world", "model_id": "eleven_multilingual_v2"}'
Getting an API Key
- Sign up at elevenlabs.io
- Go to Settings → API Keys
- Click Create API Key
- Copy and store securely
Environment Variables
| Variable | Description |
|---|---|
ELEVEN_API_KEY |
Your ElevenLabs API key (required) |