initial skills

This commit is contained in:
Tadas Petra
2026-01-24 10:33:50 -06:00
parent 73878b2679
commit 69c6184d90
9 changed files with 941 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 ElevenLabs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+39 -1
View File
@@ -1 +1,39 @@
# skills
# ElevenLabs Skills
Agent skills for [ElevenLabs](https://elevenlabs.io) developer products. These skills follow the [Agent Skills specification](https://agentskills.io/specification) and can be used with any compatible AI coding assistant.
## Installation
```bash
npx skills add elevenlabs/skills
```
## Available Skills
| Skill | Description |
|-------|-------------|
| [text-to-speech](./text-to-speech) | Convert text to lifelike speech using ElevenLabs' AI voices |
| [speech-to-text](./speech-to-text) | Transcribe audio files to text with timestamps |
| [sound-effects](./sound-effects) | Generate sound effects from text descriptions |
## Configuration
All skills require an ElevenLabs API key. Set it as an environment variable:
```bash
export ELEVEN_API_KEY="your-api-key"
```
Get your API key from the [ElevenLabs dashboard](https://elevenlabs.io/app/settings/api-keys).
## SDK Support
Each skill includes examples for:
- **Python** - `elevenlabs` package
- **JavaScript/TypeScript** - `@elevenlabs/elevenlabs-js`
- **cURL** - Direct REST API calls
## License
MIT
+175
View File
@@ -0,0 +1,175 @@
---
name: speech-to-text
description: Transcribe audio files to text using ElevenLabs' speech recognition. Use this skill when converting audio recordings to text, generating subtitles, or processing spoken content.
license: MIT
metadata:
author: elevenlabs
version: "1.0"
---
# ElevenLabs Speech-to-Text
Transcribe audio to text with high accuracy and timestamp support.
## Quick Start
### Python
```python
from elevenlabs import ElevenLabs
client = ElevenLabs()
with open("audio.mp3", "rb") as audio_file:
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v1"
)
print(result.text)
```
### JavaScript
```javascript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createReadStream } from "fs";
const client = new ElevenLabsClient();
const result = await client.speechToText.convert({
file: createReadStream("audio.mp3"),
model_id: "scribe_v1",
});
console.log(result.text);
```
### cURL
```bash
curl -X POST "https://api.elevenlabs.io/v1/speech-to-text" \
-H "xi-api-key: $ELEVEN_API_KEY" \
-F "file=@audio.mp3" \
-F "model_id=scribe_v1"
```
## Models
| Model ID | Description |
|----------|-------------|
| `scribe_v1` | High-accuracy transcription model |
## Transcription with Timestamps
Get word-level timestamps for subtitle generation:
### Python
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v1",
timestamps_granularity="word"
)
# Access word-level timestamps
for word in result.words:
print(f"{word.text}: {word.start}s - {word.end}s")
```
### JavaScript
```javascript
const result = await client.speechToText.convert({
file: createReadStream("audio.mp3"),
model_id: "scribe_v1",
timestamps_granularity: "word",
});
for (const word of result.words) {
console.log(`${word.text}: ${word.start}s - ${word.end}s`);
}
```
## Language Detection
The model automatically detects the spoken language. You can also specify a language hint:
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v1",
language_code="en" # Optional hint
)
print(f"Detected language: {result.language_code}")
print(f"Transcription: {result.text}")
```
## Supported Languages
ElevenLabs supports transcription in 29+ languages including:
- English (en)
- Spanish (es)
- French (fr)
- German (de)
- Italian (it)
- Portuguese (pt)
- Dutch (nl)
- Polish (pl)
- Russian (ru)
- Japanese (ja)
- Korean (ko)
- Chinese (zh)
## Supported Audio Formats
- MP3
- WAV
- M4A
- FLAC
- OGG
- WebM
Maximum file size: 100MB
## Response Format
```json
{
"text": "The full transcription text",
"language_code": "en",
"words": [
{"text": "The", "start": 0.0, "end": 0.1},
{"text": "full", "start": 0.12, "end": 0.3},
...
]
}
```
## Error Handling
```python
from elevenlabs import ElevenLabsError
try:
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v1"
)
except ElevenLabsError as e:
print(f"Transcription failed: {e.message}")
```
Common errors:
- **400**: Unsupported audio format
- **401**: Invalid API key
- **413**: File too large (max 100MB)
- **429**: Rate limit exceeded
## References
- [Installation Guide](references/installation.md)
- [Transcription Options](references/transcription-options.md)
+69
View File
@@ -0,0 +1,69 @@
# Installation
## Python
```bash
pip install elevenlabs
```
Configure your API key:
```python
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
```bash
npm install @elevenlabs/elevenlabs-js
```
Configure your API key:
```javascript
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:
```bash
export ELEVEN_API_KEY="your-api-key"
```
Include in requests:
```bash
curl -X POST "https://api.elevenlabs.io/v1/speech-to-text" \
-H "xi-api-key: $ELEVEN_API_KEY" \
-F "file=@audio.mp3" \
-F "model_id=scribe_v1"
```
## Getting an API Key
1. Sign up at [elevenlabs.io](https://elevenlabs.io)
2. Go to **Settings****API Keys**
3. Click **Create API Key**
4. Copy and store securely
## Environment Variables
| Variable | Description |
|----------|-------------|
| `ELEVEN_API_KEY` | Your ElevenLabs API key (required) |
@@ -0,0 +1,159 @@
# Transcription Options
## Request Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file` | file | Yes | Audio file to transcribe |
| `model_id` | string | Yes | Model to use (`scribe_v1`) |
| `language_code` | string | No | Language hint (ISO 639-1 code) |
| `timestamps_granularity` | string | No | `word` for word-level timestamps |
## Python Example
```python
from elevenlabs import ElevenLabs
client = ElevenLabs()
with open("audio.mp3", "rb") as audio_file:
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v1",
language_code="en", # Optional language hint
timestamps_granularity="word"
)
```
## JavaScript Example
```javascript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createReadStream } from "fs";
const client = new ElevenLabsClient();
const result = await client.speechToText.convert({
file: createReadStream("audio.mp3"),
model_id: "scribe_v1",
language_code: "en",
timestamps_granularity: "word",
});
```
## cURL Example
```bash
curl -X POST "https://api.elevenlabs.io/v1/speech-to-text" \
-H "xi-api-key: $ELEVEN_API_KEY" \
-F "file=@audio.mp3" \
-F "model_id=scribe_v1" \
-F "language_code=en" \
-F "timestamps_granularity=word"
```
## Response Structure
```json
{
"text": "The complete transcribed text from the audio file.",
"language_code": "en",
"language_probability": 0.98,
"words": [
{
"text": "The",
"start": 0.0,
"end": 0.15
},
{
"text": "complete",
"start": 0.16,
"end": 0.45
}
]
}
```
## Response Fields
| Field | Type | Description |
|-------|------|-------------|
| `text` | string | Full transcription text |
| `language_code` | string | Detected language (ISO 639-1) |
| `language_probability` | float | Confidence in language detection (0-1) |
| `words` | array | Word-level timestamps (if requested) |
| `words[].text` | string | The transcribed word |
| `words[].start` | float | Start time in seconds |
| `words[].end` | float | End time in seconds |
## Supported Languages
| Code | Language |
|------|----------|
| `en` | English |
| `es` | Spanish |
| `fr` | French |
| `de` | German |
| `it` | Italian |
| `pt` | Portuguese |
| `nl` | Dutch |
| `pl` | Polish |
| `ru` | Russian |
| `ja` | Japanese |
| `ko` | Korean |
| `zh` | Chinese |
| `ar` | Arabic |
| `hi` | Hindi |
| `tr` | Turkish |
| `sv` | Swedish |
| `da` | Danish |
| `fi` | Finnish |
| `no` | Norwegian |
## Audio Format Requirements
**Supported formats:**
- MP3
- WAV
- M4A
- FLAC
- OGG
- WebM
**Limits:**
- Maximum file size: 100MB
- Recommended: Clear audio with minimal background noise
## Use Cases
### Subtitle Generation
```python
result = client.speech_to_text.convert(
file=audio_file,
model_id="scribe_v1",
timestamps_granularity="word"
)
# Generate SRT format
srt_content = ""
for i, word in enumerate(result.words, 1):
start = format_timestamp(word.start)
end = format_timestamp(word.end)
srt_content += f"{i}\n{start} --> {end}\n{word.text}\n\n"
```
### Meeting Transcription
```python
# Transcribe meeting recording
with open("meeting.mp3", "rb") as f:
result = client.speech_to_text.convert(
file=f,
model_id="scribe_v1"
)
# Save transcript
with open("meeting_transcript.txt", "w") as f:
f.write(result.text)
```
+171
View File
@@ -0,0 +1,171 @@
---
name: text-to-speech
description: Convert text to lifelike speech using ElevenLabs' AI voice synthesis. Use this skill when generating audio from text, creating voiceovers, or building voice-enabled applications.
license: MIT
metadata:
author: elevenlabs
version: "1.0"
---
# ElevenLabs Text-to-Speech
Generate natural-sounding speech from text using ElevenLabs' voice AI.
## Quick Start
### Python
```python
from elevenlabs import ElevenLabs
client = ElevenLabs()
audio = client.text_to_speech.convert(
text="Hello, welcome to ElevenLabs!",
voice_id="JBFqnCBsd6RMkjVDRZzb", # George
model_id="eleven_multilingual_v2"
)
with open("output.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
```
### JavaScript
```javascript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";
const client = new ElevenLabsClient();
const audio = await client.textToSpeech.convert("JBFqnCBsd6RMkjVDRZzb", {
text: "Hello, welcome to ElevenLabs!",
model_id: "eleven_multilingual_v2",
});
const writeStream = createWriteStream("output.mp3");
audio.pipe(writeStream);
```
### cURL
```bash
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/JBFqnCBsd6RMkjVDRZzb" \
-H "xi-api-key: $ELEVEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, welcome to ElevenLabs!",
"model_id": "eleven_multilingual_v2"
}' \
--output output.mp3
```
## Voice IDs
Use pre-made voices or create custom voices in the ElevenLabs dashboard.
**Popular pre-made voices:**
- `JBFqnCBsd6RMkjVDRZzb` - George (male, narrative)
- `EXAVITQu4vr4xnSDxMaL` - Sarah (female, soft)
- `onwK4e9ZLuTAKqWW03F9` - Daniel (male, authoritative)
- `XB0fDUnXU5powFXDhCwa` - Charlotte (female, conversational)
List all available voices:
```python
voices = client.voices.get_all()
for voice in voices.voices:
print(f"{voice.voice_id}: {voice.name}")
```
## Models
| Model ID | Description | Best For |
|----------|-------------|----------|
| `eleven_multilingual_v2` | Latest multilingual model | Most use cases, 29 languages |
| `eleven_turbo_v2_5` | Low-latency model | Real-time applications |
| `eleven_monolingual_v1` | English-only model | English content |
## Voice Settings
Control voice characteristics:
```python
from elevenlabs import VoiceSettings
audio = client.text_to_speech.convert(
text="Customize my voice settings.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
voice_settings=VoiceSettings(
stability=0.5, # 0-1: Lower = more expressive
similarity_boost=0.75, # 0-1: Higher = closer to original voice
style=0.5, # 0-1: Style exaggeration (v2 models)
use_speaker_boost=True
)
)
```
## Output Formats
Specify format with `output_format` parameter:
| Format | Description |
|--------|-------------|
| `mp3_44100_128` | MP3 at 44.1kHz, 128kbps (default) |
| `mp3_22050_32` | MP3 at 22.05kHz, 32kbps |
| `pcm_16000` | PCM at 16kHz |
| `pcm_22050` | PCM at 22.05kHz |
| `pcm_24000` | PCM at 24kHz |
| `ulaw_8000` | μ-law at 8kHz (telephony) |
```python
audio = client.text_to_speech.convert(
text="High quality audio output.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
output_format="mp3_44100_128"
)
```
## Streaming
For real-time applications, stream audio as it's generated:
```python
audio_stream = client.text_to_speech.convert(
text="This text will be streamed as audio.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_turbo_v2_5" # Low latency model
)
for chunk in audio_stream:
# Process each chunk as it arrives
play_audio(chunk)
```
See [references/streaming.md](references/streaming.md) for detailed streaming examples.
## Error Handling
```python
from elevenlabs import ElevenLabsError
try:
audio = client.text_to_speech.convert(
text="Generate speech",
voice_id="invalid-voice-id"
)
except ElevenLabsError as e:
print(f"API error: {e.message}")
```
Common errors:
- **401**: Invalid API key
- **422**: Invalid parameters (check voice_id, model_id)
- **429**: Rate limit exceeded
## References
- [Installation Guide](references/installation.md)
- [Streaming Audio](references/streaming.md)
- [Voice Settings](references/voice-settings.md)
+69
View File
@@ -0,0 +1,69 @@
# Installation
## Python
```bash
pip install elevenlabs
```
Configure your API key:
```python
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
```bash
npm install @elevenlabs/elevenlabs-js
```
Configure your API key:
```javascript
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:
```bash
export ELEVEN_API_KEY="your-api-key"
```
Include in requests:
```bash
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
1. Sign up at [elevenlabs.io](https://elevenlabs.io)
2. Go to **Settings****API Keys**
3. Click **Create API Key**
4. Copy and store securely
## Environment Variables
| Variable | Description |
|----------|-------------|
| `ELEVEN_API_KEY` | Your ElevenLabs API key (required) |
+126
View File
@@ -0,0 +1,126 @@
# Streaming Audio
Stream audio chunks as they're generated for lower latency.
## Python Streaming
```python
from elevenlabs import ElevenLabs
client = ElevenLabs()
# Generate streaming audio
audio_stream = client.text_to_speech.convert(
text="This is a streaming example with lower latency.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_turbo_v2_5"
)
# Write chunks to file
with open("output.mp3", "wb") as f:
for chunk in audio_stream:
f.write(chunk)
```
### Play Audio in Real-Time
```python
import subprocess
def play_stream(audio_stream):
# Using ffplay (requires ffmpeg installed)
process = subprocess.Popen(
["ffplay", "-nodisp", "-autoexit", "-"],
stdin=subprocess.PIPE
)
for chunk in audio_stream:
process.stdin.write(chunk)
process.stdin.close()
process.wait()
audio_stream = client.text_to_speech.convert(
text="Playing this audio in real-time.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_turbo_v2_5"
)
play_stream(audio_stream)
```
## JavaScript Streaming
```javascript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";
const client = new ElevenLabsClient();
const audioStream = await client.textToSpeech.convert("JBFqnCBsd6RMkjVDRZzb", {
text: "Streaming audio in JavaScript.",
model_id: "eleven_turbo_v2_5",
});
// Write to file
const writeStream = createWriteStream("output.mp3");
audioStream.pipe(writeStream);
// Or process chunks
for await (const chunk of audioStream) {
// Process each chunk
console.log(`Received ${chunk.length} bytes`);
}
```
## WebSocket Streaming
For the lowest latency, use WebSocket streaming:
### Python WebSocket
```python
import asyncio
import websockets
import json
async def stream_tts():
uri = "wss://api.elevenlabs.io/v1/text-to-speech/JBFqnCBsd6RMkjVDRZzb/stream-input"
async with websockets.connect(
uri,
extra_headers={"xi-api-key": os.environ["ELEVEN_API_KEY"]}
) as ws:
# Initialize stream
await ws.send(json.dumps({
"text": " ",
"voice_settings": {"stability": 0.5, "similarity_boost": 0.75},
"model_id": "eleven_turbo_v2_5"
}))
# Send text chunks
await ws.send(json.dumps({"text": "Hello, "}))
await ws.send(json.dumps({"text": "this is streaming. "}))
# End stream
await ws.send(json.dumps({"text": ""}))
# Receive audio chunks
async for message in ws:
data = json.loads(message)
if data.get("audio"):
audio_chunk = base64.b64decode(data["audio"])
# Process audio chunk
asyncio.run(stream_tts())
```
## Best Practices
1. **Use turbo models** for real-time applications:
- `eleven_turbo_v2_5` provides lowest latency
2. **Buffer audio** before playback to prevent choppy output
3. **Handle disconnections** gracefully in WebSocket streams
4. **Choose appropriate output format**:
- `pcm_24000` for lowest latency processing
- `mp3_44100_128` for direct playback
+112
View File
@@ -0,0 +1,112 @@
# Voice Settings
Fine-tune voice characteristics for your use case.
## Parameters
| Parameter | Range | Default | Description |
|-----------|-------|---------|-------------|
| `stability` | 0.0 - 1.0 | 0.5 | Higher = more consistent, Lower = more expressive/variable |
| `similarity_boost` | 0.0 - 1.0 | 0.75 | Higher = closer to original voice, may amplify artifacts |
| `style` | 0.0 - 1.0 | 0.0 | Style exaggeration (multilingual v2 models only) |
| `use_speaker_boost` | boolean | true | Enhances voice clarity and similarity |
## Python Example
```python
from elevenlabs import ElevenLabs, VoiceSettings
client = ElevenLabs()
audio = client.text_to_speech.convert(
text="Testing different voice settings.",
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_multilingual_v2",
voice_settings=VoiceSettings(
stability=0.5,
similarity_boost=0.75,
style=0.0,
use_speaker_boost=True
)
)
```
## JavaScript Example
```javascript
const audio = await client.textToSpeech.convert("JBFqnCBsd6RMkjVDRZzb", {
text: "Testing different voice settings.",
model_id: "eleven_multilingual_v2",
voice_settings: {
stability: 0.5,
similarity_boost: 0.75,
style: 0.0,
use_speaker_boost: true,
},
});
```
## cURL Example
```bash
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/JBFqnCBsd6RMkjVDRZzb" \
-H "xi-api-key: $ELEVEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Testing different voice settings.",
"model_id": "eleven_multilingual_v2",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0.0,
"use_speaker_boost": true
}
}' \
--output output.mp3
```
## Use Case Recommendations
### Audiobooks / Narration
```python
voice_settings=VoiceSettings(
stability=0.7, # Consistent tone
similarity_boost=0.5, # Natural variation
style=0.0
)
```
### Conversational / Chatbots
```python
voice_settings=VoiceSettings(
stability=0.4, # More expressive
similarity_boost=0.75,
style=0.3 # Slight style emphasis
)
```
### News / Professional
```python
voice_settings=VoiceSettings(
stability=0.8, # Very consistent
similarity_boost=0.6,
style=0.0
)
```
### Character Voices / Drama
```python
voice_settings=VoiceSettings(
stability=0.3, # Highly expressive
similarity_boost=0.8,
style=0.5 # Strong style
)
```
## Tips
- **Start with defaults** and adjust incrementally
- **Lower stability** if voice sounds monotonous
- **Reduce similarity_boost** if you hear audio artifacts
- **Style only works** with multilingual v2 models
- **Test with representative text** from your actual use case