Skip to content

Decision API: Typed Answers Your Code Can Actually Branch On

Ask a chat model for JSON and you get something JSON-shaped: usually parseable, occasionally missing a field, and never guaranteed to mean the same thing twice. That gap — between text that looks structured and output your code can safely branch on — is exactly what a decision API closes. Instead of generating prose and hoping a parser survives, a decision API accepts state plus a set of questions defined in code and returns typed, calibrated answers in a single pass. For teams building routing logic, risk checks, quality gates, or autonomous agents, that distinction separates a demo from something you can put on the critical path.

Typed, Calibrated Answers Instead of Generated Prose

A decision API is best understood by what it returns. Rather than free text, it produces values in a small, fixed set of shapes: a choice (one label from a list you supply), a score (a level on an ordered scale), a truth (a calibrated probability between 0.00 and 1.00), a number (a value on a grid you define), and point or box coordinates for locations inside an image. Those shapes cover the overwhelming majority of production questions: which queue, how risky, yes or no, how many, where. Because the response is schema-valid by construction, there is no regex extraction, no repair prompt, and no retry loop burning tokens because a model added a friendly preamble.

The second half of that contract is calibration, and it is the part most teams underestimate. When an answer carries a confidence of 0.90, that number should be right roughly nine times out of ten across many calls — not a vibe, but a measurable property. That single property is what makes thresholds defensible in code: act automatically above your line, re-check or take a safe path below it, and log both so you can audit the boundary later. A hand-written rules engine cannot tell you how sure it is. A chat model will happily invent a confidence if you ask it to.

Determinism matters just as much for engineering hygiene. Same request, same answer means your integration tests are stable, incidents are replayable, and downstream consumers can cache aggressively without worrying about silent drift between runs. This is the philosophy behind DecisionNode, a decision engine built as a decision api rather than a text generator: developers POST state and questions to a single HTTPS endpoint, and get schema-valid answers back in one pass. Two models cover the latency spectrum — DecisionNode Flash at roughly 5 ms server-side and 19 ms end to end, and DecisionNode MoE at about 9 ms — priced at $0.035 and $0.042 per one million input tokens respectively, with output tokens always free, batch discounts, and a free daily tier for evaluation. Sub-20-millisecond end-to-end latency is not an incidental figure: it is the difference between a decision that lives in a background job and one that lives inside a checkout or a robot control loop.

Designing the Request: State, Questions, and Thresholds That Survive Production

The elegance of a decision endpoint is that the questions live in your codebase, not in a prompt. You declare what you want to know once — labels, scales, numeric grids, image regions — and the service answers against that contract on every call. That gives you version control, code review, and type generation from the same source of truth. When product asks for a new label, it is a schema change with a diff, not a hand-edited system prompt that silently invalidates six weeks of tuning. State itself is flexible: plain text, structured JSON, or up to sixteen images and video frames per request, which is what makes the same endpoint workable for a support ticket and a production-line camera at once.

The mechanics are deliberately boring. One HTTPS call, one response, no multi-turn negotiation between you and the model. SDKs for TypeScript, Python, Go, Ruby, and plain curl mean the integration cost is measured in minutes, and MCP tools plus webhooks let the same decision surface show up inside agent runtimes and event pipelines without bespoke glue. For loops that exceed ten decisions per second — drone flight, robotics, simulators, continuous machine monitoring — sessions over WebSocket keep the round trip lean instead of paying HTTP overhead on every tick.

Where teams tend to need guidance is threshold design. Start by collecting a labelled sample, run it through the endpoint, and plot accuracy by confidence band. You will usually find a zone where precision is good enough to automate and a zone where it is not; the boundary is your threshold, and it should be expressed as configuration, not hardcoded. Below-threshold outcomes should route somewhere useful: a human review queue, a stricter secondary check, or a conservative default action. Then monitor. Track per-label precision over time, watch for calibration drift when input distributions shift, and keep a golden set in CI that asserts determinism and catches schema regressions. Optional boosters — human age estimation, AI-generated image detection, face detection and recognition, OCR, depth, and segmentation — can be composed into the same call when a decision depends on more than raw pixels, avoiding a separate vision vendor in the request path. The net effect is a contract you can reason about: typed inputs, typed outputs, and a confidence number that means something.

Where Decision APIs Earn Their Keep: Routing, Risk, Quality, and Agents

The clearest pattern is replacement of brittle hand-written rules. A support pipeline might ask for a choice across eight routing labels and a truth on whether the ticket is urgent. Above 0.85 confidence, route automatically; between 0.50 and 0.85, route but flag for sampling review; below 0.50, hand to a human with the top two candidate queues attached. The old version of this was a thousand-line keyword cascade that nobody dared edit and that silently misrouted every new phrasing. The decision version is a schema, a threshold, and a measurable precision number.

Risk checks behave the same way with a harder latency budget. A promo-abuse or fraud gate at checkout needs an answer inside the request window, so a 19 ms end-to-end call fits where a chat completion never would: send order JSON, ask whether this account and device pair looks abusive, get a calibrated probability back, and combine it with your existing velocity rules rather than replacing them. Order and shipping decisions follow the same shape — a choice among fulfilment paths, an estimated number of days on a grid — with typed output feeding directly into warehouse systems instead of an engineer transcribing a paragraph.

Visual decisions are where the point and box answer types do real work. Quality control on a production line can send a frame and ask whether a component is seated, plus where a defect appears; warehouse monitoring can ask whether a bay is occupied; traffic monitoring can score congestion level from a sampled sequence of frames. Because each frame is a decision rather than a full generation, sustained throughput stays affordable, and deterministic responses make audit trails trivial: the same frame replayed in an incident review yields the identical verdict.

For AI agent builders, the interesting shift is architectural. An agent that calls a decision API before acting — before sending the email, before issuing the refund, before moving the arm — gets a bounded, typed gate instead of reasoning in prose about whether it should proceed. The agent keeps its planning and tool use; the moments that require a crisp judgement move to an endpoint with a confidence number attached. Teams running this pattern typically start with the free daily tier, benchmark their own labelled data against both models, and end up with a small set of thresholds checked into the repo alongside the code that consumes them — and a decision log that shows, call by call, exactly what the system believed and how sure it was.