> ## Documentation Index
> Fetch the complete documentation index at: https://impossibl.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluation

> Ask typed yes/no, choice and score questions about any state on /v1/systemone, billed on input tokens.

Use `POST /v1/systemone` when you need a decision rather than prose: route a ticket, gate an
agent's action, score a document against a rubric. Send a `state` (a string, or structured
JSON) and a map of typed `questions`; the response returns one typed `answer` per question,
with probabilities and confidence your code can act on directly.

The endpoint mirrors TypeSafe AI's native System One API exactly. If you already use the
official TypeSafe SDK, point `TYPESAFE_BASE_URL` at `https://api.impossibl.com` and use your
impossibl key — no code changes.

## Evaluate a state

```bash theme={null}
curl https://api.impossibl.com/v1/systemone \
  -H "Authorization: Bearer $IMPOSSIBL_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "typesafe-ai/jev",
    "state": "Help! My payouts have been failing for 3 days.",
    "questions": {
      "is_urgent": { "type": "noul", "instructions": "Does this convey urgency?" },
      "dept": {
        "type": "choice",
        "instructions": "Which team should handle this?",
        "criteria": { "sales": null, "billing": "Payments, invoicing, refunds", "technical": "Bugs, outages" }
      },
      "frustration": {
        "type": "score",
        "instructions": "How frustrated is the customer?",
        "criteria": ["Calm", "Frustrated", "Very angry"]
      }
    }
  }'
```

The response has this shape; values depend on your input:

```json theme={null}
{
  "model": "jev-1.13.0",
  "answers": {
    "is_urgent": { "type": "noul", "noul": 0.95 },
    "dept": {
      "type": "choice", "choice": "billing", "confidence": 0.98,
      "probabilities": { "sales": 0.0, "billing": 0.99, "technical": 0.01 }
    },
    "frustration": {
      "type": "score", "score": 1.03, "confidence": 0.96,
      "legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" },
      "probabilities": { "0": 0.0, "1": 0.97, "2": 0.03 }
    }
  },
  "usage": { "input_tokens": 379, "output_tokens": 73 }
}
```

## Question types

Every question has a `type` and `instructions`. `instructions` — and every criteria value —
can be a string or JSON structure (object or array) when the content is already structured.

| Type     | Answer                                                                            | `criteria`                                                               |
| -------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `noul`   | `noul`: probability of yes, 0 to 1. No confidence field.                          | Optional `{ "true": "...", "false": "..." }` describing each side.       |
| `choice` | `choice`, `confidence`, `probabilities` over every option.                        | Required. Object of option → description (`null` when none is needed).   |
| `score`  | `score` (probability-weighted position), `confidence`, `legend`, `probabilities`. | Required. Array of at least two level descriptions, ordered low to high. |

Answers come back under the same ids you chose for the questions. Ask every question your
code might need in one request — they are evaluated in parallel and share one token budget.

## Models and billing

Discover supported models with `GET /v1/models`: evaluation models have
`output_modality: "evaluation"` and `endpoints: ["/v1/systemone"]`. `typesafe-ai/jev` is
billed at $0.042 per million input tokens ($42 per billion). The `usage.output_tokens`
TypeSafe reports are not charged. The response `model` names the concrete version that
answered (`jev-1.13.0`), as TypeSafe's own API does. Results and charges appear in the same
[request log](/docs/request-logs) and usage ledger as other API calls.

## Limits

`state` and `questions` are required, and `questions` must hold at least one entry. The
state and all questions share a budget of roughly 32,000 tokens (about 150,000 characters of
English). A `choice` without criteria, or a `score` with fewer than two levels, returns `400`
before anything is sent upstream.

Evaluation is non-streaming and uses the gateway's provider credentials (there is no BYOK
path). Requests require an API key and sufficient credits. Sending this model to a chat,
embeddings or rerank endpoint returns `400` with the correct `/v1/systemone` destination.
