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

# Decisions

> Ask questions about some input and get typed answers using /v1/decisions.

Decision models answer typed questions about an input: the probability that something is true, which option fits, or where it lands on a rubric. Send an `input` and a list of `questions`; you get back one typed answer per question, in order.

## Endpoints

Bifrost serves decisions on three routes. Each one reaches **every** decision provider below; they differ only in the request and response shape, so pick the one that matches your client.

| Route | Shape | Use it from | Bare model name goes to |
| - | - | - | - |
| `POST /v1/decisions` | Bifrost's unified shape (this page) | `curl`, any HTTP client, the [Go SDK](https://docs.getbifrost.ai/quickstart/go-sdk/decisions.md) | A configured provider that serves it, picked by routing rules or the model catalog |
| `POST /openai/v1/decisions` | OpenAI's Decisions API | [OpenAI SDKs](https://docs.getbifrost.ai/integrations/openai-sdk/overview.md#decisions-api) | `openai` |
| `POST /typesafe/v1/systemone` | TypeSafe's System One API | [TypeSafe SDK](https://docs.getbifrost.ai/integrations/typesafe-sdk.md) | `typesafe` |

## Providers

Write models as `provider/model` to pick the provider explicitly. Switching providers only changes `model`.

| Provider | Example models | Bifrost endpoint | Images |
| - | - | - | - |
| [TypeSafe](https://docs.getbifrost.ai/providers/supported-providers/typesafe.md) | `typesafe/jev-latest`, `typesafe/jev-1.14.0` | `/v1/decisions`, or `/typesafe/v1/systemone` (TypeSafe's native API) | Yes, by reference (see [Images by Reference](#images-by-reference)) |
| [OpenAI](https://docs.getbifrost.ai/providers/supported-providers/openai.md#15-decisions) | `openai/gpt-6-luna` | `/v1/decisions`, or `/openai/v1/decisions` (OpenAI's native API) | Yes |
| [OpenRouter](https://docs.getbifrost.ai/providers/supported-providers/openrouter.md#decisions) | `openrouter/~typesafe/jev-latest` | `/v1/decisions` | Depends on the model |
| [Cloudflare](https://docs.getbifrost.ai/providers/supported-providers/cloudflare.md#4-decisions) | `cloudflare/clef`, `cloudflare/clef-flash`, `cloudflare/clef-omni` | `/v1/decisions` | Yes |
| [Perplexity](https://docs.getbifrost.ai/providers/supported-providers/perplexity.md#3-decisions) | `perplexity/pplx-decider-v1.1-27b`, `perplexity/pplx-decider-v1-27b` | `/v1/decisions` | Yes |
| [Ollama](https://docs.getbifrost.ai/providers/supported-providers/ollama.md#6-decisions) | `ollama/nimble`, `ollama/clef-flash`, `ollama/tev1:0.8b` | `/v1/decisions` | Yes, base64 only |
| [Azure](https://docs.getbifrost.ai/providers/supported-providers/azure.md#10-decisions) | `azure/Microsoft-Decision-1` (a key alias maps it to your deployment) | `/v1/decisions` | No |
| [Databricks](https://docs.getbifrost.ai/providers/supported-providers/databricks.md#decisions) | `databricks/ai_decide`, `databricks/system.ai.openjev-qwen35-4b`, `databricks/system.ai.typesafeai-jev-1-14-0` | `/v1/decisions` | System One models, by reference (see [Images by Reference](#images-by-reference)) |
| [vLLM](https://docs.getbifrost.ai/providers/supported-providers/vllm.md#decisions) | `vllm/clef-flash`, `vllm/d1-3b`, any loaded model | `/v1/decisions` | Depends on the model |
| [SGLang](https://docs.getbifrost.ai/providers/supported-providers/sgl.md#decisions) | `sgl/clef-flash`, `sgl/kev-4b`, any loaded model | `/v1/decisions` | Yes (Clef) |
| [Laya, Nimble](https://docs.getbifrost.ai/providers/self-hosted-decision-models.md) | `laya/english`, `nimble/nimble-latest` | `/v1/decisions` | No |

Every provider also answers on `/openai/v1/decisions` and `/typesafe/v1/systemone` when you send a `provider/model` name, so an OpenAI or TypeSafe SDK can reach any of them. Each provider page covers its setup.

Chat models (for example `openai/gpt-4o`) have no decisions endpoint. By default they return `400` with code `unsupported_operation`; with the compat setting `convert_decision_to_responses` on, Bifrost emulates the answer through the model's Responses API. See [Decision-to-Responses Emulation](https://docs.getbifrost.ai/features/compat-plugin.md#4-decision-to-responses-emulation).

## Basic Request

```bash theme={null}
curl --location 'http://localhost:8080/v1/decisions' \
--header 'Content-Type: application/json' \
--data '{
  "model": "typesafe/jev-1.13.0",
  "input": "Customer message: I was double charged and nobody replied to my two emails. I want a refund today.",
  "questions": [
    { "type": "predicate", "name": "is_frustrated", "instructions": "Is the customer frustrated?" },
    {
      "type": "choice",
      "name": "category",
      "instructions": "Pick the ticket category",
      "choices": [
        { "value": "billing", "description": "charges and refunds" },
        { "value": "bug", "description": "product defects" },
        { "value": "other", "description": "anything else" }
      ]
    },
    {
      "type": "score",
      "name": "urgency",
      "instructions": "Rate how urgently this needs a human reply",
      "levels": [
        { "label": "low", "description": "can wait a week" },
        { "label": "medium", "description": "should be answered soon" },
        { "label": "high", "description": "needs a reply today" }
      ]
    }
  ]
}'
```

## Input

`input` is what the questions are about. It takes one of four forms:

**Text**: a string.

```json theme={null}
"input": "Customer message: I was double charged and nobody replied."
```

**Messages**: an array of `{ "role", "content" }`. `content` is a string, or a list of parts. Use parts to send images:

```json theme={null}
"input": [
  {
    "role": "user",
    "content": [
      { "type": "input_text", "text": "Is this receipt itemized?" },
      { "type": "input_image", "image_url": "data:image/png;base64,iVBORw0KGgo...", "detail": "high" }
    ]
  }
]
```

* `image_url` is a base64 data URL or an `https` URL. Ollama reads base64 only.
* `detail` is optional: `low`, `high`, `auto`, or `original`.
* Parts are `input_text`, `input_image`, and `input_json` (`{ "type": "input_json", "data": { ... } }`, an object or an array) in user messages, and `output_text` and `refusal` in assistant messages. A provider that reads text only (Azure, Databricks' `ai_decide`, Laya, Nimble) rejects an image with a `400`, which lets a [fallback](#fallbacks) that reads images take the request. TypeSafe and Databricks' System One models read images by reference only, as below, and reject an inline image the same way. vLLM and SGLang v0.5.22 or later forward images to the model, which answers or returns its own `400`. SGLang v0.5.21 ignores images, so it can answer without them instead of returning a `400`.
* An `input_text` part's `text` is a string, or structured data (object or array) that System One models read as is and OpenAI receives as JSON text.

### Conversation History

To judge a conversation, send its messages together with the function calls, custom tool calls, and their outputs, in order. Each output names the call it answers by `call_id`:

```json theme={null}
"input": [
  { "role": "user", "content": "What's the weather in Paris?" },
  { "type": "function_call", "call_id": "call_1", "name": "get_weather", "arguments": "{\"city\":\"Paris\"}" },
  { "type": "function_call_output", "call_id": "call_1", "output": "18C and sunny" },
  { "role": "assistant", "content": [{ "type": "output_text", "text": "It's 18C and sunny in Paris." }] }
]
```

A tool output is a string, or a list of `input_text` and `input_image` parts. OpenAI's decision models read every item as sent. Other models read the conversation as JSON text, so an image in a tool output is rejected by a provider that reads text only, as an image in a message is.

### Images by Reference

TypeSafe places an image wherever its ID is written: in the input, inside a question's instructions, or in choice, score, and predicate criteria. Send each image as an `input_image` part with an `id` and the file base64-encoded in `data`, and write the `id` where the image belongs. The format is read from the bytes. A single message with one `input_text` part plus such parts sends that text as TypeSafe's state, so structured data stays structured:

```json theme={null}
"input": [
  {
    "role": "user",
    "content": [
      { "type": "input_text", "text": { "camera": "r-cam" } },
      { "type": "input_image", "id": "r-cam", "data": "/9j/4AAQ..." },
      { "type": "input_image", "id": "r-thumb", "data": "iVBORw0..." }
    ]
  }
]
```

Here `r-cam` is the evidence, and `r-thumb` can define a choice option (`{ "value": "thumbs_up", "description": "r-thumb" }`) without becoming part of the evidence. Bifrost adds the header TypeSafe requires for images. Images sent by reference work only with TypeSafe and Databricks' System One models; other providers reject them, including vLLM and SGLang, which would otherwise ignore the image and answer without it. See [TypeSafe: Images and Box](https://docs.getbifrost.ai/providers/supported-providers/typesafe.md#images-and-box).

To send the files as they are instead of base64, use a multipart request: the JSON goes in a part named `request`, each image in its own file part, and the image part names its file part with `name` instead of carrying `data`:

```bash theme={null}
curl http://localhost:8080/v1/decisions \
  -F 'request={
    "model": "typesafe/jev-1.14.0",
    "input": [{"role": "user", "content": [
      {"type": "input_text", "text": {"camera": "r-cam"}},
      {"type": "input_image", "id": "r-cam", "name": "camera-photo"}
    ]}],
    "questions": [{"type": "box", "name": "hand", "instructions": "the hand in `camera`"}]
  };type=application/json' \
  -F 'camera-photo=@camera.jpg;type=image/jpeg'
```

A `name` in a JSON request, a `name` with no matching file part, and a file part no image part names are each rejected with `400`.

**Structured data**: an object, sent to System One models (TypeSafe, Clef, Perplexity, Ollama, Azure, Databricks, vLLM, SGLang, Laya, Nimble) as is, and to OpenAI as JSON text.

```json theme={null}
"input": { "ticket_id": 4812, "message": "I was double charged.", "plan": "pro" }
```

**`null`**: no input. OpenAI rejects it with a `400`, Clef rejects it with a `422`, and Bifrost rejects it with a `400` for vLLM and SGLang, which would otherwise answer without evidence.

## Questions

| Field | Meaning |
| - | - |
| `type` | `predicate`: probability that a statement is true. `choice`: which option fits. `score`: a level on an ordered scale (may fall between levels). `box`: where the instructions' subject is in an image (TypeSafe Jev 1.14: `jev-preview`, `jev-1.14.0`) |
| `name` | Optional. Echoed on the answer so you can match it up |
| `instructions` | A string, or structured data (object or array): sent as is to System One models, as JSON text to OpenAI |
| `criteria` | Predicate only, optional: what `true` and `false` mean. Appended to the instructions for models without a criteria field |
| `choices` | Choice only: each option's `value` (string or boolean) and optional `description` |
| `levels` | Score only: the levels in order, each with a `label` and optional `description` |

`safety_identifier` (optional) is a stable end-user ID. It is sent to OpenAI, and to OpenRouter as `user`; other providers do not take one.

Provider-only fields, such as Laya's `min_confidence`, go at the top level of the body with the header `x-bf-passthrough-extra-params: true`.

## Response

```json theme={null}
{
  "model": "jev-1.13.0",
  "answers": [
    { "type": "predicate", "name": "is_frustrated", "probability": 0.98 },
    {
      "type": "choice",
      "name": "category",
      "choice": "billing",
      "confidence": 1,
      "probabilities": [
        { "value": "billing", "probability": 1 },
        { "value": "bug", "probability": 0 },
        { "value": "other", "probability": 0 }
      ]
    },
    {
      "type": "score",
      "name": "urgency",
      "score": 2,
      "confidence": 1,
      "probabilities": [
        { "value": 0, "label": "low", "probability": 0 },
        { "value": 1, "label": "medium", "probability": 0 },
        { "value": 2, "label": "high", "probability": 1 }
      ],
      "legend": { "0": "low: can wait a week", "1": "medium: should be answered soon", "2": "high: needs a reply today" }
    }
  ],
  "usage": { "prompt_tokens": 437, "completion_tokens": 72, "total_tokens": 509 }
}
```

There is one answer per question, in question order, with the question's `type`. A box answer carries `box`: its `top`, `bottom`, `left`, and `right` edges, each a fraction from 0 to 1 of the image measured from its top-left. `confidence`, `probabilities`, and `legend` appear when the model supplies them. A model that declines a question answers it with `"type": "refusal"`.

### Provider-Specific Fields

Some providers return extra fields. They appear only when that provider supplies them.

| Provider | Where | Fields |
| - | - | - |
| Laya | Answer | `answer_confidence` (calibrated probability of the reported answer), `action`, and, when `min_confidence` is set, `abstention` (`passed`, `abstained`, or `unevaluated`), `abstention_threshold`, `low_confidence` |
| Laya | Response | `routing`: the checkpoint that answered and why |
| Laya | `usage` | `state_tokens`, `state_tokens_dropped`, `truncated`, `truncated_questions` |

## Fallbacks

Add `fallbacks` to try other models in order when one fails, including when it rejects an input it cannot read (an image sent to TypeSafe, for example). Fallbacks can cross providers:

```json theme={null}
{
  "model": "typesafe/jev-latest",
  "fallbacks": ["cloudflare/clef-flash", "openai/gpt-6-luna"],
  "input": "Customer message: I was double charged and nobody replied to my two emails.",
  "questions": [
    { "type": "predicate", "name": "is_frustrated", "instructions": "Is the customer frustrated?" }
  ]
}
```

## Validation

Bifrost rejects these with a `400` before calling any provider:

* An unknown question `type`
* A `choice` question with no `choices`
* Two questions with the same `name`

The number of score levels is checked by each provider (TypeSafe, Azure and Databricks accept 2-10, Perplexity 1-10).

An input part one model cannot read fails only that attempt, so a fallback can still serve it. If every attempt fails, you get the first attempt's error.

## Map Form (Deprecated)

> [!WARNING]
>
> The map form is deprecated. It still works, but move to the request shape above.

Requests in the earlier map form are still served, and answered in the same form:

```json theme={null}
{
  "model": "typesafe/jev-1.13.0",
  "state": "Customer message: I was double charged and nobody replied to my two emails. I want a refund today.",
  "questions": {
    "is_frustrated": { "kind": "noul", "instructions": "Is the customer frustrated?" },
    "category": {
      "kind": "choice",
      "instructions": "Pick the ticket category",
      "criteria": { "billing": "charges and refunds", "bug": "product defects", "other": "anything else" }
    },
    "urgency": {
      "kind": "score",
      "instructions": "Rate how urgently this needs a human reply",
      "criteria": ["can wait a week", "should be answered soon", "needs a reply today"]
    }
  }
}
```

The response keys answers by question name, each with a `kind` and a `value`:

```json theme={null}
{
  "model": "jev-1.13.0",
  "answers": {
    "is_frustrated": { "kind": "noul", "value": 0.98 },
    "category": { "kind": "choice", "value": "billing", "confidence": 1, "probabilities": { "billing": 1, "bug": 0, "other": 0 } },
    "urgency": { "kind": "score", "value": 2, "confidence": 1, "probabilities": { "0": 0, "1": 0, "2": 1 } }
  }
}
```

Bifrost treats a body as the map form when `questions` is an object keyed by name instead of a list. A `state` sent alongside `input` is ignored.


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