AI
LLM gateway for other modules: one set of DSL library functions (complete, chat, chatWithFile, extract) that call Anthropic or OpenAI-compatible APIs with the keys, model and limits a tenant configures once, here.
v0.1.2 · 6 installs · free
What it does
AI is the one place where a workspace connects to a language model. It has no screens, tables or buttons of its own. Instead it gives other modules a small set of functions for asking a model a question, sending it a file, or getting structured data back. Provider, model, limits and API key are set once here, so no other module carries a vendor name or a key.
An admin installs it, adds an API key and, if wanted, changes a few settings. Modules that use it, such as File Library, then work without further setup.
Highlights
- Two providers — Anthropic and OpenAI. Any server that speaks the OpenAI chat API (Azure OpenAI, Ollama, vLLM, a proxy) works through the base URL setting.
- Keys stay in secrets — the Anthropic and OpenAI keys are secrets on this module, never settings, and appear by name on the Admin Secrets page.
- Files as input — send a PDF or a PNG, JPEG, GIF or WebP image along with the question.
- Structured answers —
extractasks for JSON and returns it parsed. - Failures you can store —
chat,chatWithFileandextractnever throw. They returnok,errorand token usage, so a calling action can write a status on the record instead of rolling back. - Readiness check —
configError()tells a caller up front whether the key, provider and model are in place. - Per-folder tuning — every setting can differ by folder, for example a stronger model for one department.
- Per-call overrides — a caller can override provider, model, token limit, temperature or system prompt for one call.
Functions
| Function | Returns | Notes |
|---|---|---|
complete(prompt, options?) |
text | Shortest form. Ends the run with an error on failure |
chat(messages, options?) |
result | messages is a string or a list of { role, content } |
chatWithFile(prompt, file, options?) |
result | file is the value of a file field |
extract(prompt, schema?, options?) |
result with parsed data |
Asks for JSON only and strips a code fence |
configError(options?) |
message or null |
Missing key, unknown provider or empty model |
isConfigured(options?) |
true or false | Same check as a flag |
A result is { ok, text, data, error, provider, model, stopReason, usage: { inputTokens, outputTokens }, raw }. Options are provider, model, maxTokens, temperature, system, baseUrl and json.
execute:
var r = ai.chatWithFile('Summarize this file in two paragraphs.', [file])
if (r.ok) {
[summary] = r.text
} else {
[processing_error] = r.error
}
A module calls these after listing the functions it needs in its own deps/ai.json.
Setup
- Install the module.
- In Admin > Secrets, set
anthropic_api_keyoropenai_api_key, matching the provider. - Optionally change the provider, model and limits in the module settings.
Limits
Calls run under the action budget: 10 calls per script, 120 seconds per call, 5 MB per response, and 10 MB per file sent to the model. Long or many calls belong in a background action, as File Library's Summarize does.
How it fits
File Library uses it for file summaries.
Used by
Published modules that build on this one.
- File LibrarySample file library — drop files into a tile-based grid view.
Settings
Configurable per workspace, under Admin.
| Setting | Type | Default |
|---|---|---|
providerProvider | dropdown | anthropic |
modelModel | text | — |
base_urlBase URL | text | — |
max_tokensMax output tokens | number | 1024 |
temperatureTemperature | number | — |
system_promptSystem prompt | textarea | — |
0.1.2Dec 1, 2026
Code examples in the README are highlighted
For users
The code examples in the module page are now syntax-highlighted.
0.1.1Nov 19, 2026
The API keys are named on the Secrets page
For users
Admin → Secrets now lists the AI module's two keys by name — Anthropic API key and OpenAI API key — marked set or not set, so there is nothing to guess. Every module that uses the AI shows the same keys in its own section, marked as provided by AI; setting one there sets it for all of them.
For developers
- The manifest declares both keys under
secrets.
0.1.0Oct 26, 2026
One AI gateway for every module
Install requirement: admin 1.22.0 or newer, which runs DSL function libraries.
For users
A new AI module holds the LLM configuration for the whole workspace: the provider (Anthropic or
OpenAI-compatible), the model, the API key, the output limit and a system prompt. Set the key once under
Admin → Secrets (anthropic_api_key or openai_api_key) and every module that uses the AI picks it up.
Settings are folder-scoped, so one department can run a stronger model than the rest.
For developers
- The module ships no entities: it is a function library,
logic/functions/llm.dsl. Import what you call indeps/ai.json("functions": ["chat", "complete", ...]) and call it asai.<fn>(). complete(prompt, options?)returns the answer text and ends the run witherror()on failure.chat(messages, options?),chatWithFile(prompt, file, options?)andextract(prompt, schema?, options?)return a result object{ ok, text, data, error, provider, model, stopReason, usage, raw }and never throw, so a caller can record a failure on the row instead of losing its transaction.configError(options?)/isConfigured(options?)say up front whether a call could succeed — use them inonBeforeStart:.- Messages are vendor-neutral:
{ role, content }where content is a string or parts{ type: 'text', text }/{ type: 'file', file }. A file part is a file field's value, passed in by the caller; PDF and PNG/JPEG/GIF/WebP are sent as the provider's document/image block. optionsoverrides the settings per call:provider,model,maxTokens,temperature,system,baseUrl,json.- See
files/README.md.
Browse the full
module catalog.
Every module is metadata — install it in one click, then change anything.