KosmoKrator

ai

AssemblyAI Lua API for KosmoKrator Agents

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

6 functions 4 read 2 write API key auth

Lua Namespace

Agents call this integration through app.integrations.assemblyai.*. Use lua_read_doc("integrations.assemblyai") 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.

AssemblyAI — Lua API Reference

transcribe

Submit an audio or video file URL for AI transcription.

Parameters

NameTypeRequiredDescription
audio_urlstringyesURL of the audio/video file to transcribe, or an AssemblyAI upload URL
language_codestringnoLanguage code (e.g., "en_us", "es", "fr"). Auto-detected if omitted
speaker_labelsbooleannoEnable speaker diarization to identify who spoke when
auto_chaptersbooleannoAutomatically break the transcript into chapters
entity_detectionbooleannoDetect entities (dates, locations, organizations)
sentiment_analysisbooleannoAnalyze sentiment (positive, negative, neutral) per sentence
summarizationbooleannoGenerate a summary of the transcript
punctuatebooleannoAdd punctuation to the transcript
format_textbooleannoFormat text with capitalization and paragraphs
webhook_urlstringnoURL to receive a POST when the transcript completes
custom_topicsarraynoList of custom topics to detect
topicsarraynoEnable topic detection with built-in topics

Example

local result = app.integrations.assemblyai.transcribe({
  audio_url = "https://example.com/recording.mp3",
  speaker_labels = true,
  sentiment_analysis = true
})

print("Transcript ID: " .. result.id)
print("Status: " .. result.status)
-- Use assemblyai_get_transcript with the ID to retrieve results

get_transcript

Retrieve a transcript by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe transcript ID returned by the transcribe tool

Example

local result = app.integrations.assemblyai.get_transcript({
  id = "abc123def456"
})

if result.status == "completed" then
  print("Text: " .. result.text)
  print("Confidence: " .. result.confidence)
elseif result.status == "processing" then
  print("Still processing. Try again in a few seconds.")
end

list_transcripts

List transcripts with optional filtering and pagination.

Parameters

NameTypeRequiredDescription
limitintegernoMax results per page (default: 20, max: 200)
statusstringnoFilter by status: "queued", "processing", "completed", "error"
created_onstringnoFilter by creation date (e.g., "gte:2025-01-01")
before_idstringnoPagination: return transcripts before this ID
after_idstringnoPagination: return transcripts after this ID
throttled_onlybooleannoOnly return throttled transcripts

Example

local result = app.integrations.assemblyai.list_transcripts({
  limit = 10,
  status = "completed"
})

for _, transcript in ipairs(result.page_details.transcripts_ids) do
  print("ID: " .. transcript)
end

upload

Upload a local audio or video file. Returns a URL for use with the transcribe tool.

Parameters

NameTypeRequiredDescription
file_pathstringyesAbsolute path to the local file to upload

Example

local result = app.integrations.assemblyai.upload({
  file_path = "/tmp/recording.mp3"
})

-- Use the upload_url with the transcribe tool
local transcript = app.integrations.assemblyai.transcribe({
  audio_url = result.upload_url
})
print("Transcript ID: " .. transcript.id)

get_lemons

Retrieve billing credits and usage information.

Parameters

None.

Example

local result = app.integrations.assemblyai.get_lemons({})

print("Credits remaining: " .. tostring(result.lemons_remaining))

get_current_user

Get the authenticated user’s profile and plan info.

Parameters

None.

Example

local result = app.integrations.assemblyai.get_current_user({})

print("Email: " .. result.email)
print("Plan: " .. (result.plan and result.plan.name or "unknown"))

Multi-Account Usage

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

-- Default account (always works)
app.integrations.assemblyai.function_name({...})

-- Explicit default (portable across setups)
app.integrations.assemblyai.default.function_name({...})

-- Named accounts
app.integrations.assemblyai.work.function_name({...})
app.integrations.assemblyai.personal.function_name({...})

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

Raw agent markdown
# AssemblyAI — Lua API Reference

## transcribe

Submit an audio or video file URL for AI transcription.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `audio_url` | string | yes | URL of the audio/video file to transcribe, or an AssemblyAI upload URL |
| `language_code` | string | no | Language code (e.g., `"en_us"`, `"es"`, `"fr"`). Auto-detected if omitted |
| `speaker_labels` | boolean | no | Enable speaker diarization to identify who spoke when |
| `auto_chapters` | boolean | no | Automatically break the transcript into chapters |
| `entity_detection` | boolean | no | Detect entities (dates, locations, organizations) |
| `sentiment_analysis` | boolean | no | Analyze sentiment (positive, negative, neutral) per sentence |
| `summarization` | boolean | no | Generate a summary of the transcript |
| `punctuate` | boolean | no | Add punctuation to the transcript |
| `format_text` | boolean | no | Format text with capitalization and paragraphs |
| `webhook_url` | string | no | URL to receive a POST when the transcript completes |
| `custom_topics` | array | no | List of custom topics to detect |
| `topics` | array | no | Enable topic detection with built-in topics |

### Example

```lua
local result = app.integrations.assemblyai.transcribe({
  audio_url = "https://example.com/recording.mp3",
  speaker_labels = true,
  sentiment_analysis = true
})

print("Transcript ID: " .. result.id)
print("Status: " .. result.status)
-- Use assemblyai_get_transcript with the ID to retrieve results
```

---

## get_transcript

Retrieve a transcript by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The transcript ID returned by the transcribe tool |

### Example

