The AI Gateway
The AI gateway is the one route by which the platform calls a language model. Each feature names a role; the gateway looks up which provider and model that role uses, applies its limits, checks AI credit where billing is on, makes the call, and writes one row to the AI run log. Changing provider is therefore configuration, not a change to any feature.
Where to find it
Architect Panel → Configuration:
- AI Settings — providers, keys, the role for each feature, logging, limits and billing
- Platform Modules — the AI module switch, which hides and closes the AI screens
Architect Panel → Activity:
- AI Usage — cost, failures, recent calls, and a test call per role
- AI Run Log — one row per call
Architect Panel → Integration & Connections:
- AI Tool Access (MCP) — the opposite direction: an AI calling into the platform
Outbound, not inbound
The gateway is the platform calling a model. AI Tool Access (MCP) and Agent Access (A2A) are an outside AI calling the platform. They are different directions with different settings and different risks; see MCP Server and A2A Server.
The features that use it
- The sign-up wizard (role
onboarding): a description of a business becomes an app blueprint. - AI Builder (
aibuilder): a request becomes a change set, shown to you before anything is applied. - App Code (
ide): generates extension source, which is checked and versioned like any other code. - Report Builder's assistant (
biquery): a question becomes a query definition, built from field names and labels only. - AI reading of scans (
ocr): text read from scanned images for the document index. - ERP Feed Queue suggestions (
erpfeed): an account and tax code proposed for an uncoded bank line, when a user asks. - Agent Access (A2A) (
a2a): the planner that decides how to carry out a delegated task. - A client app's own features: any role name its developer chooses, given a provider on AI Settings.
Two more AI services sit beside the gateway and share its run log and its AI credit checks: image and video generation on Gemini, and TypeSafe Jev, a decision model that answers typed questions rather than writing text (see AI Images & Video and TypeSafe Jev).
What every call gets
- A provider and model from its role, or from
builderwhen the role names none. - Limits: features a person waits for are held to about 100 seconds a call with no retry; background work gets longer.
- A credit check before anything is sent, where AI billing is on.
- A row in the run log, with tokens, estimated cost and outcome, whatever happened.
- A plain error code when it fails (not_configured, auth, permission, not_found, rate_limited and so on), which AI Usage explains.
Getting started
- On AI Settings, enter a key and a default model for one provider.
- Set the
builderprovider to it, so every feature inherits it. - On AI Usage, use Test on
builderand check it answers. - Use the features. Watch AI Usage for a week before pointing individual roles elsewhere.
With no provider configured, every AI feature reports that AI is not configured and sends nothing.
Send to AI
The provider sections also carry Offer in Send to AI and Send to AI delivery, which govern a menu a custom app can place on its own screens. That menu can also copy a prompt to the clipboard instead of calling a provider. No standard platform screen has the menu, and the features above ignore both settings.
These are proposals, not decisions
The AI Builder's change set is shown before it runs, the Report Builder's suggested query is checked against your own permissions, and generated code goes through the same checks and approval as hand-written code. Keep it that way: the value is a good first draft quickly, and the risk begins where nobody reads the draft.
Worked example
An organisation configures one provider, sets it as builder, and tests it. A month later AI Usage grouped by feature shows App Code making several repair calls per extension, so the ide role is pointed at a stronger model, while the Report Builder's assistant, which only ever sees field names, stays on the default.
Recommendations
- Start with one provider as builder and specialise roles on evidence from AI Usage.
- Keep the gateway and MCP separate in your thinking: opposite directions.
- Test every role you change before users rely on it.
- To stop all AI calls, clear the provider keys: every feature then reports AI as not configured. The AI module switch only closes the AI screens.