productivity
ElevenLabs Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the ElevenLabs KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.elevenlabs.*.
Use lua_read_doc("integrations.elevenlabs") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
ElevenLabs workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.elevenlabs.text_speech({voice_id = "example_voice_id", text = "example_text", model_id = "example_model_id", stability = 1, similarity_boost = 1, style = 1, use_speaker_boost = true}))' --json kosmo integrations:lua --eval 'print(docs.read("elevenlabs"))' --json
kosmo integrations:lua --eval 'print(docs.read("elevenlabs.text_speech"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local elevenlabs = app.integrations.elevenlabs
local result = elevenlabs.text_speech({voice_id = "example_voice_id", text = "example_text", model_id = "example_model_id", stability = 1, similarity_boost = 1, style = 1, use_speaker_boost = true})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.elevenlabs, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.elevenlabs.default.* or app.integrations.elevenlabs.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need ElevenLabs, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
ElevenLabs Lua API Reference
Namespace: app.integrations.elevenlabs
ElevenLabs tools use the v1 API at https://api.elevenlabs.io/v1 with xi-api-key authentication. Binary audio responses are returned as base64 plus content metadata so agents can save or pass them to downstream tools.
Speech Generation
local audio = app.integrations.elevenlabs.text_to_speech({
voice_id = "21m00Tcm4TlvDq8ikWAM",
text = "Hello from ElevenLabs.",
model_id = "eleven_multilingual_v2",
stability = 0.5,
similarity_boost = 0.75
})
local timed = app.integrations.elevenlabs.text_to_speech_with_timestamps({
voice_id = "21m00Tcm4TlvDq8ikWAM",
text = "This line needs captions.",
body = {
model_id = "eleven_multilingual_v2",
seed = 1234
},
query = {
output_format = "mp3_44100_128"
}
})
text_to_speech_with_timestamps returns audio_base64, alignment, and normalized_alignment.
Speech To Speech And Speech To Text
local changed = app.integrations.elevenlabs.speech_to_speech({
voice_id = "21m00Tcm4TlvDq8ikWAM",
audio_path = "/tmp/source.wav",
fields = {
model_id = "eleven_multilingual_sts_v2",
remove_background_noise = true
}
})
local transcript = app.integrations.elevenlabs.speech_to_text({
audio_path = "/tmp/interview.mp3",
fields = {
model_id = "scribe_v1",
diarize = true,
keyterms = { "OpenCompany", "KosmoKrator" }
}
})
Multipart tools require local file paths available to the host.
Sound Effects And Isolation
local sfx = app.integrations.elevenlabs.create_sound_effect({
text = "Spacious cinematic impact",
duration_seconds = 2.5,
prompt_influence = 0.4
})
local clean = app.integrations.elevenlabs.isolate_audio({
audio_path = "/tmp/noisy.wav",
fields = {
file_format = "other"
}
})
local isolation_history = app.integrations.elevenlabs.list_audio_isolation_history({
page_size = 50,
search = "interview"
})
Voices And Models
local voices = app.integrations.elevenlabs.list_voices({})
local voice = app.integrations.elevenlabs.get_voice({ voice_id = "21m00Tcm4TlvDq8ikWAM" })
local settings = app.integrations.elevenlabs.get_voice_settings({ voice_id = "21m00Tcm4TlvDq8ikWAM" })
local updated = app.integrations.elevenlabs.edit_voice_settings({
voice_id = "21m00Tcm4TlvDq8ikWAM",
settings = {
stability = 0.55,
similarity_boost = 0.8,
use_speaker_boost = true
}
})
local models = app.integrations.elevenlabs.get_models({})
create_voice accepts local sample file paths in files. delete_voice permanently removes a voice.
History
local history = app.integrations.elevenlabs.get_history({ page_size = 20 })
local item = app.integrations.elevenlabs.get_history_item({ history_item_id = "hist_123" })
local audio = app.integrations.elevenlabs.get_history_item_audio({ history_item_id = "hist_123" })
delete_history_item({ history_item_id = "..." }) deletes one history item.
Dubbing
local dub = app.integrations.elevenlabs.create_dubbing({
fields = {
source_url = "https://example.test/source.mp4",
target_lang = "es",
source_lang = "en",
name = "Spanish trailer dub"
}
})
local projects = app.integrations.elevenlabs.list_dubbings({})
local project = app.integrations.elevenlabs.get_dubbing({ dubbing_id = dub.dubbing_id })
local transcript = app.integrations.elevenlabs.get_dubbing_transcript({
dubbing_id = dub.dubbing_id,
language_code = "es",
format_type = "json"
})
create_dubbing can also accept files with local paths for file, csv_file, foreground_audio_file, or background_audio_file.
Account And Generic API
local user = app.integrations.elevenlabs.get_current_user({})
local subscription = app.integrations.elevenlabs.get_subscription({})
local raw = app.integrations.elevenlabs.api_get({
path = "/voices",
params = { show_legacy = true }
})
Generic helpers are api_get, api_post, and api_delete. Absolute URLs are rejected; pass paths relative to /v1.
Multi-Account Usage
app.integrations.elevenlabs.text_to_speech({ voice_id = "...", text = "Hi" })
app.integrations.elevenlabs.default.text_to_speech({ voice_id = "...", text = "Hi" })
app.integrations.elevenlabs.production.text_to_speech({ voice_id = "...", text = "Hi" })Raw agent markdown
# ElevenLabs Lua API Reference
Namespace: `app.integrations.elevenlabs`
ElevenLabs tools use the v1 API at `https://api.elevenlabs.io/v1` with `xi-api-key` authentication. Binary audio responses are returned as base64 plus content metadata so agents can save or pass them to downstream tools.
## Speech Generation
```lua
local audio = app.integrations.elevenlabs.text_to_speech({
voice_id = "21m00Tcm4TlvDq8ikWAM",
text = "Hello from ElevenLabs.",
model_id = "eleven_multilingual_v2",
stability = 0.5,
similarity_boost = 0.75
})
local timed = app.integrations.elevenlabs.text_to_speech_with_timestamps({
voice_id = "21m00Tcm4TlvDq8ikWAM",
text = "This line needs captions.",
body = {
model_id = "eleven_multilingual_v2",
seed = 1234
},
query = {
output_format = "mp3_44100_128"
}
})
```
`text_to_speech_with_timestamps` returns `audio_base64`, `alignment`, and `normalized_alignment`.
## Speech To Speech And Speech To Text
```lua
local changed = app.integrations.elevenlabs.speech_to_speech({
voice_id = "21m00Tcm4TlvDq8ikWAM",
audio_path = "/tmp/source.wav",
fields = {
model_id = "eleven_multilingual_sts_v2",
remove_background_noise = true
}
})
local transcript = app.integrations.elevenlabs.speech_to_text({
audio_path = "/tmp/interview.mp3",
fields = {
model_id = "scribe_v1",
diarize = true,
keyterms = { "OpenCompany", "KosmoKrator" }
}
})
```
Multipart tools require local file paths available to the host.
## Sound Effects And Isolation
```lua
local sfx = app.integrations.elevenlabs.create_sound_effect({
text = "Spacious cinematic impact",
duration_seconds = 2.5,
prompt_influence = 0.4
})
local clean = app.integrations.elevenlabs.isolate_audio({
audio_path = "/tmp/noisy.wav",
fields = {
file_format = "other"
}
})
local isolation_history = app.integrations.elevenlabs.list_audio_isolation_history({
page_size = 50,
search = "interview"
})
```
## Voices And Models
```lua
local voices = app.integrations.elevenlabs.list_voices({})
local voice = app.integrations.elevenlabs.get_voice({ voice_id = "21m00Tcm4TlvDq8ikWAM" })
local settings = app.integrations.elevenlabs.get_voice_settings({ voice_id = "21m00Tcm4TlvDq8ikWAM" })
local updated = app.integrations.elevenlabs.edit_voice_settings({
voice_id = "21m00Tcm4TlvDq8ikWAM",
settings = {
stability = 0.55,
similarity_boost = 0.8,
use_speaker_boost = true
}
})
local models = app.integrations.elevenlabs.get_models({})
```
`create_voice` accepts local sample file paths in `files`. `delete_voice` permanently removes a voice.
## History
```lua
local history = app.integrations.elevenlabs.get_history({ page_size = 20 })
local item = app.integrations.elevenlabs.get_history_item({ history_item_id = "hist_123" })
local audio = app.integrations.elevenlabs.get_history_item_audio({ history_item_id = "hist_123" })
```
`delete_history_item({ history_item_id = "..." })` deletes one history item.
## Dubbing
```lua
local dub = app.integrations.elevenlabs.create_dubbing({
fields = {
source_url = "https://example.test/source.mp4",
target_lang = "es",
source_lang = "en",
name = "Spanish trailer dub"
}
})
local projects = app.integrations.elevenlabs.list_dubbings({})
local project = app.integrations.elevenlabs.get_dubbing({ dubbing_id = dub.dubbing_id })
local transcript = app.integrations.elevenlabs.get_dubbing_transcript({
dubbing_id = dub.dubbing_id,
language_code = "es",
format_type = "json"
})
```
`create_dubbing` can also accept `files` with local paths for `file`, `csv_file`, `foreground_audio_file`, or `background_audio_file`.
## Account And Generic API
```lua
local user = app.integrations.elevenlabs.get_current_user({})
local subscription = app.integrations.elevenlabs.get_subscription({})
local raw = app.integrations.elevenlabs.api_get({
path = "/voices",
params = { show_legacy = true }
})
```
Generic helpers are `api_get`, `api_post`, and `api_delete`. Absolute URLs are rejected; pass paths relative to `/v1`.
## Multi-Account Usage
```lua
app.integrations.elevenlabs.text_to_speech({ voice_id = "...", text = "Hi" })
app.integrations.elevenlabs.default.text_to_speech({ voice_id = "...", text = "Hi" })
app.integrations.elevenlabs.production.text_to_speech({ voice_id = "...", text = "Hi" })
``` local result = app.integrations.elevenlabs.text_speech({voice_id = "example_voice_id", text = "example_text", model_id = "example_model_id", stability = 1, similarity_boost = 1, style = 1, use_speaker_boost = true})
print(result) Functions
text_speech Write
Convert text to speech audio using an ElevenLabs voice. Returns base64-encoded audio. Choose a voice ID and model ID to control the output.
- Lua path
app.integrations.elevenlabs.text_speech- Full name
elevenlabs.elevenlabs_text_to_speech
| Parameter | Type | Required | Description |
|---|---|---|---|
voice_id | string | yes | The voice identifier (use list_voices to discover available voices). |
text | string | yes | The text to convert to speech. |
model_id | string | no | Model ID to use (e.g., "eleven_multilingual_v2", "eleven_monolingual_v1", "eleven_turbo_v2_5"). Defaults to "eleven_multilingual_v2". |
stability | number | no | Voice stability (0.0–1.0). Higher values reduce randomness. |
similarity_boost | number | no | Voice similarity boost (0.0–1.0). Higher values enforce voice similarity. |
style | number | no | Style exaggeration (0.0–1.0). Higher values increase expressiveness. |
use_speaker_boost | boolean | no | Enable speaker boost for enhanced clarity. |
text_speech_with_timestamps Write
Convert text to speech with character timing.
- Lua path
app.integrations.elevenlabs.text_speech_with_timestamps- Full name
elevenlabs.elevenlabs_text_to_speech_with_timestamps
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
speech_speech Write
Transform an audio file into another voice.
- Lua path
app.integrations.elevenlabs.speech_speech- Full name
elevenlabs.elevenlabs_speech_to_speech
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
speech_text Read
Transcribe audio or video.
- Lua path
app.integrations.elevenlabs.speech_text- Full name
elevenlabs.elevenlabs_speech_to_text
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_sound_effect Write
Generate a sound effect from text.
- Lua path
app.integrations.elevenlabs.create_sound_effect- Full name
elevenlabs.elevenlabs_create_sound_effect
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
isolate_audio Write
Remove background noise from audio.
- Lua path
app.integrations.elevenlabs.isolate_audio- Full name
elevenlabs.elevenlabs_isolate_audio
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_audio_isolation_history Read
List audio isolation generations.
- Lua path
app.integrations.elevenlabs.list_audio_isolation_history- Full name
elevenlabs.elevenlabs_list_audio_isolation_history
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_voices Read
List all available voices in your ElevenLabs account, including pre-made and cloned voices. Use this to discover voice IDs for text-to-speech.
- Lua path
app.integrations.elevenlabs.list_voices- Full name
elevenlabs.elevenlabs_list_voices
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_voice Read
Get detailed information about a specific ElevenLabs voice, including its settings, labels, and fine-tuning info.
- Lua path
app.integrations.elevenlabs.get_voice- Full name
elevenlabs.elevenlabs_get_voice
| Parameter | Type | Required | Description |
|---|---|---|---|
voice_id | string | yes | The voice identifier to look up. |
get_voice_settings Read
Get voice settings.
- Lua path
app.integrations.elevenlabs.get_voice_settings- Full name
elevenlabs.elevenlabs_get_voice_settings
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
edit_voice_settings Write
Edit voice settings.
- Lua path
app.integrations.elevenlabs.edit_voice_settings- Full name
elevenlabs.elevenlabs_edit_voice_settings
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_voice Write
Create a new voice clone in ElevenLabs. Provide a name, optional audio sample file paths or base64-encoded data, and an optional description.
- Lua path
app.integrations.elevenlabs.create_voice- Full name
elevenlabs.elevenlabs_create_voice
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Name for the new voice. |
files | array | no | Array of audio sample file paths or base64-encoded audio strings for voice cloning. |
description | string | no | Optional description of the voice (e.g., "Warm female narrator"). |
delete_voice Write
Permanently delete a voice from your ElevenLabs account. This action cannot be undone.
- Lua path
app.integrations.elevenlabs.delete_voice- Full name
elevenlabs.elevenlabs_delete_voice
| Parameter | Type | Required | Description |
|---|---|---|---|
voice_id | string | yes | The voice identifier to delete. |
get_models Read
List all available ElevenLabs text-to-speech models, including their IDs, names, and language support. Use model IDs when calling text_to_speech.
- Lua path
app.integrations.elevenlabs.get_models- Full name
elevenlabs.elevenlabs_get_models
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_history Read
Browse your ElevenLabs generation history. Returns a paginated list of past text-to-speech requests with metadata.
- Lua path
app.integrations.elevenlabs.get_history- Full name
elevenlabs.elevenlabs_get_history
| Parameter | Type | Required | Description |
|---|---|---|---|
page_size | integer | no | Number of history items per page (default: 20, max: 100). |
start_after | integer | no | History item ID to start after (for cursor-based pagination). |
get_history_item Read
Get one history item.
- Lua path
app.integrations.elevenlabs.get_history_item- Full name
elevenlabs.elevenlabs_get_history_item
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_history_item_audio Read
Download history item audio.
- Lua path
app.integrations.elevenlabs.get_history_item_audio- Full name
elevenlabs.elevenlabs_get_history_item_audio
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_history_item Write
Delete one history item.
- Lua path
app.integrations.elevenlabs.delete_history_item- Full name
elevenlabs.elevenlabs_delete_history_item
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_dubbing Write
Create a dubbing project.
- Lua path
app.integrations.elevenlabs.create_dubbing- Full name
elevenlabs.elevenlabs_create_dubbing
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_dubbings Read
List dubbing projects.
- Lua path
app.integrations.elevenlabs.list_dubbings- Full name
elevenlabs.elevenlabs_list_dubbings
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_dubbing Read
Get one dubbing project.
- Lua path
app.integrations.elevenlabs.get_dubbing- Full name
elevenlabs.elevenlabs_get_dubbing
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_dubbing Write
Delete a dubbing project.
- Lua path
app.integrations.elevenlabs.delete_dubbing- Full name
elevenlabs.elevenlabs_delete_dubbing
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_dubbing_transcript Read
Get a dubbing transcript.
- Lua path
app.integrations.elevenlabs.get_dubbing_transcript- Full name
elevenlabs.elevenlabs_get_dubbing_transcript
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user Read
Get your ElevenLabs account details, including subscription tier, character usage, and remaining quota.
- Lua path
app.integrations.elevenlabs.get_current_user- Full name
elevenlabs.elevenlabs_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_subscription Read
Get subscription and quota details.
- Lua path
app.integrations.elevenlabs.get_subscription- Full name
elevenlabs.elevenlabs_get_subscription
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_get Read
Call an ElevenLabs GET endpoint.
- Lua path
app.integrations.elevenlabs.api_get- Full name
elevenlabs.elevenlabs_api_get
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_post Write
Call an ElevenLabs POST endpoint.
- Lua path
app.integrations.elevenlabs.api_post- Full name
elevenlabs.elevenlabs_api_post
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_delete Write
Call an ElevenLabs DELETE endpoint.
- Lua path
app.integrations.elevenlabs.api_delete- Full name
elevenlabs.elevenlabs_api_delete
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||