- A Noul is a yes or no question, answered with the probability that the answer is yes.
- A Choice picks one option from a set you define.
- A Score rates the state on ordered levels you describe.
How it differs from a chat model
That last row matters for budgets. Asking several questions in one call sends the state once. Asking them one call at a time sends the whole state again with every question. TypeSafe’s own fan-out pattern recommends batching, and under a Stigg budget the difference is easy to see: thirteen questions about one document cost about one document’s worth of input in a single call, and about thirteen when asked separately.
Set up
Wrap aTypeSafeClient from @typesafe-ai/sdk. The SDK recognizes it automatically, and gates and meters its systemOne method.
systemOne call is checked before it is sent and metered when the answers arrive. If access is denied, the questions are never sent, so they are never paid for. See Handling denied access.
For the client itself, see TypeSafe’s JavaScript SDK docs.
Requested usage
Because the cost of a TypeSafe call is mostly its input, the best estimate of a call’s usage is the size of the state, and you know it before the call.estimateFromState(tokensPerUnit, charsPerToken) estimates the input tokens from the state’s length (4 characters per token by default) and uses that as the requested usage of the check, so a call the balance cannot cover is denied before it is sent:
What is reported
EverysystemOne response includes a usage object with the input and output tokens of the whole call. The wrapper reads it and reports these metrics:
Price
total_tokens, or the two parts, but never both. There are no cache counters, because a call is not part of a conversation, and no cost, because TypeSafe is not a gateway.
Every usage field TypeSafe returns is also included, with a raw. prefix. See How usage is reported.