Decision API: The Typed Answer Layer That Turns Model Output Into Production Code

Most teams that try to put a language model behind a business rule hit the same wall. The model returns fluent prose, a helpful explanation, sometimes a JSON-shaped blob wrapped in a markdown fence, and occasionally a field you never asked for. Your code then has to parse it, coerce it, validate it, guess at whether the answer is trustworthy, and retry when it is not. That is not a decision system. That is a text generator with a validation tax bolted on top.

A decision API is the architectural alternative: a single HTTP endpoint where you declare the question and the allowed answer shape in code, send the state that matters, and receive a typed, schema-valid response in one pass. No prompt archaeology, no regex extraction, no second call to ask the model how confident it is. This article looks at what that contract looks like in practice, which engineering properties actually determine whether it survives production, and where the pattern replaces hand-written rules and chat-model workarounds.

What a Decision API Returns, and Why Typed Output Changes the Architecture

The defining characteristic of a decision API is that the answer arrives as a value your code can branch on directly. DecisionNode exposes this through one endpoint, POST /v1/decide, where you send state as text, JSON, or up to 16 images or video frames, alongside questions you have already defined in code. The response is not narrative. It is one of five typed answer kinds, each matching a question type you chose.

A choice returns exactly one label from a set you supplied — billing, technical, refund, whatever your routing table uses. A score returns a level on an ordered scale, which is what you want when the meaningful distinction is “how bad” rather than “which bucket.” A truth returns a calibrated probability between 0.00 and 1.00, designed to be compared against a threshold rather than read by a human. A number returns a value on a grid, and point and box return locations inside an image for detection and localisation tasks.

That contract removes an entire class of failure. When you ask a chat model to “reply only in JSON,” you are relying on instruction-following to enforce a schema, and you own the consequences when it drifts: malformed braces, quoted booleans, hallucinated enum members, extra commentary. With a typed decision api, the schema is the request. Invalid shapes are not a runtime possibility you have to defensively parse around; they are not part of the interface. Your persistence layer, your audit log, and your feature flags all consume the same stable structure.

The second structural difference is confidence. Every answer carries a calibrated confidence value, so a confidence score means what it says across question types and inputs. That lets you write branching logic that is genuinely three-way rather than binary: act immediately above your threshold, take a safe path below it, and send only the ambiguous middle band to a human or a slower, more expensive check. Teams that have built this with chat models usually end up reconstructing confidence from logprobs or from a second “how sure are you” call — both of which are approximations of a property a decision engine returns natively.

Because questions are defined in code rather than in prompt strings, they also live in version control. A scoring rubric becomes a diff. A routing taxonomy becomes a schema change with a review. That is a meaningful shift for product and platform teams, because it moves decision logic out of a prompt document and into the same deployment pipeline as the rest of the service.

Latency, Calibration, and Determinism: The Properties That Decide Production Readiness

For developers and ops teams, three non-functional properties separate a decision API that can sit inline in a request path from one that has to be queued and reconciled later: speed, reproducibility, and the ability to handle sustained volume.

DecisionNode ships two models with different trade-offs. DecisionNode Flash runs at roughly 5 ms server-side and about 19 ms end to end, priced at $0.035 per 1M input tokens. DecisionNode MoE runs at roughly 9 ms, priced at $0.042 per 1M input tokens, for cases that need more capacity per decision. Output tokens are always free, batch discounts are available, and there is a free daily tier — which matters less for cost modelling than for the fact that you can benchmark your actual question set before committing to an architecture. At those numbers, a decision can sit inside a synchronous checkout, a ticket-creation handler, or a warehouse scan event without needing an async job and a callback.

Determinism is the property most teams underestimate until they operate the system. Same request, same answer. No sampling, no temperature, no run-to-run drift. For a recommendation engine, variance is a feature. For a gating decision — does this order ship, does this promo apply, does this account get flagged — variance is an incident. Determinism is also what makes replay useful: you can take a logged request from last month, re-run it, and get the decision your code actually made, which is the foundation of a defensible audit trail.

Confidence thresholds pair naturally with that. A typical pattern is to set an aggressive cutoff for the automated path and a conservative one for the exception path, then measure the volume landing in each band and tune from there. The threshold becomes a tunable business parameter rather than a hardcoded rule, and because confidence is calibrated you can reason about what a 0.92 actually implies instead of learning it empirically per question.

Volume handling is explicit too. Above roughly 10 decisions per second, DecisionNode offers sessions over WebSocket rather than per-request round trips, which is the mode built for drones, robots, simulators, and continuous machine monitoring. SDKs cover TypeScript, Python, Go, Ruby, and plain curl, with MCP tools, webhooks, and AI agent integrations for teams wiring decisions into autonomous loops. Optional boosters — human age estimation, AI-generated image detection, face detection and recognition, OCR, depth, and segmentation — attach specialised perception to the same endpoint instead of forcing you to stand up separate model services.

Where Decision APIs Replace Brittle Rules and Chat-Model Workarounds

The clearest signal that a decision API fits a workflow is the presence of a long if/else ladder that someone is afraid to edit. Those ladders accumulate exceptions over years, they encode knowledge that lives in one engineer’s head, and they degrade silently as inputs shift. Decision APIs do not eliminate the need for business logic — they move the judgement part into a model that returns a typed, confidence-scored answer, leaving your code to own the thresholds and the consequences.

Ticket routing and triage is the canonical example. A choice question over your existing queue taxonomy, plus a score for urgency, plus a truth for “is this actually a duplicate,” replaces keyword matching and a chain of escalation rules. Because the output is typed, the ticket lands in the right queue with the right priority field populated on the first pass, and low-confidence tickets route to a human intake step rather than being misrouted confidently.

Fraud and promo-abuse checks benefit from the truth answer type specifically. Instead of a binary block, you get a probability you can compare against multiple thresholds — auto-approve, approve with monitoring, manual review, block — and the threshold values become a business decision you can change without a model change. The same shape applies to order and shipping decisions, where the question is often “which of these fulfilment paths is valid” rather than “is this good or bad.”

Moderation, scoring, and gating follow the same pattern: classify against your labels, score against your rubric, and gate on calibrated confidence. Quality control on production lines and warehouse and traffic monitoring use the visual answer types, sending frames and receiving box or point answers for defect localisation and occupancy checks, with sessions carrying the high-frequency loop. For AI agents, the decision point matters most before an action rather than after: a decision API lets an agent check “is this the right tool, is this input safe to send, does this satisfy the precondition” as a typed call with a confidence value, instead of asking a chat model to introspect in prose and hoping the answer is parseable.

Across all of these, the migration path is incremental. Pick one rule ladder, express its questions as typed decisions, run it in shadow mode against live traffic, and compare the decision API’s answers and confidence bands against what your existing code produced. Where the two agree, you gain determinism and reproducibility for free. Where they disagree, you have found the exceptions nobody documented — which is usually the most valuable output of the exercise.

Leave a Reply

Your email address will not be published. Required fields are marked *