DEVELOPER GUIDE

Build your first decision

A practical guide to this service: run, inspect, integrate, measure.

This independent workbench and API service supports Jev by TypeSafe AI, Solar Decide by Upstage, Kev 4B by Jared Palmer, and Laya. A bounded output can still be wrong: validate on your own data.

Quickstart

Create an account to receive 100 credits. Load a recipe, review its budget and run it. Tune the questions, save your configuration, and open the Code tab. Create a site API key to use the same credit balance from your server.

export DECISION_API_KEY="YOUR_API_KEY"

curl --fail-with-body 'https://decisionapi.org/v1/systemone' \
  -H "Authorization: Bearer $DECISION_API_KEY" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "model": "typesafe/jev-1.13",
  "state": "I was charged twice for order A-4471. Please refund the duplicate payment.",
  "questions": {
    "route": {
      "type": "choice",
      "instructions": "Which team should handle this ticket? Use other when no option fits.",
      "criteria": {
        "billing": "Payments, charges and refunds",
        "technical": "Bugs and product errors",
        "account": "Login and account access",
        "other": "None of these teams"
      }
    }
  }
}'

Keep API keys on your server. Do not embed them in browser code or commit them to source control.

API reference

POST https://decisionapi.org/v1/systemone

Send JSON with model, state and questions. Use Authorization: Bearer with a key from this site. Successful responses use code: 0; answers live at data.result.answers. Official provider SDK response shapes differ.

FieldShape
modelPlayground and API both support typesafe/jev-1.13 (alias: jev-latest), liquid/d1, upstage/solar-decide, jaredpalmer/kev-4b, laya-english, laya-multilingual and laya-auto. Liquid d1 uses Vercel AI Gateway; its boolean question and token-usage fields are normalized to the Jev workbench format. Solar Decide uses the same System One request and response schema as Jev. Use laya-auto to automatically select the English or multilingual model; result.routing.model identifies the selected Laya model. The separate Span workbench and this API also support respan/span-01 and respan/span-01-lite, with Noul questions only.
stateNon-empty text, a JSON object or array. Shared by all questions. Span accepts text or {input: message array, output: assistant message}; every message has only role and text content. Generic JSON objects and bare arrays are not supported for Span.
questions1–8 named questions. IDs start with a letter, followed by letters, digits, _ or -; maximum 64 characters.

choice

Define 2–255 named options in criteria. The answer includes choice, probabilities and confidence. Add an explicit fallback option for cases that do not fit.

score

Define 2–10 ordered strings in criteria. The score ranges from 0 to the last index and may be fractional; probabilities describe the levels.

noul

noul returns P(true), from 0 to 1. Optional criteria.true and criteria.false describe what counts as yes and no. It does not return a boolean; use your own threshold.

Probabilities are model outputs over your answer space. Confidence is a separate signal. Neither is a measured accuracy rate. For Noul, the threshold uses max(P(yes), 1 − P(yes)); 0.01 can be a decisive no. Validate thresholds against labeled cases in Compare rules.

Illustrative response — not a live measurement

{
  "code": 0,
  "message": "ok",
  "data": {
    "requestId": "example-request-id",
    "creditsUsed": 1,
    "historySaved": true,
    "result": {
      "model": "typesafe/jev-1.13",
      "answers": {
        "route": {
          "type": "choice",
          "choice": "billing",
          "probabilities": {
            "billing": 0.94,
            "technical": 0.02,
            "account": 0.02,
            "other": 0.02
          },
          "confidence": 0.9
        }
      },
      "usage": {
        "input_tokens": 1000,
        "output_tokens": 0
      },
      "elapsedMs": 250
    }
  }
}

Latency measures this service’s server processing time, including the provider round trip. It excludes the browser network trip and is not a performance guarantee.

Billing & limits

Up to 8 questions and 32 KiB per request. Web attempts are spaced at least 3 seconds apart. Web, API and evaluation follow the same billing: Jev, Kev and Laya cost max(1, ceil(input tokens × 600 / 1,000,000)); Solar Decide uses 720; Span-01 uses 300; Span-01 Lite costs 1 credit. Before calling the provider, we reserve the displayed conservative budget. On success, we charge actual input tokens and return the remainder. Failed calls release the reservation; interrupted holds expire after 10 minutes and are released on the next balance check or request.

400 invalid input · 401 sign-in/key required · 402 insufficient credits · 409 duplicate request · 413 request too large · 429 wait for Retry-After · 502 provider failure · 503 service unavailable. Send a unique Idempotency-Key (8–64 letters, digits, _ or -) per logical API request. Reusing it returns 409 without another model call. Check history before retrying an uncertain outcome.

All live calls use credits, including web and evaluation. Minimum 1 credit per successful request; output tokens are not charged. Span-01: 300 credits/million input tokens. Span-01 Lite: 1 credit per successful request. Jev, Kev and Laya: 600 credits/million; Solar Decide: 720 credits/million. $1 buys 10,000 credits. Failed calls are refunded. Estimates exclude taxes.

Data & history

Saved configurations and web request bodies/results are private to your account. API history retains metadata, token usage and credits, not request content. Browser drafts are local to this browser.

Recipes

Test the same cases against two rule sets

Capture A from the current workbench model and rules. Change the model or questions, then capture B. Import up to 25 labeled cases and compare both versions. The dataset state replaces each captured state.

{"id":"refund","state":"Please refund my duplicate payment.","expected":{"route":"billing"}}
{"id":"login","state":"My reset link has expired.","expected":{"route":"account"}}

1–25 cases. JSONL: one {id, state, expected} per line. CSV: id,state,expected; expected is a JSON object keyed by question ID. Match rate uses labeled answers from completed requests; errors are counted separately. Noul labels are true/false (P(yes) ≥ 0.5). Score uses the tolerance set before the run.

Model references