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

# TypeSafe (Jev)

> Use TypeSafe's Jev models for typed judgments through the Prisma AIRS AI Gateway's /v1/decisions endpoint.

TypeSafe's Jev models return a typed judgment — a probability, a choice, or a score — instead of generated text. The AI Gateway routes these calls through `/v1/decisions`, a separate endpoint from chat completions, while still giving you the gateway's full feature set: authentication, routing, retries, circuit breaking, caching, logging, and cost tracking.

> [!NOTE]
>
> `/v1/decisions` does not support streaming. Only before-request [guardrails](https://docs.portkey.ai/docs/aigw/product/guardrails/decisions-guardrails.md) apply, scanning the content to judge only (`state`).

## Add Provider in Model Catalog

1. Go to [**Model Catalog → Add Provider**](https://stratacloudmanager.paloaltonetworks.com/).
2. Select **TypeSafe**.
3. Enter your [TypeSafe API key](https://typesafe.ai).
4. Name your provider (e.g., `typesafe`).

> [card] [Complete Setup Guide](https://docs.portkey.ai/docs/aigw/product/model-catalog.md)
>
> See all setup options and detailed configuration instructions

## Quick Start

TypeSafe uses the Jev request shape: `state` for the content to judge, and a `questions` map. Set `model` to `@integration-slug/model`. The integration holds the TypeSafe API key, so no provider headers are needed.

```bash cURL theme={"system"}
curl --request POST \
  --url https://aigw.portkey.ai/v1/decisions \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer $PORTKEY_API_KEY" \
  --data '{
  "model": "@your-typesafe-slug/jev-latest",
  "state": "I was charged twice for my order. Please return the extra charge.",
  "questions": {
    "refund_requested": {
      "type": "noul",
      "instructions": "Does the customer ask for a refund?"
    },
    "department": {
      "type": "choice",
      "instructions": "Which department should handle this complaint?",
      "criteria": {
        "billing": "Payments and refunds.",
        "technical": "Product problems.",
        "shipping": "Delivery and tracking.",
        "other": "All other requests."
      }
    },
    "severity": {
      "type": "score",
      "instructions": "How severe is this issue?",
      "criteria": [
        "Cosmetic: no lost functionality.",
        "Workaround available: a task fails, but another way works.",
        "Fully blocked: a task fails with no workaround."
      ]
    }
  }
}'
```

Response (values are illustrative):

```json theme={"system"}
{
  "model": "jev-1.13.0",
  "answers": {
    "refund_requested": { "type": "noul", "noul": 0.95 },
    "department": {
      "type": "choice",
      "choice": "billing",
      "probabilities": { "billing": 0.93, "technical": 0.03, "shipping": 0.01, "other": 0.03 },
      "confidence": 0.9
    },
    "severity": {
      "type": "score",
      "score": 1.1,
      "legend": {
        "0": "Cosmetic: no lost functionality.",
        "1": "Workaround available: a task fails, but another way works.",
        "2": "Fully blocked: a task fails with no workaround."
      },
      "probabilities": { "0": 0.1, "1": 0.7, "2": 0.2 },
      "confidence": 0.55
    }
  },
  "usage": { "input_tokens": 162, "output_tokens": 0 },
  "provider": "typesafe"
}
```

The OpenAI request shape (`input` and a `questions` array) also works. See [Request Shapes](https://docs.portkey.ai/docs/aigw/product/ai-gateway/decisions-api.md#request-shapes).

## Question Types

Each entry in `questions` picks a `type`, which determines the shape of its answer:

| Type | Use for | Answer shape |
| :- | :- | :- |
| `noul` | A yes/no-style judgment | `{ noul: <0–1 probability> }` |
| `choice` | Picking one label from a fixed set | `{ choice, probabilities, confidence }` |
| `score` | A graded position on a scale | `{ score, legend, probabilities, confidence }` |

`criteria` on a question defines the type-specific detail — for a `choice` question, the set of labels to choose from.

## Model

`model` defaults to `jev-latest` if omitted. Pin a specific version (e.g. `jev-1.13.0`) for reproducible judgments across a TypeSafe model upgrade.

## Pricing

TypeSafe bills on input tokens only — output tokens (the typed judgment itself) are free. Usage is reported in the response's `usage.input_tokens` / `usage.output_tokens`.

## Next Steps

> [card] [Guardrails for Decisions](https://docs.portkey.ai/docs/aigw/product/guardrails/decisions-guardrails.md)
>
> Scan `state` before it reaches the model

> [card] [Gateway Configs](https://docs.portkey.ai/docs/aigw/product/ai-gateway.md)
>
> Add retries, fallbacks, and caching

> [card] [Observability](https://docs.portkey.ai/docs/aigw/product/observability.md)
>
> Monitor and trace your decisions requests


## Related topics

- [OpenRouter](https://docs.portkey.ai/docs/aigw/integrations/llms/openrouter.md)
- [Guardrails for Decisions Requests](https://docs.portkey.ai/docs/aigw/product/guardrails/decisions-guardrails.md)
- [Enterprise Gateway](https://docs.portkey.ai/docs/changelog/enterprise.md)
- [Decisions](https://docs.portkey.ai/docs/aigw/product/ai-gateway/decisions-api.md)
- [Universal API](https://docs.portkey.ai/docs/aigw/product/ai-gateway/universal-api.md)


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