```lua
local result = app.integrations.assemblyai.get_transcript({
  id = "abc123def456"
})

if result.status == "completed" then
  print("Text: " .. result.text)
  print("Confidence: " .. result.confidence)
elseif result.status == "processing" then
  print("Still processing. Try again in a few seconds.")
end
```

---

## list_transcripts

List transcripts with optional filtering and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max results per page (default: 20, max: 200) |
| `status` | string | no | Filter by status: `"queued"`, `"processing"`, `"completed"`, `"error"` |
| `created_on` | string | no | Filter by creation date (e.g., `"gte:2025-01-01"`) |
| `before_id` | string | no | Pagination: return transcripts before this ID |
| `after_id` | string | no | Pagination: return transcripts after this ID |
| `throttled_only` | boolean | no | Only return throttled transcripts |

### Example

```lua
local result = app.integrations.assemblyai.list_transcripts({
  limit = 10,
  status = "completed"
})

for _, transcript in ipairs(result.page_details.transcripts_ids) do
  print("ID: " .. transcript)
end
```

---

## upload

Upload a local audio or video file. Returns a URL for use with the transcribe tool.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `file_path` | string | yes | Absolute path to the local file to upload |

### Example

```lua
local result = app.integrations.assemblyai.upload({
  file_path = "/tmp/recording.mp3"
})

-- Use the upload_url with the transcribe tool
local transcript = app.integrations.assemblyai.transcribe({
  audio_url = result.upload_url
})
print("Transcript ID: " .. transcript.id)
```

---

## get_lemons

Retrieve billing credits and usage information.

### Parameters

None.

### Example

```lua
local result = app.integrations.assemblyai.get_lemons({})

print("Credits remaining: " .. tostring(result.lemons_remaining))
```

---

## get_current_user

Get the authenticated user's profile and plan info.

### Parameters

None.

### Example

```lua
local result = app.integrations.assemblyai.get_current_user({})

print("Email: " .. result.email)
print("Plan: " .. (result.plan and result.plan.name or "unknown"))
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.assemblyai.function_name({...})

-- Explicit default (portable across setups)
app.integrations.assemblyai.default.function_name({...})

-- Named accounts
app.integrations.assemblyai.work.function_name({...})
app.integrations.assemblyai.personal.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.assemblyai.assemblyai_transcribe({
  audio_url = "example_audio_url",
  language_code = "example_language_code",
  speaker_labels = true,
  auto_chapters = true,
  entity_detection = true,
  sentiment_analysis = true,
  summarization = true,
  punctuate = true
})
print(result)

Functions

assemblyai_transcribe

Submit an audio or video file URL for AI transcription. Supports speech-to-text, speaker diarization, summarization, sentiment analysis, and more. Returns a transcript ID to poll for results.

Operation
Write write
Full name
assemblyai.assemblyai_transcribe
ParameterTypeRequiredDescription
audio_url string yes URL of the audio or video file to transcribe. Can also be an AssemblyAI upload URL from the upload tool.
language_code string no Language code (e.g., "en_us", "es", "fr"). Defaults to auto-detection if omitted.
speaker_labels boolean no Enable speaker diarization to identify who spoke and when.
auto_chapters boolean no Automatically break the transcript into chapters.
entity_detection boolean no Detect entities like dates, locations, and organizations in the transcript.
sentiment_analysis boolean no Analyze sentiment (positive, negative, neutral) for each sentence.
summarization boolean no Generate a summary of the transcript.
punctuate boolean no Add punctuation to the transcript.
format_text boolean no Format text with capitalization and paragraph breaks.
webhook_url string no URL to receive a webhook when the transcript is complete.
custom_topics array no List of custom topics to detect in the audio.
topics array no Enable topic detection with AssemblyAI's built-in topics.

assemblyai_get_transcript

Retrieve a transcript by ID. Returns the transcription text, status (queued, processing, completed, error), confidence score, and any enabled AI features like speaker labels, chapters, or sentiment analysis.

Operation
Read read
Full name
assemblyai.assemblyai_get_transcript
ParameterTypeRequiredDescription
id string yes The transcript ID returned by the transcribe tool.

assemblyai_list_transcripts

List transcripts with optional filtering by status, date range, and pagination. Returns transcript IDs, statuses, and metadata.

Operation
Read read
Full name
assemblyai.assemblyai_list_transcripts
ParameterTypeRequiredDescription
limit integer no Maximum number of transcripts to return per page (default: 20, max: 200).
status string no Filter by status: "queued", "processing", "completed", or "error".
created_on string no Filter by creation date. Accepts a date string or operator (e.g., "gte:2025-01-01").
before_id string no Return transcripts created before this transcript ID (for pagination).
after_id string no Return transcripts created after this transcript ID (for pagination).
throttled_only boolean no Only return throttled transcripts.

assemblyai_upload

Upload a local audio or video file to AssemblyAI. Returns an upload URL that can be passed to the transcribe tool as the audio_url parameter. Supports most common audio and video formats.

Operation
Write write
Full name
assemblyai.assemblyai_upload
ParameterTypeRequiredDescription
file_path string yes Absolute path to the local audio or video file to upload (e.g., "/tmp/recording.mp3").

assemblyai_get_lemons

Retrieve lemons (billing credits and usage information) from your AssemblyAI account.

Operation
Read read
Full name
assemblyai.assemblyai_get_lemons
ParameterTypeRequiredDescription
No parameters.

assemblyai_get_current_user

Get the authenticated user's profile, including email, subscription plan, and API usage details.

Operation
Read read
Full name
assemblyai.assemblyai_get_current_user
ParameterTypeRequiredDescription
No parameters.