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

# Jev Decisions

> Native TypeSafe Jev Choice, Score and Noul parameters, structured inputs, responses and pricing.

Jev is a structured decision model from TypeSafe. Send application state and named questions to receive classifications, scores or yes/no probabilities synchronously, rather than generated chat text.

`POST https://api.mixroute.ai/typesafe/v1/systemone`

Use a MixRoute API Key in `Authorization: Bearer $MIXROUTE_API_KEY` with `Content-Type: application/json`. Keep the native TypeSafe body structure: model, state and questions. Do not wrap it in metadata or use chat messages or asynchronous task polling.

## Supported Models

| Model                                         | Request IDs                 |
| --------------------------------------------- | --------------------------- |
| [Jev 1.13](/en/model-api/typesafe/jev-1.13.0) | `jev-1.13.0` / `jev-latest` |

`jev-1.13.0` is the pinned version ID and `jev-latest` is the latest stable alias. Both currently call Jev 1.13: one model, not two separate models. The latest alias may move with future releases; pin the version when stability matters and inspect response model for the version used.

Use only the exact model IDs available through your account's [model list](/en/api-reference/endpoint/list-models).

## Choosing a Question Type

| Type     | Purpose                                                                          | Main Answer Fields                               |
| -------- | -------------------------------------------------------------------------------- | ------------------------------------------------ |
| `choice` | Select one predefined option, such as a ticket category.                         | `choice`, `probabilities`, `confidence`          |
| `score`  | Rate an ordered descriptive scale, such as issue severity.                       | `score`, `legend`, `probabilities`, `confidence` |
| `noul`   | Estimate whether one proposition is true, such as whether a refund is requested. | `noul`                                           |

## Top-Level Parameters

| Field       | Type                    | Requirement | Description                                                                                                                                                                                                  |
| ----------- | ----------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model`     | string                  | Required    | jev-1.13.0 or jev-latest. Pin a version when alias updates would affect your integration.                                                                                                                    |
| `state`     | string / object / array | Required    | Content evaluated by every question. Use text, an application record or a conversation array. The root cannot be null, a number or a boolean; nested JSON can retain numeric and boolean application fields. |
| `questions` | object                  | Required    | Nonempty question map, not an array. Each key is your question\_id and each value is a question object.                                                                                                      |

Question IDs map requests to answers and are not shown to the model. Put the actual question in instructions, not only in its ID. Multiple questions are evaluated independently against the same state and can mix all three types. If one question depends on another answer, compose separate calls in your application.

## Question Parameters

The following fields belong inside questions\[question\_id]. Explicitly provide instructions for each question, describing one clear decision.

### Choice Classification

| Field              | Type                           | Requirement | Description                                                                                                       |
| ------------------ | ------------------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------- |
| `type`             | string                         | Required    | Must be choice.                                                                                                   |
| `instructions`     | string / object / array        | Recommended | Explain what to select. Organize complex guidance as an object or array.                                          |
| `criteria`         | object                         | Required    | Map of 1-255 option names to descriptions, not an options array. Both names and descriptions inform the decision. |
| `criteria[option]` | string / object / array / null | Per option  | Description of this option; use null when the name is sufficiently clear.                                         |

The returned choice is an option with the highest probability. probabilities includes every option and sums to approximately 1. Include other or insufficient\_information when some inputs may not fit the named categories.

### Score Rating

| Field          | Type                    | Requirement | Description                                                                                                                                                                       |
| -------------- | ----------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`         | string                  | Required    | Must be score.                                                                                                                                                                    |
| `instructions` | string / object / array | Recommended | Describe one dimension to rate, such as severity.                                                                                                                                 |
| `criteria`     | array                   | Required    | Nonempty ordered level descriptions, at most 10; at least two are recommended. Each item can be a string, object or array. Describe levels rather than using bare numeric labels. |

Level indices start at 0: three levels correspond to 0, 1 and 2. score is a probability-weighted position from 0 through the number of levels minus 1 and may be fractional; it is not always a 0-1 score. legend maps string indices back to the original descriptions, and probabilities uses the same indices. Consume the returned score without truncating it; choose an application rule if you need a discrete level.

### Noul Yes/No Evaluation

