How it works
The API is a thin facade over the same single round-trip the chat uses:- It’s a single-turn, no-tools call. You send a prompt (and optionally files); Logic AI returns text. It does not run the agentic tool loop (no SOQL/DML tools) — that lives in the chat experience.
- Each call is one gateway round-trip and debits credits from your org’s balance, exactly like a chat message.
- The model and attribution for a call come from a registered source, not from the request — see Source Registration.
The three entry points
Full signatures and field-by-field details are in the Apex API Reference.
Namespace
All symbols are in the managed-package namespacelai: lai.LogicAI, lai.LogicAISchema.Request, lai.LogicAISchema.Response. The examples in these pages include the lai. prefix.
Before you start
- Your org must be connected and provisioned — the same setup the chat needs (see the Quickstart). If the workspace isn’t ready yet, calls return a
503. - Register your source once and store the returned id — you pass it on every call. See Source Registration.
- Decide how you’ll handle failures —
invokenever throws for gateway/credit/validation problems; it reports them on the response. See Errors & Status Codes.

