Checked at the door
Structured output is parsed against the calling feature’s own schema before any code sees it. Broken output fails loudly rather than leaking into a record.
Every model answer is checked against a schema before it is used.
Meeting extraction, Ask Growth Kit, content drafting and profile writing all reach a model through one server function. The response comes back parsed against the schema that feature declared, so malformed output fails at the boundary instead of landing in a record. Keys stay on the server, and which model a feature uses is one line of configuration.
Interactive example
This walkthrough demonstrates the implemented backend contract without using an account, credentials, or provider calls.
Interactive example
Deterministic sample data only. No account, provider, or network connection is used by the interaction.
Highlights
Structured output is parsed against the calling feature’s own schema before any code sees it. Broken output fails loudly rather than leaking into a record.
Provider credentials live in server environment variables. Nothing AI-related ships to the browser, and the browser talks only to authenticated routes.
config/ai.ts maps each feature key to a provider and model. Changing a model never touches the feature that uses it.
Without a shared foundation, every team rebuilds these edge cases, differently.
A model returns something that is nearly the right shape and the code trusts it. The failure shows up later, inside a record someone relies on. Parsing at the boundary makes the failure immediate and obvious.
Model calls get added wherever it is convenient. One lands client-side and the credential ships to every visitor. Here the adapters are server-only, so there is nowhere for that to happen.
A provider retires a model and the change becomes a search across the codebase. Here it is one route entry, and every caller keeps its own key.
The mechanism end to end, as implemented in the repository.
A feature calls with its own key
Server code asks for text or a structured object, tagged with a feature key such as fast, default or reasoning. Configuration decides which provider and model handle it.
The call runs on the server
The matching OpenAI, Gemini or Anthropic adapter runs with server credentials. Every route in config/ai.ts points at OpenAI today.
The answer is parsed at the boundary
Structured output is requested from the provider and then parsed with the declared schema before returning. Invalid output throws rather than passing through.
The caller gets a typed result
The feature receives a clean object plus token usage, provider and model, so cost and routing are observable without a raw string to re-parse.
Engineering guarantees
Three provider adapters are wired and nothing fails over on its own when one is down. Model output is a draft for a person to accept, never a fact by itself, and this page cannot promise accuracy. Whether a generation is accepted at all depends on the workspace entitlement described under usage limits.
The boundary above is code, not a claim. These files carry the contract:
src/features/ai/runtime.tssrc/features/ai/contracts.tsconfig/ai.tsThese capabilities share contracts and boundaries with this one.
The docs describe the same contracts this page demonstrates.