| Field            | Type                           | Requirement | Description                                                                          |
| ---------------- | ------------------------------ | ----------- | ------------------------------------------------------------------------------------ |
| `type`           | string                         | Required    | Must be noul.                                                                        |
| `instructions`   | string / object / array        | Recommended | One yes/no question or proposition; higher values mean a stronger yes/true judgment. |
| `criteria`       | object / null                  | Optional    | Optional guidance for yes and no; when omitted, instructions defines the judgment.   |
| `criteria.true`  | string / object / array / null | Optional    | What counts as yes/true.                                                             |
| `criteria.false` | string / object / array / null | Optional    | What counts as no/false.                                                             |

The returned noul is a probability from 0 to 1, not a boolean: near 1 favors true, near 0 favors false and near 0.5 indicates uncertainty. Noul has no separate confidence field and does not measure degree; use Score for a graded judgment.

## Input and Context Limits

| Item                  | Limit                                                                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Input modality        | Text only. Supply text strings or JSON objects/arrays containing text and application data; convert images, audio and video to text first. |
| Total request context | At most 64k tokens across state and all questions combined.                                                                                |
| Per-question context  | At most 32k tokens for state plus the longest individual question; the total request limit must also be met.                               |
| Choice                | At most 255 options per question; criteria must not be empty.                                                                              |
| Score                 | At most 10 levels per question; criteria must not be empty. Use at least two distinct levels for meaningful scoring.                       |

Text, instructions and criteria all consume context. Questions share the state, but each question still increases total input. Provider-published rate limits do not define a MixRoute account entitlement; use your account limits.

## Request Example

Set the server-side MIXROUTE\_API\_KEY environment variable. This request mixes all three question types.

```bash theme={null}
curl --request POST "https://api.mixroute.ai/typesafe/v1/systemone" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "jev-latest",
  "state": "I was charged twice for order 123. Please refund the duplicate charge today.",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which team should handle this request?",
      "criteria": {
        "billing": "Duplicate charges, payments and refunds",
        "technical": "Broken software and integration issues",
        "shipping": "Shipment delivery and tracking"
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How time-sensitive is the request?",
      "criteria": [
        "No deadline; routine request",
        "Needs attention within a week",
        "Explicitly requires action today"
      ]
    },
    "duplicate_charge": {
      "type": "noul",
      "instructions": "The customer was charged twice for the same order.",
      "criteria": {
        "true": "Explicit duplicate payment for the same order",
        "false": "No duplicate payment is mentioned"
      }
    }
  }
}'
```

## Response Example

```json theme={null}
{
  "model": "jev-1.13.0",
  "answers": {
    "department": {
      "type": "choice",
      "choice": "billing",
      "confidence": 1,
      "probabilities": {
        "technical": 0,
        "billing": 1,
        "shipping": 0
      }
    },
    "urgency": {
      "type": "score",
      "score": 2,
      "confidence": 1,
      "legend": {
        "0": "No deadline; routine request",
        "1": "Needs attention within a week",
        "2": "Explicitly requires action today"
      },
      "probabilities": {
        "0": 0,
        "1": 0,
        "2": 1
      }
    },
    "duplicate_charge": {
      "type": "noul",
      "noul": 0.9
    }
  },
  "usage": {
    "input_tokens": 447,
    "output_tokens": 70
  }
}
```

Probabilities and token counts illustrate the response format; values may vary across inputs or calls.

