AI models
How every model call runs through one gateway, chosen by Policy, metered against Limits, recorded in full, and graded by Evaluators.
Every model call in StartupBuilder runs through one gateway that routes, meters and records it. A Startup chooses models by Policy per task class, never in code, so changing a model changes no Interface.
Four ways a Verb runs
A Verb is the contract; its Function is how the work gets done. Callers see the Verb, never the Function, so a Startup moves work between code, models and people without breaking a client.
| Function | How it works | Example |
|---|---|---|
| Code | A deterministic transformation. | Compute an Invoice total. |
| Generative | One model call produces or classifies content. | Draft a reply. |
| Agentic | An Agent chooses and calls Tools across steps. | Research a lead and book a Meeting. |
| Human | A person does the work through a Task. | Sign a legal opinion. |
A model inside a Function does not change what the Startup sells. Software can call a model; a Service can mix Agents and people under one promise.
One gateway
The gateway serves four calls: generate, embed, classify and transcribe. It covers text, images, audio and video, across model families, under one key.
Each call is recorded with its request, response, model, tokens, latency and cost, and kept forever. Any output an Agent produced traces back to the exact call that produced it.
Model choice is a Policy
A Policy names a model per task class, such as draft, classify or review, with ranked fallbacks. Policies resolve like every Setting: the call overrides the Startup, the Startup overrides its Studio, and a lock beats all.
import { $ } from 'startup-builder'
await $.Policy.update({
id: 'models',
rule: 'draft: fast. review: strong, then fast.',
})When a model times out or refuses, the gateway tries the next in rank. The fallback is an Event, so a Startup sees how often its first choice fails.
Cost and Limits
Every call meters into the ledger exactly once, attributed to the Startup, the Customer and the Action that caused it. A Limit is checked before each call. A call past its Limit creates an Approval instead of a bill.
Attribution makes margins visible. A Service that is profitable on average but loses money on one Customer shows up as that Customer's cost per outcome.
Evaluation
An Evaluator grades an output against a rubric and records its verdict as an Event. Evaluators run on Verbs, on Workers and on Outcome Contracts, and Guards use them before anything leaves the Startup.
Evaluate the latest action.
curl -X POST https: //api.sb/ routewise.dev/ actions/ action_1/ evaluate \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"evaluator": "Example evaluator"}'
import { $ } from 'startup-builder'
const { verdict, action } = await $.Action.evaluate({ action: 'action_1', evaluator: 'Example evaluator' })
npx startup-builder do Action.evaluate --json '{"action": "action_1", "evaluator": "Example evaluator"}'
{
"name": "do",
"arguments": {
"code": "return await $.Action.evaluate({ action: 'action_1', evaluator: 'Example evaluator' })"
}
}
A schema check, a semantic review and a Customer's acceptance answer three different questions. Judge a model change by cost per accepted outcome, not cost per call: a cheaper model that doubles rework is the expensive one.
| Term | Kind | Definition |
|---|---|---|
| Evaluator | Noun | An Evaluator is a versioned Function that grades an output against a rubric and returns a verdict. |
| Guard | Noun | A Guard is a check every outbound Message and publish passes, from code rules to model review to a Human for high stakes. |
| Action.evaluate | Verb | Evaluate grades an Action’s output against a rubric and records the verdict as an Event. |