KosmoKrator

ai

ElevenLabs Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the ElevenLabs KosmoKrator integration.

6 functions 4 read 2 write API key auth

Lua Namespace

Agents call this integration through app.integrations.eleven_labs.*. Use lua_read_doc("integrations.eleven-labs") inside KosmoKrator to discover the same reference at runtime.

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

list_voices

List available ElevenLabs voices.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of voices per page (default: 20)
pageintegernoPage number, 1-based (default: 1)

Example

local result = app.integrations["eleven-labs"].list_voices({
  limit = 10,
  page = 1
})

for _, voice in ipairs(result.voices) do
  print(voice.name .. " (" .. voice.voice_id .. ")")
end

get_voice

Get detailed information about a specific voice.

Parameters

NameTypeRequiredDescription
voice_idstringyesThe unique voice identifier

Example

local voice = app.integrations["eleven-labs"].get_voice({
  voice_id = "21m00Tcm4TlvDq8ikWAM"
})

print(voice.name)
print(voice.labels.accent)
print(voice.labels.gender)

generate_speech

Generate speech audio from text using an ElevenLabs voice.

Parameters

NameTypeRequiredDescription
textstringyesThe text to convert to speech
voice_idstringyesThe voice identifier
model_idstringnoModel ID (default: "eleven_multilingual_v2")
stabilitynumbernoVoice stability 0.0–1.0 (higher = more consistent)
similarity_boostnumbernoSimilarity boost 0.0–1.0 (higher = closer to original voice)

Example

local result = app.integrations["eleven-labs"].generate_speech({
  text = "Hello! Welcome to our platform.",
  voice_id = "21m00Tcm4TlvDq8ikWAM",
  model_id = "eleven_multilingual_v2",
  stability = 0.5,
  similarity_boost = 0.75
})

-- result.audio contains base64-encoded audio data
-- result.content_type is the MIME type (e.g., "audio/mpeg")

generate_sound

Generate a sound effect from a text description.

Parameters

NameTypeRequiredDescription
textstringyesDescription of the sound to generate
model_idstringnoModel ID (default: "eleven_sound_generation_v1")

Example

local result = app.integrations["eleven-labs"].generate_sound({
  text = "Thunder rumbling in the distance with light rain"
})

-- result.audio contains base64-encoded audio data
-- result.content_type is the MIME type

list_models

List available ElevenLabs models.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of models per page (default: 20)
pageintegernoPage number, 1-based (default: 1)

Example

local result = app.integrations["eleven-labs"].list_models({
  limit = 50
})

for _, model in ipairs(result) do
  print(model.model_id .. ": " .. model.name)
end

get_current_user

Get the current user’s profile and subscription information.

Parameters

None.

Example

local user = app.integrations["eleven-labs"].get_current_user({})

print("User: " .. user.first_name .. " " .. user.last_name)
print("Tier: " .. user.subscription.tier)
print("Characters used: " .. user.subscription.character_count)
print("Character limit: " .. user.subscription.character_limit)

Multi-Account Usage

