Integration guides · 2026-12-01
Saanora Clara API: first request and confidence thresholds
Call saanora/clara-1 from Python: noul, choice and score questions, reading the probabilities, picking thresholds and sending unclear cases to a person.
Short answer: model saanora/clara-1, endpoint https://llmtr.com/v1/systemone
LLMTR is a gateway that gives access to language models from different providers through one OpenAI-compatible API. You call the Saanora Clara API on LLMTR with the saanora/clara-1 id at https://llmtr.com/v1/systemone. An API key created on llmtr.com and a funded balance are all you need. Input costs $0.10 per 1M tokens and output is not billed.
Clara is a decision model and writes no open-ended text. It takes a record, such as a support ticket, a conversation or a data row, together with your typed questions about it, and answers each one over the options you defined. Your code reads numbers instead of parsing a paragraph, and your own rules make the decision. Records and questions must be in English. The state can be plain text or a JSON object; the model reads no images, audio or files.
How do you send a first request to the Saanora Clara API?
The request is not in the chat format. The body has model, state and questions fields, and your key goes in the Authorization header after Bearer, so the example uses the requests library instead of the OpenAI SDK. The questions field is an object: you choose the key of each question, and the answers come back under the same keys.
The example asks three things about a support ticket: whether the customer reports a wrong charge, which team should take it and how soon the customer needs an answer. The first request after a quiet period can take more than two minutes or return 503. For that reason the code sets a 180-second timeout and, on a 503, waits for the Retry-After time before it tries again.
Python example that sends a noul, a choice and a score question to saanora/clara-1 and sets unclear answers aside for a person. Replace llmtr-your_key with your own key.
import time
import requests
URL = "https://llmtr.com/v1/systemone"
HEADERS = {"Authorization": "Bearer llmtr-your_key"}
NOUL_NO, NOUL_YES = 0.1, 0.9
TEAM_MIN_CONFIDENCE = 0.7
TODAY_NO, TODAY_YES = 0.2, 0.8
TICKET = (
"Customer wrote: I was charged twice for the March invoice "
"and nobody answered my two emails. I need this fixed today."
)
QUESTIONS = {
"wrong_charge": {
"type": "noul",
"instructions": "Does the customer report a wrong charge?",
"criteria": {
"true": "A charge is duplicated, unexpected or has the wrong amount",
"false": "The customer disputes no amount",
},
},
"team": {
"type": "choice",
"instructions": "Which team should handle this ticket?",
"criteria": {
"billing": "Payments, invoices and refunds",
"technical": "Errors and outages",
"sales": "Pricing and new accounts",
"other": "None of these teams",
},
},
"urgency": {
"type": "score",
"instructions": "How soon does the customer need an answer?",
"criteria": ["can wait a week", "this week", "today", "within the hour"],
},
}
def ask(state):
body = {"model": "saanora/clara-1", "state": state, "questions": QUESTIONS}
for attempt in range(3):
response = requests.post(URL, headers=HEADERS, json=body, timeout=180)
if response.status_code != 503 or attempt == 2:
break
time.sleep(int(response.headers.get("Retry-After", "30")))
response.raise_for_status()
return response.json()
result = ask(TICKET)
answers = result["answers"]
review = []
p_yes = answers["wrong_charge"]["noul"]
if NOUL_NO < p_yes < NOUL_YES:
review.append("wrong_charge")
team = answers["team"]
if team["choice"] == "other" or team["confidence"] < TEAM_MIN_CONFIDENCE:
review.append("team")
levels = answers["urgency"]["probabilities"]
p_today = levels["2"] + levels["3"] # today or within the hour
if TODAY_NO < p_today < TODAY_YES:
review.append("urgency")
if review:
print("send to a person:", review)
else:
print("wrong_charge:", p_yes >= NOUL_YES)
print("team:", team["choice"])
print("today_or_sooner:", p_today >= TODAY_YES)
print("input_tokens:", result["usage"]["input_tokens"])
The three question types: noul, choice and score
Give every question a type and an instructions field. Use the question key to match the answer, not to carry meaning: put the whole question into instructions and word it so that the record alone can answer it. Each question is evaluated independently of the others.
- noul is for yes-or-no questions. The criteria field is optional; one sentence each for true and false makes clear what counts as a yes.
- In a choice question, the criteria object maps each option key to a short description. A question takes 2 to 255 options. Add an option such as other for records that fit nothing on the list, or the model returns the closest one.
- For a score question, list at least 2 levels in the criteria array, lowest first. Saanora's documentation recommends yes/no or choice whenever the decision can be phrased that way.
Reading the probabilities
The response has model, answers and usage fields. The answers object is keyed by your question keys, and the field you read depends on the question type.
- The noul field is the probability that the answer is yes. The probability of no is 1 minus that value.
- A choice answer names the selected key in the choice field and gives a probability for every option in the probabilities field; together they add up to 1.
- The confidence of a choice answer is not the top probability itself. Saanora's formula is (top probability - 1/n) / (1 - 1/n), where n is the number of options. The result is 0 when the options are equally likely and 1 when one option holds all the probability. With four options, a top probability of 0.70 gives a confidence of 0.60, and a 0.70 limit that you put on confidence corresponds to a probability of 0.775.
- A score is the average of the level numbers, weighted by their probabilities. Numbering starts at 0, and the result need not be a whole number. The legend field maps the numbers to your level names, and the confidence of a score answer is the probability of the most likely level.
- An average can hide how the probability is spread across the levels. Add up neighbouring levels instead. In the example, today plus within the hour is the probability that the customer needs an answer today or sooner.
How do you choose a confidence threshold?
You do not send a threshold with the request; you apply it in your code. If you store the answers, you can try different thresholds on the same results without sending new requests.
One detail of noul changes how you pick it. According to Saanora's documentation, Clara always takes a side on a yes-or-no question: noul is at most 0.199 or at least 0.801, never in between. Any threshold from 0.2 to 0.8 therefore gives the same result as 0.5. To separate clear answers from borderline ones, put the threshold above 0.8. The example uses a two-sided band: 0.9 and above counts as yes, 0.1 and below counts as no, and everything in between goes to a person.
The numbers in the code are starting points, not a recommendation for your data. Saanora advises setting thresholds on a few hundred labeled records before Clara acts unattended. Send records whose correct answers you know, with the same question wording you will run in production. For each threshold, check how many records would be handled automatically, how many of those would be right and what would be missed. Choose per question, because a ticket routed to the wrong team and a wrong charge that slips through do not cost the same. Review your thresholds again when you reword a question or change its options.
Sending low-confidence cases to a person
Treat the review queue as part of the flow. In the example, if even one question meets its review condition, no decision is applied automatically and the ticket goes to a person. Store that person's decision next to the model's answers so that you can revisit your thresholds with those records later. Route these cases to the same queue:
- Records that are not in English: check the language in your own code and set these aside without sending them to the model.
- Requests that get no answer: the example raises an error if all three attempts end in 503 or if another error comes back. Catch it in production, so that an undecided ticket does not land in a default team.
- Long records: a state longer than about 16,000 tokens is read with its middle shortened. Remove boilerplate and send the fields your questions need; if you cannot shorten what matters, leave the record to a person.
- Steps that are hard to undo: you can require approval for actions such as a refund or an account closure even when the answer passes the threshold.
Limits and price
The state is counted once per request, so group the questions about one record into a single request. The billed count is in the usage.input_tokens field; if it shows 600, for example, the request costs $0.00006. This model is provided through a third-party provider.
| Topic | Behaviour on LLMTR |
|---|---|
| Endpoint | POST https://llmtr.com/v1/systemone |
| Question types | noul, choice and score |
| Questions per request | at most 32; more returns 422 provider_error |
| Choice options and score levels | 2 to 255 for choice, at least 2 for score |
| Context | 16,384 tokens |
| Long state | past about 16,000 tokens the middle is shortened |
| Input | plain text or a JSON object; no images, audio or files |
| Language | English records and questions |
| Request body | at most 1 MB |
| Client timeout | at least 180 seconds |
| Price (per 1M tokens) | $0.10 input; output is not billed |
A thresholded decision flow with the Saanora Clara API
Send an English record and typed questions to saanora/clara-1, compare the probabilities with your thresholds and set unclear cases aside for a person.
- Key. Create an API key on llmtr.com, top up your balance and put your key where the example says llmtr-your_key.
- Request. Send a JSON body with saanora/clara-1 as the model, plus an English state and your questions, to https://llmtr.com/v1/systemone.
- Routing. Compare each answer with the threshold you chose for that question, and send the ticket to a person if any answer is unclear.
Frequently asked questions
Can you use Clara on records that are not in English?
Records and questions for Clara must be in English. Set records in other languages aside without sending them to the model and route them to a person.
Does a noul threshold of 0.7 behave differently from 0.5?
According to Saanora's documentation, noul is at most 0.199 or at least 0.801, so every threshold from 0.2 to 0.8 gives the same result. To separate borderline answers, keep the threshold above 0.8, for example at 0.9.
How is a Clara request billed?
Input costs $0.10 per 1M tokens and output is not billed. The state is counted once. The token count of a request is in the usage.input_tokens field of the response.