| Field                       | Type    | Requirement    | Description                                                                                                                                              |
| --------------------------- | ------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`                     | string  | Returned       | Version used for inference, which may differ from the requested alias.                                                                                   |
| `answers`                   | object  | Returned       | Answers keyed by the original question IDs; each type matches its question.                                                                              |
| `answers[id].type`          | string  | Returned       | choice, score or noul, matching the corresponding question type.                                                                                         |
| `answers[id].choice`        | string  | Choice         | Selected option name, taken from the request criteria keys.                                                                                              |
| `answers[id].probabilities` | object  | Choice / Score | Map of option names or level indices to probabilities; values are between 0 and 1 and sum to approximately 1.                                            |
| `answers[id].score`         | number  | Score          | Probability-weighted position on the level indices; may be fractional, with range defined by the number of criteria levels.                              |
| `answers[id].legend`        | object  | Score          | Map of string level indices to original criteria descriptions, preserving string, object or array descriptions.                                          |
| `answers[id].noul`          | number  | Noul           | Probability that the proposition is true, from 0 to 1; not a boolean.                                                                                    |
| `answers[id].confidence`    | number  | Choice / Score | 0-1 summary of certainty derived from the distribution. It is not a correctness guarantee and should not be equated with the largest option probability. |
| `usage.input_tokens`        | integer | Returned       | Billable input tokens for this evaluation.                                                                                                               |
| `usage.output_tokens`       | integer | Returned       | Output tokens used by the answers; currently free.                                                                                                       |

Set probability/confidence thresholds in your application and keep a review or clarification path for uncertain inputs. High confidence does not guarantee correctness; evaluate non-English tasks on your own application data.

## Structured Input

Use native JSON structures for state, instructions and descriptive criteria. This example combines object/array instructions with structured level descriptions.

```json theme={null}
{
  "model": "jev-1.13.0",
  "state": {
    "incident": {
      "feature": "export",
      "symptom": "CSV export always fails",
      "workaround": "Download JSON instead"
    },
    "customer_request": "Please fix this when convenient; no immediate deadline."
  },
  "questions": {
    "route": {
      "type": "choice",
      "instructions": {
        "question": "Which team owns the incident?",
        "field": "incident"
      },
      "criteria": {
        "engineering": {
          "covers": [
            "software errors",
            "broken export"
          ],
          "excludes": "billing"
        },
        "billing": [
          "payments",
          "refunds"
        ]
      }
    },
    "impact": {
      "type": "score",
      "instructions": [
        "Assess the functionality impact of incident only.",
        "Use the documented workaround when judging."
      ],
      "criteria": [
        {
          "description": "Cosmetic only",
          "examples": [
            "misaligned label"
          ]
        },
        [
          "A feature fails but a workaround is available"
        ],
        {
          "description": "Completely blocked and no workaround"
        }
      ]
    },
    "has_workaround": {
      "type": "noul",
      "instructions": {
        "question": "Does incident describe a usable workaround?"
      },
      "criteria": {
        "true": {
          "description": "A concrete alternative is provided"
        },
        "false": [
          "No alternative",
          "Explicitly no workaround"
        ]
      }
    }
  }
}
```

### Conversation Array

Pass conversation records as the state array. role/text here are application fields, not the Chat Completions message protocol.

```json theme={null}
{
  "model": "jev-1.13.0",
  "state": [
    {
      "role": "customer",
      "text": "Please check order 123. It was charged twice."
    },
    {
      "role": "agent",
      "text": "The duplicate charge has now been refunded."
    }
  ],
  "questions": {
    "refund_done": {
      "type": "noul",
      "instructions": "The agent says the duplicate charge has been refunded."
    },
    "shipment_lost": {
      "type": "noul",
      "instructions": "The conversation says a shipment was lost."
    }
  }
}
```

## Python

Requires Python 3 and requests. The example reads synchronous answers without task polling or automatic resubmission.

```python theme={null}
import json
import os
import requests

def evaluate_jev(payload):
    response = requests.post(
        "https://api.mixroute.ai/typesafe/v1/systemone",
        headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
        json=payload,
        timeout=60,
        allow_redirects=False,
    )
    request_id = response.headers.get("x-oneapi-request-id", "")
    try:
        result = response.json()
    except ValueError as exc:
        raise RuntimeError(
            f"HTTP {response.status_code}; request_id={request_id}; invalid JSON"
        ) from exc
    if not 200 <= response.status_code < 300:
        detail = result.get("detail", result) if isinstance(result, dict) else result
        raise RuntimeError(
            f"HTTP {response.status_code}; request_id={request_id}; detail={detail}"
        )
    if not isinstance(result, dict) or not isinstance(result.get("answers"), dict):
        raise RuntimeError("Invalid Jev response; request_id=" + request_id)
    if set(result["answers"]) != set(payload["questions"]):
        raise RuntimeError("Response question IDs do not match the request")
    return result

if __name__ == "__main__":
    payload = json.loads(r'''
{
  "model": "jev-latest",
  "state": "I was charged twice for order 123. Please refund the duplicate charge today.",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which team should handle this request?",
      "criteria": {
        "billing": "Duplicate charges, payments and refunds",
        "technical": "Broken software and integration issues",
        "shipping": "Shipment delivery and tracking"
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How time-sensitive is the request?",
      "criteria": [
        "No deadline; routine request",
        "Needs attention within a week",
        "Explicitly requires action today"
      ]
    },
    "duplicate_charge": {
      "type": "noul",
      "instructions": "The customer was charged twice for the same order.",
      "criteria": {
        "true": "Explicit duplicate payment for the same order",
        "false": "No duplicate payment is mentioned"
      }
    }
  }
}
''')
    result = evaluate_jev(payload)
    print(result["model"])
    print(result["answers"]["department"]["choice"])
    print(result["answers"]["urgency"]["score"])
    print(result["answers"]["duplicate_charge"]["noul"])
    print(result["usage"])
