Skip to main content
This page takes about five minutes. You install a client, ask three questions about a support ticket and read the answer. You need an API key from the console. New accounts may start on a waitlist (your account). Until yours is admitted, the playground runs the same requests with no account.

Install a client

The Python client needs Python 3.11 or newer, and the TypeScript client Node 20 or newer. You can also call the API over HTTP, as the cURL tab below does.

Set your key

Both clients read the key from SQWISH_API_KEY. Keep it out of source control and out of code that runs in a browser (API keys).

Ask your first questions

One request can ask several questions about the same text, its context. This one asks three questions about a support ticket, one of each decision type:
  • team: which team should handle it, one of three.
  • urgent: whether it states a deadline within a day, yes or no.
  • impact: how badly the customer is affected, on a scale from 0 to 2.
To run the TypeScript, save it as quickstart.mts and run npx tsx quickstart.mts.

Read the answer

This is a real answer kettei-core gave to that request, rounded to three places:
Each decision’s answer is under its id.
  • probabilities has every outcome you allowed, with its probability. They add up to 1.
  • top is the likeliest outcome, and p_top its probability.
  • An ordinal decision adds expected_level, the probability-weighted level, counted from 0.
  • model names the model that answered.
The full answer also has usage, the input tokens you are billed for, and charge, what the call cost. Read the response explains every field. A request that names no model asks for kettei-core. If the model you ask for can’t answer right now, another size may answer instead, and then fallback says so (models and fallback). To ask about pictures, name kettei-fat or kettei-chub, and shrink each picture to the size the model reads (images).

Act on it

Add a policy to a decision and its answer says what to do. With abstain_below, the action is abstain when p_top is below your threshold. Otherwise it is the likeliest outcome:
Choose the threshold on tickets whose answers you know (act on the answer). The clients send an idempotency key with every decision and reuse it when they retry, so a retried call is not charged twice. The one exception is an organisation with zero data retention (retries and idempotency). Nothing from a request is kept for training.

Next steps

How OneHot works

The words OneHot uses, and how the pieces fit together.

Write good decisions

Wording the models read well, and the free linter that checks it.

Score many texts

Send thousands of texts within your rate limits, and price them first.

Improve a decision

Label examples, measure, tune the wording and train a model of your own.