If you have multiple ElevenLabs accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations["eleven-labs"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["eleven-labs"].default.function_name({...})

-- Named accounts
app.integrations["eleven-labs"].production.function_name({...})
app.integrations["eleven-labs"].staging.function_name({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# ElevenLabs — Lua API Reference

## list_voices

List available ElevenLabs voices.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of voices per page (default: 20) |
| `page` | integer | no | Page number, 1-based (default: 1) |

### Example

```lua
local result = app.integrations["eleven-labs"].list_voices({
  limit = 10,
  page = 1
})

for _, voice in ipairs(result.voices) do
  print(voice.name .. " (" .. voice.voice_id .. ")")
end
```

---

## get_voice

Get detailed information about a specific voice.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `voice_id` | string | yes | The unique voice identifier |

### Example

```lua
local voice = app.integrations["eleven-labs"].get_voice({
  voice_id = "21m00Tcm4TlvDq8ikWAM"
})

print(voice.name)
print(voice.labels.accent)
print(voice.labels.gender)
```

---

## generate_speech

Generate speech audio from text using an ElevenLabs voice.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | string | yes | The text to convert to speech |
| `voice_id` | string | yes | The voice identifier |
| `model_id` | string | no | Model ID (default: `"eleven_multilingual_v2"`) |
| `stability` | number | no | Voice stability 0.0–1.0 (higher = more consistent) |
| `similarity_boost` | number | no | Similarity boost 0.0–1.0 (higher = closer to original voice) |

### Example

```lua
local result = app.integrations["eleven-labs"].generate_speech({
  text = "Hello! Welcome to our platform.",
  voice_id = "21m00Tcm4TlvDq8ikWAM",
  model_id = "eleven_multilingual_v2",
  stability = 0.5,
  similarity_boost = 0.75
})

-- result.audio contains base64-encoded audio data
-- result.content_type is the MIME type (e.g., "audio/mpeg")
```

---

## generate_sound

Generate a sound effect from a text description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | string | yes | Description of the sound to generate |
| `model_id` | string | no | Model ID (default: `"eleven_sound_generation_v1"`) |

### Example

```lua
local result = app.integrations["eleven-labs"].generate_sound({
  text = "Thunder rumbling in the distance with light rain"
})

-- result.audio contains base64-encoded audio data
-- result.content_type is the MIME type
```

---

## list_models

List available ElevenLabs models.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of models per page (default: 20) |
| `page` | integer | no | Page number, 1-based (default: 1) |

### Example

```lua
local result = app.integrations["eleven-labs"].list_models({
  limit = 50
})

for _, model in ipairs(result) do
  print(model.model_id .. ": " .. model.name)
end
```

---

## get_current_user

Get the current user's profile and subscription information.

### Parameters

None.

### Example

```lua
local user = app.integrations["eleven-labs"].get_current_user({})

print("User: " .. user.first_name .. " " .. user.last_name)
print("Tier: " .. user.subscription.tier)
print("Characters used: " .. user.subscription.character_count)
print("Character limit: " .. user.subscription.character_limit)
```

---

## Multi-Account Usage

If you have multiple ElevenLabs accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations["eleven-labs"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["eleven-labs"].default.function_name({...})

-- Named accounts
app.integrations["eleven-labs"].production.function_name({...})
app.integrations["eleven-labs"].staging.function_name({...})
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.eleven_labs.elevenlabs_list_voices({
  limit = 1,
  page = 1
})
print(result)

Functions

elevenlabs_list_voices

List available ElevenLabs voices. Returns voice names, IDs, labels, and preview URLs. Use this to discover voices for text-to-speech generation.

Operation
Read read
Full name
eleven-labs.elevenlabs_list_voices
ParameterTypeRequiredDescription
limit integer no Maximum number of voices to return per page (default: 20).
page integer no Page number for pagination, 1-based (default: 1).

elevenlabs_get_voice

Get detailed information about a specific ElevenLabs voice by its ID, including name, labels, description, and preview URL.

Operation
Read read
Full name
eleven-labs.elevenlabs_get_voice
ParameterTypeRequiredDescription
voice_id string yes The unique voice identifier.

elevenlabs_generate_speech

Generate speech audio from text using an ElevenLabs voice. Returns base64-encoded audio. Specify a voice ID and model, with optional stability and similarity boost settings.

Operation
Write write
Full name
eleven-labs.elevenlabs_generate_speech
ParameterTypeRequiredDescription
text string yes The text to convert to speech.
voice_id string yes The voice identifier to use for synthesis.
model_id string no The model ID (e.g., "eleven_multilingual_v2"). Defaults to "eleven_multilingual_v2".
stability number no Voice stability (0.0–1.0). Higher values produce more consistent, less expressive output.
similarity_boost number no Similarity boost (0.0–1.0). Higher values make the output closer to the original voice.

elevenlabs_generate_sound

Generate a sound effect from a text description using ElevenLabs. Returns base64-encoded audio. Describe the sound you want (e.g., "thunder rumbling in the distance").

Operation
Write write
Full name
eleven-labs.elevenlabs_generate_sound
ParameterTypeRequiredDescription
text string yes Description of the sound effect to generate.
model_id string no The model ID (e.g., "eleven_sound_generation_v1"). Defaults to "eleven_sound_generation_v1".

elevenlabs_list_models

List available ElevenLabs models. Returns model IDs, names, descriptions, and capabilities. Use this to find the right model for speech or sound generation.

Operation
Read read
Full name
eleven-labs.elevenlabs_list_models
ParameterTypeRequiredDescription
limit integer no Maximum number of models to return per page (default: 20).
page integer no Page number for pagination, 1-based (default: 1).

elevenlabs_get_current_user

Get the current ElevenLabs user profile, subscription tier, and character usage information.

Operation
Read read
Full name
eleven-labs.elevenlabs_get_current_user
ParameterTypeRequiredDescription
No parameters.