> ## 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 or /v1/decisions, 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.

Three models answer here: `typesafe-ai/jev`, `convaiinnovations/laya` and
`supersoniclabs/julia-1`. They take the same request and return the same shape, so switching
between them is a one-word change. OpenAI's `openai/gpt-6-luna-decisions` answers the same
kind of question on its own wire, `POST /v1/decisions` — see
[OpenAI Decisions](#openai-decisions) below.

## 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. |
| `box` | `box` (`top`, `bottom`, `left`, `right` as fractions of the image), `confidence`. | None. Finds where something is in an image; `typesafe-ai/jev-1.14.0` only. |

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"]`.

| Model | Input | Output | Token budget |
| - | - | - | - |
| `typesafe-ai/jev` | \$0.042 / M | free | \~32,000 |
| `typesafe-ai/jev-latest` | \$0.042 / M | free | \~32,000 |
| `typesafe-ai/jev-1.14.0` | \$0.042 / M | free | \~32,000 |
| `typesafe-ai/jev-1.13.0` | \$0.042 / M | free | \~32,000 |
| `convaiinnovations/laya` | free | free | 8,192 |
| `convaiinnovations/laya-multilingual` | free | free | 8,192 |
| `supersoniclabs/julia-1` | \$0.025 / M | free | 8,192 |

`convaiinnovations/laya` is free in both directions — we host it ourselves, so there is no
per-token cost to pass on. It still needs an API key and a funded account, and its calls still
appear in your usage with their token counts, at zero credits. Neither model charges for the
`usage.output_tokens` it reports. On `/v1/systemone` the
response `model` names the concrete version that answered — `jev-1.13.0` from TypeSafe, and
`laya-<version>/<checkpoint>` from Laya, and `julia-1/<revision>` from Julia. Results and charges appear in the same
[request log](https://impossibl.com/docs/request-logs.md) and usage ledger as other API calls.

### Pinning a Jev version

Four ids serve Jev, on the same endpoint and at the same price:

| Model | Resolves to | Reach for it when |
| - | - | - |
| `typesafe-ai/jev` | the newest stable Jev release | You want the short id and are happy to move with TypeSafe. |
| `typesafe-ai/jev-latest` | the newest stable Jev release | Your code already uses TypeSafe's own spelling. Identical to `typesafe-ai/jev`. |
| `typesafe-ai/jev-1.14.0` | that exact version, always | You want TypeSafe's newest release, which it still ships as a preview, before it becomes the stable default. |
| `typesafe-ai/jev-1.13.0` | that exact version, always | Confidence thresholds are tuned to a version and a release must not move them. |

The two rolling ids follow TypeSafe's `jev-latest` alias, so the answers behind them can
change when TypeSafe ships without any change on your side. The response `model` always names
the concrete version that answered (`jev-1.13.0`), as TypeSafe's own API does — log it to know
which model produced a result, and pin that id once a result matters.

### Images, box questions and long context

Jev reads images and, on `typesafe-ai/jev-1.14.0`, answers `box` questions. TypeSafe ships both
as experimental, so each request that uses them must send the
`TypeSafe-Danger-Zone-Images: true` header, which is passed through to TypeSafe. List each
image once in a top-level `assets` map, keyed by a reference string, and write that reference
wherever the image belongs in `state`, `instructions` or `criteria`:

```json theme={null}
{
  "model": "typesafe-ai/jev-1.14.0",
  "state": { "photo": "7f3a0c1e-photo" },
  "assets": {
    "7f3a0c1e-photo": { "type": "image", "format": "png", "data_base64": "iVBORw0KGgo..." }
  },
  "questions": {
    "mug": { "type": "box", "instructions": "the coffee mug in `photo`" }
  }
}
```

Images can also arrive as `multipart/form-data` (the JSON in a part named `request`, each
image as a file part named by its asset's `part`), which is what the TypeSafe SDKs send. Images
are billed as input tokens, like the rest of the request. See TypeSafe's
[images guide](https://docs.typesafe.ai/images) for the formats and size limits.

A state over the default budget returns `400` `max_tokens_exceeded`. Send
`TypeSafe-Danger-Zone-Long-Context: true` to raise every Jev id to 262k tokens, at the same
price per token; TypeSafe notes it is slower and less accurate than staying within the default.

### Choosing a Laya checkpoint

`convaiinnovations/laya` routes to one of Laya's checkpoints for you, and it decides by
**script rather than language**. Text in a Latin script is treated as English, so Spanish,
Portuguese, French, German, Turkish and Vietnamese are all answered by the English
checkpoint; only non-Latin scripts — Japanese, Chinese, Cyrillic, Arabic — reach the
multilingual one on their own.

If your text is not English, send `convaiinnovations/laya-multilingual` instead. It pins the
multilingual checkpoint whatever the script, and it is the only way to reach those weights
from a Latin-script language. Everything else about it is identical: same endpoint, same
request, same price, same 8,192 budget.

The choice changes answers, so it is worth testing both on your own data rather than
assuming. On one fixed English question the two checkpoints returned P = 0.149 and 0.091.

Part of the budget is reserved for the question and its options rather than the state — about
1,000 tokens on Laya — so a long document plus a `choice` with many options can truncate before
the total is reached. Note also that a bigger budget is not a better decision: Laya's encoders
were pretrained at 8,192, but its decision head was fine-tuned at 512/1024, so on long inputs
the extra context can dilute the signal rather than sharpen it.

Laya is smaller, cheaper and faster, and it is strongest when the label space is small; it
gets noticeably worse as a `choice` grows past roughly twenty options, and — this part
matters — its confidence stays high while it does. Measure both on your own labels before
gating anything on either one's confidence.

### Writing questions for Julia

`supersoniclabs/julia-1` compares the options you give it, so the wording of each option does
most of the work. Give every `choice` option a short descriptive sentence ("Billing and
payment disputes, refunds") rather than a keyword, and always send `criteria` on a `noul`:

```json theme={null}
"churn": {
  "type": "noul",
  "instructions": "Is this customer likely to churn?",
  "criteria": { "false": "The customer is satisfied and will stay", "true": "The customer threatens to leave or cancel" }
}
```

With those descriptions it is decisive; without them a `noul` falls back to the literal words
"false" and "true" and is close to useless. A `choice` takes 2 to 20 options, and a request
that does not fit the 8,192 budget is refused with `400` rather than truncated. Do not use it
to identify a language: it answers English for Portuguese and Spanish text with near-total
confidence.

## OpenAI Decisions

`openai/gpt-6-luna-decisions` is GPT-6 Luna served through OpenAI's Decisions API.
`POST /v1/decisions` mirrors that API exactly, so the official OpenAI SDK works by pointing
`OPENAI_BASE_URL` at `https://api.impossibl.com/v1`. Its wire differs from System One: an
`input` instead of a `state`, a `questions` array where each question carries a unique
`name`, and `predicate` in place of `noul`.

```bash theme={null}
curl https://api.impossibl.com/v1/decisions \
  -H "Authorization: Bearer $IMPOSSIBL_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "openai/gpt-6-luna-decisions",
    "input": "I was charged twice this month and I want a refund now!!",
    "questions": [
      { "type": "predicate", "name": "is_angry", "instructions": "Is the customer angry?" },
      {
        "type": "choice", "name": "route", "instructions": "Which team should handle this?",
        "choices": [
          { "value": "billing", "description": "Payments, refunds" },
          { "value": "tech", "description": "Bugs" }
        ]
      },
      {
        "type": "score", "name": "urgency", "instructions": "How urgent is this?",
        "levels": [
          { "label": "low", "description": "Can wait" },
          { "label": "high", "description": "Needs action now" }
        ]
      }
    ]
  }'
```

```json theme={null}
{
  "model": "gpt-6-luna",
  "answers": [
    { "type": "predicate", "name": "is_angry", "probability": 0.95 },
    {
      "type": "choice", "name": "route", "choice": "billing", "confidence": 1.0,
      "probabilities": [{ "value": "billing", "probability": 1.0 }, { "value": "tech", "probability": 0.0 }]
    },
    {
      "type": "score", "name": "urgency", "score": 0.9, "confidence": 0.85,
      "probabilities": [{ "value": 0, "label": "low", "probability": 0.1 }, { "value": 1, "label": "high", "probability": 0.9 }]
    }
  ],
  "usage": { "input_tokens": 396, "output_tokens": 0, "total_tokens": 396 }
}
```

`input` can also be user messages with `input_text` and `input_image` parts; images must be
base64 data URLs. A question the model declines comes back as `{ "type": "refusal", "name": ... }`.
Billing is input tokens only: $0.10 / M up to 272K input tokens and $0.20 / M above, with
output, cache reads and cache writes free. OpenAI's own validation errors (for example a
`choice` with fewer than two options) are returned as `400`.

## Limits

`state` and `questions` are required, and `questions` must hold at least one entry. The state
and all questions share the model's token budget from the table above. A `choice` without
criteria, a `score` with fewer than two levels, or a `box` with criteria, returns `400` before
anything is sent upstream. A request TypeSafe itself refuses (an image without the opt-in
header, a state over the token budget) returns its status and message.

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 an evaluation model to a
chat, embeddings or rerank endpoint returns `400` with the correct `/v1/systemone` or
`/v1/decisions` destination.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.