```

## JavaScript

Use Node.js 18+ with an ES module (.mjs). Keep the API Key server-side, not in browser code.

```javascript theme={null}
async function evaluateJev(payload) {
  const apiKey = process.env.MIXROUTE_API_KEY;
  if (!apiKey) throw new Error("Set MIXROUTE_API_KEY");
  const response = await fetch("https://api.mixroute.ai/typesafe/v1/systemone", {
    method: "POST",
    headers: {
      Authorization: "Bearer " + apiKey,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(payload),
    redirect: "error",
    signal: AbortSignal.timeout(60000),
  });
  const requestId = response.headers.get("x-oneapi-request-id") ?? "";
  let result;
  try {
    result = await response.json();
  } catch {
    throw new Error("HTTP " + response.status + "; request_id=" + requestId + "; invalid JSON");
  }
  if (!response.ok) {
    throw new Error("HTTP " + response.status + "; request_id=" + requestId +
      "; detail=" + JSON.stringify(result?.detail ?? result));
  }
  if (!result?.answers || typeof result.answers !== "object" || Array.isArray(result.answers)) {
    throw new Error("Invalid Jev response; request_id=" + requestId);
  }
  const requested = Object.keys(payload.questions).sort();
  const returned = Object.keys(result.answers).sort();
  if (JSON.stringify(requested) !== JSON.stringify(returned)) {
    throw new Error("Response question IDs do not match the request");
  }
  return result;
}

const payload = {
  "model": "jev-latest",
  "state": "I was charged twice for order 123. Please refund the duplicate charge today.",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which team should handle this request?",
      "criteria": {
        "billing": "Duplicate charges, payments and refunds",
        "technical": "Broken software and integration issues",
        "shipping": "Shipment delivery and tracking"
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How time-sensitive is the request?",
      "criteria": [
        "No deadline; routine request",
        "Needs attention within a week",
        "Explicitly requires action today"
      ]
    },
    "duplicate_charge": {
      "type": "noul",
      "instructions": "The customer was charged twice for the same order.",
      "criteria": {
        "true": "Explicit duplicate payment for the same order",
        "false": "No duplicate payment is mentioned"
      }
    }
  }
};
const result = await evaluateJev(payload);
console.log(result.model);
console.log(result.answers.department.choice);
console.log(result.answers.urgency.score);
console.log(result.answers.duplicate_charge.noul);
console.log(result.usage);
```

## Pricing and Usage

| Model                                  | Input / Million Tokens | Output / Million Tokens |
| -------------------------------------- | ---------------------- | ----------------------- |
| Jev 1.13 (`jev-1.13.0` / `jev-latest`) | \$0.042                | \$0                     |

These are base prices in USD. Current [Model Marketplace](https://console.mixroute.ai/models) pricing, account group multipliers and your bill determine actual charges. Input usage includes state and question definitions; more questions and options also add input tokens. `usage.output_tokens` can be nonzero even though output tokens are free.

Estimate cost from usage.input\_tokens times the input rate divided by 1,000,000, then apply the account multiplier. The platform settles each request in internal quota units, so rounding can produce small differences from an unrounded USD calculation.

For quota conversion, see [Authentication and Quota](/en/api-reference/system-api/authentication-and-quota).

## Response Handling

Check HTTP status before using the JSON result. Successful responses contain answers directly. Error detail may be a string, object or field-error array. Retain the x-oneapi-request-id response header for troubleshooting without logging the full API Key.

| Status        | Action                                                                                                                            |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `200`         | Read model, answers and usage; match results by question\_id.                                                                     |
| `400` / `422` | Check the model, field types, nonempty constraints, option/level counts and context length; correct the request before resending. |
| `401` / `403` | Check the MixRoute Key, model access and authentication headers.                                                                  |
| `429` / `529` | Rate limited or upstream overloaded. Honor Retry-After when present and use bounded backoff.                                      |
| `5xx`         | Inspect the error and keep the request ID; avoid unbounded resubmission.                                                          |

A network timeout does not prove the request was not executed. Resubmission creates a new evaluation and may incur another charge; control retries explicitly in your application.
