KosmoKrator

data

Eden AI Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.eden_ai.*. Use lua_read_doc("integrations.eden-ai") 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 Eden AI workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.eden_ai.chat_completions({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("eden-ai"))' --json
kosmo integrations:lua --eval 'print(docs.read("eden-ai.chat_completions"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local eden_ai = app.integrations.eden_ai
local result = eden_ai.chat_completions({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.eden_ai, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.eden_ai.default.* or app.integrations.eden_ai.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Eden AI, use the narrower mcp:lua command.

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.

Eden AI Lua API Reference

Namespace: app.integrations.eden_ai

Eden AI V3 is the current API. Use the V3 tools for new work; the V2 tools remain available for legacy accounts.

V3 Chat

local result = app.integrations.eden_ai.chat_completions({
  model = "openai/gpt-4o",
  messages = {
    { role = "user", content = "Write a concise summary." }
  },
  fallbacks = { "anthropic/claude-3-5-sonnet-latest" },
  temperature = 0.2
})

chat_completions accepts OpenAI-compatible parameters through extra, including tools, response format, web search options, reasoning effort, and image configuration.

V3 Models And Discovery

local models = app.integrations.eden_ai.list_models()

local features = app.integrations.eden_ai.list_features()

local moderation = app.integrations.eden_ai.get_feature_info({
  feature_path = "text/moderation"
})

V3 Universal AI

local result = app.integrations.eden_ai.universal_ai({
  model = "text/moderation/openai",
  input = {
    text = "Text to classify"
  },
  fallbacks = { "text/moderation/google" }
})

For async features:

local job = app.integrations.eden_ai.universal_ai_async({
  model = "ocr/ocr_async/amazon",
  input = {
    file = "https://example.test/document.pdf"
  }
})

local result = app.integrations.eden_ai.get_universal_ai_job({
  job_id = job.public_job_id
})

V3 Files

local file = app.integrations.eden_ai.upload_file({
  file_path = "/tmp/document.pdf",
  purpose = "ocr-processing"
})

delete_all_uploaded_files() permanently deletes every V3 uploaded file for the authenticated user.

Legacy V2 Tools

Existing V2 helpers are still available:

app.integrations.eden_ai.generate_text({
  providers = "openai",
  text = "Write a product blurb."
})

app.integrations.eden_ai.translate_text({
  providers = "google",
  text = "Hello",
  target_language = "fr"
})

Legacy helpers include generate_text, analyze_image, translate_text, transcribe_audio, ocr, and get_current_user.

Generic API Helpers

local v3 = app.integrations.eden_ai.v3_api_get({
  path = "/models"
})

local legacy = app.integrations.eden_ai.api_post({
  path = "/text/sentiment_analysis",
  body = {
    providers = "openai",
    text = "Great product"
  }
})

Absolute URLs are rejected; pass paths relative to /v3 for V3 helpers and /v2 for legacy helpers.

Multi-Account Usage

app.integrations.eden_ai.list_models()
app.integrations.eden_ai.default.list_models()
app.integrations.eden_ai.production.list_models()
Raw agent markdown
# Eden AI Lua API Reference

Namespace: `app.integrations.eden_ai`

Eden AI V3 is the current API. Use the V3 tools for new work; the V2 tools remain available for legacy accounts.

## V3 Chat

```lua
local result = app.integrations.eden_ai.chat_completions({
  model = "openai/gpt-4o",
  messages = {
    { role = "user", content = "Write a concise summary." }
  },
  fallbacks = { "anthropic/claude-3-5-sonnet-latest" },
  temperature = 0.2
})
```

`chat_completions` accepts OpenAI-compatible parameters through `extra`, including tools, response format, web search options, reasoning effort, and image configuration.

## V3 Models And Discovery

```lua
local models = app.integrations.eden_ai.list_models()

local features = app.integrations.eden_ai.list_features()

local moderation = app.integrations.eden_ai.get_feature_info({
  feature_path = "text/moderation"
})
```

## V3 Universal AI

```lua
local result = app.integrations.eden_ai.universal_ai({
  model = "text/moderation/openai",
  input = {
    text = "Text to classify"
  },
  fallbacks = { "text/moderation/google" }
})
```

For async features:

```lua
local job = app.integrations.eden_ai.universal_ai_async({
  model = "ocr/ocr_async/amazon",
  input = {
    file = "https://example.test/document.pdf"
  }
})

local result = app.integrations.eden_ai.get_universal_ai_job({
  job_id = job.public_job_id
})
```

## V3 Files

```lua
local file = app.integrations.eden_ai.upload_file({
  file_path = "/tmp/document.pdf",
  purpose = "ocr-processing"
})
```

`delete_all_uploaded_files()` permanently deletes every V3 uploaded file for the authenticated user.

## Legacy V2 Tools

Existing V2 helpers are still available:

```lua
app.integrations.eden_ai.generate_text({
  providers = "openai",
  text = "Write a product blurb."
})

app.integrations.eden_ai.translate_text({
  providers = "google",
  text = "Hello",
  target_language = "fr"
})
```

Legacy helpers include `generate_text`, `analyze_image`, `translate_text`, `transcribe_audio`, `ocr`, and `get_current_user`.

## Generic API Helpers

```lua
local v3 = app.integrations.eden_ai.v3_api_get({
  path = "/models"
})

local legacy = app.integrations.eden_ai.api_post({
  path = "/text/sentiment_analysis",
  body = {
    providers = "openai",
    text = "Great product"
  }
})
```

Absolute URLs are rejected; pass paths relative to `/v3` for V3 helpers and `/v2` for legacy helpers.

## Multi-Account Usage

```lua
app.integrations.eden_ai.list_models()
app.integrations.eden_ai.default.list_models()
app.integrations.eden_ai.production.list_models()
```
Metadata-derived Lua example
local result = app.integrations.eden_ai.chat_completions({})
print(result)

Functions

chat_completions Write

Create a V3 chat completion.

Lua path
app.integrations.eden_ai.chat_completions
Full name
eden-ai.edenai_chat_completions
ParameterTypeRequiredDescription
No parameters.
list_models Read

List V3 LLM models.

Lua path
app.integrations.eden_ai.list_models
Full name
eden-ai.edenai_list_models
ParameterTypeRequiredDescription
No parameters.
universal Write

Call V3 Universal AI synchronously.

Lua path
app.integrations.eden_ai.universal
Full name
eden-ai.edenai_universal_ai
ParameterTypeRequiredDescription
No parameters.
universal_async Write

Submit a V3 Universal AI async job.

Lua path
app.integrations.eden_ai.universal_async
Full name
eden-ai.edenai_universal_ai_async
ParameterTypeRequiredDescription
No parameters.
get_universal_job Read

Get a V3 async job result.

Lua path
app.integrations.eden_ai.get_universal_job
Full name
eden-ai.edenai_get_universal_ai_job
ParameterTypeRequiredDescription
No parameters.
list_features Read

List V3 expert model features.

Lua path
app.integrations.eden_ai.list_features
Full name
eden-ai.edenai_list_features
ParameterTypeRequiredDescription
No parameters.
get_feature_info Read

Get V3 feature discovery info.

Lua path
app.integrations.eden_ai.get_feature_info
Full name
eden-ai.edenai_get_feature_info
ParameterTypeRequiredDescription
No parameters.
upload_file Write

Upload a file to V3 storage.

Lua path
app.integrations.eden_ai.upload_file
Full name
eden-ai.edenai_upload_file
ParameterTypeRequiredDescription
No parameters.
delete_uploaded_files Write

Delete all uploaded V3 files.

Lua path
app.integrations.eden_ai.delete_uploaded_files
Full name
eden-ai.edenai_delete_all_uploaded_files
ParameterTypeRequiredDescription
No parameters.
generate_text Write

Generate text using AI models via Eden AI. Supports providers like OpenAI (GPT-4), Anthropic (Claude), Google (Gemini), Mistral, Cohere, and more. You can send a single prompt or a conversation history.

Lua path
app.integrations.eden_ai.generate_text
Full name
eden-ai.edenai_generate_text
ParameterTypeRequiredDescription
providers string yes Comma-separated list of AI providers (e.g., "openai", "openai,anthropic", "google"). Use "openai" for GPT-4, "anthropic" for Claude, "google" for Gemini, "mistral" for Mistral, "cohere" for Cohere.
text string no The prompt text to send to the AI. Use this for simple single-turn generation.
conversation array no Conversation history as an array of message objects with "role" (system, user, assistant) and "message" keys. Use this for multi-turn conversations.
temperature number no Sampling temperature (0.0–1.0). Higher values increase randomness. Default: 0.0.
max_tokens integer no Maximum number of tokens to generate in the response.
fallback_providers string no Comma-separated list of fallback providers if the primary provider fails.
analyze_image Read

Analyze images using AI models via Eden AI. Supports object detection, explicit content detection, scene description, and more. Provide an image as a URL or base64-encoded string.

Lua path
app.integrations.eden_ai.analyze_image
Full name
eden-ai.edenai_analyze_image
ParameterTypeRequiredDescription
providers string yes Comma-separated list of AI providers (e.g., "google", "amazon", "microsoft").
image_url string no URL of the image to analyze. Use this OR image_base64, not both.
image_base64 string no Base64-encoded image data. Use this OR image_url, not both.
features array no Analysis features to request (e.g., ["explicit_content", "object_detection", "scene_classification"]).
fallback_providers string no Comma-separated list of fallback providers if the primary fails.
translate_text Write

Translate text between languages using AI models via Eden AI. Supports providers like Google Translate, DeepL, Amazon Translate, Microsoft Translator, and more. Detects the source language automatically if not specified.

Lua path
app.integrations.eden_ai.translate_text
Full name
eden-ai.edenai_translate_text
ParameterTypeRequiredDescription
providers string yes Comma-separated list of translation providers (e.g., "google", "deepl", "amazon", "microsoft").
text string yes The text to translate.
source_language string no Source language code (e.g., "en", "fr", "de"). Omit to auto-detect.
target_language string yes Target language code (e.g., "en", "fr", "de", "es", "ja", "zh").
fallback_providers string no Comma-separated list of fallback providers if the primary fails.
transcribe_audio Read

Transcribe audio or video to text using AI models via Eden AI. Supports providers like OpenAI (Whisper), Google Speech-to-Text, Amazon Transcribe, Microsoft Azure, and more. Provide audio as a URL or base64-encoded string.

Lua path
app.integrations.eden_ai.transcribe_audio
Full name
eden-ai.edenai_transcribe_audio
ParameterTypeRequiredDescription
providers string yes Comma-separated list of transcription providers (e.g., "openai", "google", "amazon").
audio_url string no URL of the audio file to transcribe. Use this OR audio_base64, not both.
audio_base64 string no Base64-encoded audio data. Use this OR audio_url, not both.
language string no Language code for the audio (e.g., "en", "fr", "de"). Omit for auto-detection.
speakers integer no Number of speakers in the audio for speaker diarization.
fallback_providers string no Comma-separated list of fallback providers if the primary fails.
ocr Read

Extract text from images and documents using OCR via Eden AI. Supports providers like Google Cloud Vision, Amazon Textract, Microsoft Azure, and more. This is an async operation — the response may contain a public_job_id for tracking. Provide the document as a URL or base64-encoded string.

Lua path
app.integrations.eden_ai.ocr
Full name
eden-ai.edenai_ocr
ParameterTypeRequiredDescription
providers string yes Comma-separated list of OCR providers (e.g., "google", "amazon", "microsoft").
document_url string no URL of the image or document to process. Use this OR document_base64, not both.
document_base64 string no Base64-encoded document data. Use this OR document_url, not both.
language string no Language hint for OCR (e.g., "en", "fr", "de"). Improves accuracy for specific languages.
fallback_providers string no Comma-separated list of fallback providers if the primary fails.
get_current_user Read

Get the current Eden AI user's account information, including email, plan, and usage details. Useful for verifying API connectivity and checking account status.

Lua path
app.integrations.eden_ai.get_current_user
Full name
eden-ai.edenai_get_current_user
ParameterTypeRequiredDescription
No parameters.
v2_api_get Read

Call a legacy V2 GET endpoint.

Lua path
app.integrations.eden_ai.v2_api_get
Full name
eden-ai.edenai_api_get
ParameterTypeRequiredDescription
No parameters.
v2_api_post Write

Call a legacy V2 POST endpoint.

Lua path
app.integrations.eden_ai.v2_api_post
Full name
eden-ai.edenai_api_post
ParameterTypeRequiredDescription
No parameters.
v3_api_get Read

Call a V3 GET endpoint.

Lua path
app.integrations.eden_ai.v3_api_get
Full name
eden-ai.edenai_v3_api_get
ParameterTypeRequiredDescription
No parameters.
v3_api_post Write

Call a V3 POST endpoint.

Lua path
app.integrations.eden_ai.v3_api_post
Full name
eden-ai.edenai_v3_api_post
ParameterTypeRequiredDescription
No parameters.