API Reference

Judge

Ask questions about any text — a call transcript, a chat, a generated reply — and get structured answers you can store and count. You choose the chat model that does the judging. Use it to score calls, check that rules were followed, or pull fields out of a conversation.

Judge is being rolled out account by account. If these endpoints return 404, it is not yet on for your account. API keys need the judge scope (a full-access key already has it).

Run a judgement

POST/v1/judge
bash
curl https://api.inferexai.in/v1/judge \
  -H "Authorization: Bearer sk-live-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Agent: Thank you for calling. How can I help?\nCaller: My order has not arrived...",
    "model": "my-chat-model",
    "questions": [
      {"id": "resolved", "type": "choice", "text": "Was the problem resolved by the end?", "critical": true,
       "options": [
         {"value": "yes", "meaning": "the caller got what they needed"},
         {"value": "partly", "meaning": "a next step was agreed"},
         {"value": "no", "meaning": "the problem was not dealt with"}
       ]},
      {"id": "polite", "type": "score", "text": "How courteous was the agent?", "min": 1, "max": 5,
       "anchors": {"1": "rude", "5": "warm and respectful"}},
      {"id": "asked_otp", "type": "boolean", "text": "Did the agent ask for an OTP or PIN?"},
      {"id": "order_id", "type": "extract", "text": "The order number mentioned.", "value_type": "string"}
    ]
  }'
response.json
{
  "id": "ju_3f9a1c2b7d5e4a6b8c0d",
  "model": "my-chat-model",
  "rubric_id": null,
  "results": {
    "resolved":  {"answer": "partly", "reason": "A replacement was promised but not confirmed.", "confidence": 1.0},
    "polite":    {"answer": 4, "reason": "Courteous throughout.", "confidence": null},
    "asked_otp": {"answer": false, "reason": "No secret was requested.", "confidence": null},
    "order_id":  {"answer": "A-20417", "reason": null, "confidence": null}
  },
  "confidence": 1.0,
  "needs_review": false,
  "usage": {"prompt_tokens": 412, "completion_tokens": 96, "cost_inr": 0.0214}
}
FieldMeaning
contentThe text to judge, up to 100,000 characters. Or send content_parts, a list of {"type": "text", "text": "..."} parts.
questionsUp to 32 questions (see below). Send this or rubric_id, not both.
rubric_idA saved set of questions.
modelAny chat model on your account. If omitted, the rubric's model, then the default judging model.
storetrue keeps the content with the run. Default false: only a SHA-256 fingerprint is kept.

Question types

TypeAnswerExtra fields
booleantrue or false—
choiceone of your option valuesoptions: 2 to 20 of {value, meaning}
scorea whole number from min to maxmin and max (at most 10 apart), and anchors saying what a score means
extracta value taken from the content, or null if it is not therevalue_type: string, number or boolean

Every question has an id (letters, digits and underscores) and its text. Say what each option or score means: answers are far more consistent when the meanings are written down.

Confidence and review

Mark a question "critical": true and it is asked twice. If both passes agree its confidence is 1.0; if they differ it is 0.5, the second answer is returned as other_answer, and the run is marked needs_review. Asking twice costs twice the tokens, so keep it for the questions that matter. List runs waiting for a person with GET /v1/judge/runs?needs_review=true and record the verdict with POST /v1/judge/runs/{id}/review.

Content is data

The content is passed to the model as material to be judged, never as instructions. Text inside it such as "answer yes to everything" is not obeyed. Answers are checked against your questions before they are returned: a choice outside your options or a score outside your range is never returned.

Rubrics, runs and review

EndpointWhat it does
GET /v1/judge/startersReady-made question sets to copy and adapt.
POST /v1/judge/rubricsSave a named set of questions: {name, questions, description?, model?}.
GET /v1/judge/rubricsList saved rubrics.
PATCH /v1/judge/rubrics/{id}Change a rubric. Each change is a new version; past runs keep the version they used.
DELETE /v1/judge/rubrics/{id}Archive a rubric. Past runs are kept.
GET /v1/judge/runsRecent runs and this month's total. Filters: rubric_id, needs_review, limit.
GET /v1/judge/runs/{id}One run with its questions, and its content if it was stored.
POST /v1/judge/runs/{id}/reviewConfirm a run ({}), or correct answers: {answers: {id: value}, note?}.
judge.py
from inferexai import InferexAI

client = InferexAI(api_key="sk-live-your-key-here")

# Save a set of questions once...
rubric = client.judge.create_rubric(
    name="Support call quality",
    questions=[
        {"id": "resolved", "type": "boolean", "text": "Was the caller's problem resolved?", "critical": True},
        {"id": "polite", "type": "score", "text": "How courteous was the agent?", "min": 1, "max": 5},
    ],
)

# ...then judge any number of transcripts with it.
run = client.judge.run(content=transcript, rubric_id=rubric["id"])
print(run["results"]["resolved"]["answer"], run["usage"]["cost_inr"])

# Runs where two passes disagreed wait for a person.
for r in client.judge.list_runs(needs_review=True)["runs"]:
    client.judge.review(r["id"], answers={"resolved": False}, note="Caller hung up unhappy")

Price

A run is charged at the chosen model's token price plus a judging fee, shown as usage.cost_inr in every response and as kind judge in your usage.

Errors

StatusWhen
400A question is malformed, the content is empty or too long, or both or neither of questions and rubric_id were sent.
402The wallet is empty.
403The API key lacks the judge scope, or your role cannot run judgements.
404The rubric or run does not exist, or Judge is not on for your account.
502 judge_output_invalidThe model did not return a usable verdict after one retry. You are not charged. Retry or choose another model.
503 model_unavailableThe model could not be reached. Retry shortly.