KosmoKrator

analytics

Helicone Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local helicone = app.integrations.helicone
local result = helicone.query_requests({})

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.helicone, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.helicone.default.* or app.integrations.helicone.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Helicone, 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.

Helicone

Namespace: helicone

Helicone provides LLM observability, request analytics, user feedback, user metrics, and an OpenAI-compatible AI Gateway. This integration uses Authorization: Bearer <HELICONE_API_KEY>.

Request Analytics

Use helicone_query_requests to query the request table with the ClickHouse-optimized endpoint.

local rows = helicone.query_requests({
  body = {
    filter = {},
    limit = 10,
    offset = 0,
    sort = { created_at = "desc" }
  }
})

Use helicone_query_requests_by_ids when you already know request IDs, and helicone_get_request for one request.

Feedback And Users

Submit feedback with:

helicone.submit_feedback({
  request_id = "request-uuid",
  body = { rating = true }
})

Use helicone_query_user_metrics and helicone_query_user_metrics_overview for user analytics. Their body objects are passed directly to Helicone’s official query schemas.

AI Gateway

helicone_list_gateway_models calls GET /v1/models on the AI Gateway.

helicone_gateway_chat_completions and helicone_gateway_responses forward OpenAI-compatible request bodies through Helicone’s AI Gateway:

local response = helicone.gateway_chat_completions({
  body = {
    model = "openai/gpt-4o-mini",
    messages = {
      { role = "user", content = "Summarize this trace." }
    }
  }
})

Coverage Notes

This package covers documented request query/lookup, request feedback, user metrics, gateway model listing, chat completions, and responses. Helicone also documents prompts, datasets, webhooks, experiments, security, caching, and provider-routing behavior; those should be added as endpoint-specific tools before calling this integration complete against the full Helicone platform.

Raw agent markdown
# Helicone

Namespace: `helicone`

Helicone provides LLM observability, request analytics, user feedback, user metrics, and an OpenAI-compatible AI Gateway. This integration uses `Authorization: Bearer <HELICONE_API_KEY>`.

## Request Analytics

Use `helicone_query_requests` to query the request table with the ClickHouse-optimized endpoint.

```lua
local rows = helicone.query_requests({
  body = {
    filter = {},
    limit = 10,
    offset = 0,
    sort = { created_at = "desc" }
  }
})
```

Use `helicone_query_requests_by_ids` when you already know request IDs, and `helicone_get_request` for one request.

## Feedback And Users

Submit feedback with:

```lua
helicone.submit_feedback({
  request_id = "request-uuid",
  body = { rating = true }
})
```

Use `helicone_query_user_metrics` and `helicone_query_user_metrics_overview` for user analytics. Their `body` objects are passed directly to Helicone's official query schemas.

## AI Gateway

`helicone_list_gateway_models` calls `GET /v1/models` on the AI Gateway.

`helicone_gateway_chat_completions` and `helicone_gateway_responses` forward OpenAI-compatible request bodies through Helicone's AI Gateway:

```lua
local response = helicone.gateway_chat_completions({
  body = {
    model = "openai/gpt-4o-mini",
    messages = {
      { role = "user", content = "Summarize this trace." }
    }
  }
})
```

## Coverage Notes

This package covers documented request query/lookup, request feedback, user metrics, gateway model listing, chat completions, and responses. Helicone also documents prompts, datasets, webhooks, experiments, security, caching, and provider-routing behavior; those should be added as endpoint-specific tools before calling this integration complete against the full Helicone platform.
Metadata-derived Lua example
local result = app.integrations.helicone.query_requests({})
print(result)

Functions

query_requests Read

Query Helicone request analytics with the ClickHouse endpoint.

Lua path
app.integrations.helicone.query_requests
Full name
helicone.helicone_query_requests
ParameterTypeRequiredDescription
No parameters.
query_requests_by_ids Read

Fetch request rows by explicit Helicone request IDs.

Lua path
app.integrations.helicone.query_requests_by_ids
Full name
helicone.helicone_query_requests_by_ids
ParameterTypeRequiredDescription
No parameters.
get_request Read

Retrieve a single Helicone request by ID.

Lua path
app.integrations.helicone.get_request
Full name
helicone.helicone_get_request
ParameterTypeRequiredDescription
No parameters.
submit_feedback Write

Submit positive or negative user feedback for a request.

Lua path
app.integrations.helicone.submit_feedback
Full name
helicone.helicone_submit_feedback
ParameterTypeRequiredDescription
No parameters.
query_user_metrics Read

Query Helicone user metrics.

Lua path
app.integrations.helicone.query_user_metrics
Full name
helicone.helicone_query_user_metrics
ParameterTypeRequiredDescription
No parameters.
query_user_metrics_overview Read

Query Helicone user metrics overview.

Lua path
app.integrations.helicone.query_user_metrics_overview
Full name
helicone.helicone_query_user_metrics_overview
ParameterTypeRequiredDescription
No parameters.
list_gateway_models Read

List AI Gateway models.

Lua path
app.integrations.helicone.list_gateway_models
Full name
helicone.helicone_list_gateway_models
ParameterTypeRequiredDescription
No parameters.
gateway_chat_completions Write

Create an OpenAI-compatible AI Gateway chat completion.

Lua path
app.integrations.helicone.gateway_chat_completions
Full name
helicone.helicone_gateway_chat_completions
ParameterTypeRequiredDescription
No parameters.
gateway_responses Write

Create an OpenAI-compatible AI Gateway Responses API response.

Lua path
app.integrations.helicone.gateway_responses
Full name
helicone.helicone_gateway_responses
ParameterTypeRequiredDescription
No parameters.