# Decisions

**Last updated:** 2026-11-15T13:17:19-03:00 (UTC-3)

Decision models answer typed questions about a text: "is the customer asking for a refund?" (yes/no), "what is the tone?" (choice), "how urgent is it, from 1 to 5?" (score). Instead of asking a chat model for JSON and hoping it comes back right, you get probabilities and validated labels.

There are three formats on the market, and the gateway serves all three:

| Route | Format | Key scope | Flag |
| --- | --- | --- | --- |
| `/v1/decisions` | OpenAI Decisions: `input` and a list of `questions` | `route:decisions` | `openai_decisions` |
| `/v1/systemone` | System One: `state` and a map of `questions` | `route:systemone` | `systemone_decisions` |
| `/v1beta/decisions` | Gemini Decisions: `input` and a map of `questions` (see [Gemini Decisions](#gemini-decisions)) | `route:gemini_decisions` | `gemini_decisions` (off by default) |

With `decision_translation` (which requires `systemone_decisions`), the gateway converts between the first two: a client written for OpenAI Decisions can use a System One model, and vice versa. Gemini Decisions is served natively only. The flags give no one access: the key still needs the route scope and the alias.

## Supported providers

| Provider | How to configure | Upstream format | Notes |
| --- | --- | --- | --- |
| OpenAI | protocol `openai` | Decisions | An image goes as an `input_image` part |
| TypeSafe (Jev) | preset `typesafe` (`TYPESAFE_API_KEY`) | System One | The only one with images and `box` questions |
| OpenRouter | preset `openrouter_decisions` (`OPENROUTER_API_KEY`) | System One | Automatic Jev pricing |
| Cloudflare Workers AI | protocol `cloudflare_ai` | System One | Clef models (`clef`, `clef-flash`, `clef-omni`) |
| vLLM Semantic Router | preset `vllm_sr` (`VLLM_SR_API_KEY`) | System One | Free; read the privacy notice below |

Model discovery fills the connection's catalog: `jev-latest` and `jev-preview` on TypeSafe, `vllm-sr/d3-*` on vLLM Semantic Router.

## How to turn it on

```yaml
features:
  systemone_decisions: true
  openai_decisions: true
  decision_translation: true      # only if you want to convert between formats
providers:
  - {id: typesafe, preset: typesafe}
models:
  - id: jev
    capabilities: [systemone, decisions]   # decisions here uses the translation
    targets: [{provider: typesafe, model: jev-latest}]
```

Declare on the alias the capabilities you offer the client. The gateway does not infer them from the model name.

## How to use it

OpenAI format, against any alias with the `decisions` capability:

```bash
curl http://localhost:8080/v1/decisions \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model": "jev",
       "input": "I want my money back, the product arrived broken",
       "questions": [{"type": "predicate", "name": "refund",
                      "instructions": "Is the customer asking for a refund?"}]}'
```

System One format, with an image and localization (`box`), only on TypeSafe directly:

```json
{"model": "jev", "state": "Customer photo: {img1}",
 "assets": {"{img1}": {"type": "image", "format": "png", "data_base64": "<base64>"}},
 "questions": {"color": {"type": "choice", "instructions": "Which color dominates?", "criteria": {"red": "red", "blue": "blue"}},
               "object": {"type": "box", "instructions": "Locate the object"}}}
```

- Images and `box` require the `TypeSafe-Danger-Zone-Images: true` header. The gateway forwards that header, and `TypeSafe-Danger-Zone-Long-Context: true`, only to TypeSafe.
- The `box` response returns `top`, `bottom`, `left` and `right` as fractions of the image, plus `confidence`.
- TypeSafe rejects small images: a 64×64 PNG returns 400 "Invalid image dimensions".
- In the console, **API reference** shows ready-made examples of both formats.

## Pricing

- **Jev:** automatic on TypeSafe and OpenRouter, $0.042 per million input tokens and zero for output, read from OpenRouter's public catalog. No price book needed.
- **vLLM Semantic Router:** free according to the provider's page, and the gateway prices it at zero with that page as the source.
- The `usage` reported by the provider is preserved; the gateway does not make up costs.

> **Privacy on vLLM Semantic Router.** The provider warns that it may log requests and responses to improve its models. Do not use these aliases with sensitive data.

## Gemini Decisions

Google's Gemini Decisions API (launched 2026-11-11, API version `v1beta`) answers with `gemini-decision-1`: up to 1,000 keyed questions about one shared input, scored in one pass with no generated text. The gateway serves it at `POST /v1beta/decisions`, the path the Gemini SDKs call (`client.decisions.create` with `api_version` `v1beta`), so an SDK pointed at the gateway works unchanged.

```yaml
features:
  gemini_decisions: true            # off by default
providers:
  - {id: gemini, preset: gemini}    # GEMINI_API_KEY
models:
  - id: decide
    capabilities: [gemini_decisions]   # alone on the alias
    targets: [{provider: gemini, model: gemini-decision-1}]
keys:
  - id: support-app
    scopes: [route:gemini_decisions]
    allowed_models: [decide]
```

The alias must declare `gemini_decisions` alone and target the Gemini API (the preset's host, or a base URL ending in `/v1beta`); Vertex AI does not serve the API yet, and validation refuses such a target. The key goes in `Authorization: Bearer` or `x-goog-api-key`, never in `?key=` (`400`).

```bash
curl http://localhost:8080/v1beta/decisions \
  -H "x-goog-api-key: $GATEWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model": "decide",
       "input": "The blue mug I ordered on Monday arrived cracked on Wednesday.",
       "questions": {
         "is_damaged": {"type": "noul", "instructions": "Did the item arrive damaged?"},
         "tone": {"type": "choice", "instructions": "What is the tone?",
                  "criteria": {"calm": "neutral or polite", "angry": "upset or hostile"}},
         "urgency": {"type": "score", "instructions": "How urgent is a reply?",
                     "criteria": ["low", "medium", "high"]}}}'
```

```json
{"answers": {
   "is_damaged": {"type": "noul", "noul": 0.99, "confidence": 0.99},
   "tone": {"type": "choice", "choice": "angry", "probabilities": {"angry": 0.7, "calm": 0.3}, "confidence": 0.7},
   "urgency": {"type": "score", "score": 1.6, "probabilities": {"0": 0.1, "1": 0.2, "2": 0.7}, "legend": {"0": "low", "1": "medium", "2": "high"}, "confidence": 0.7}},
 "usage": {"total_input_tokens": 100, "input_tokens_by_modality": [{"modality": "text", "tokens": 100}], "total_output_tokens": 0, "total_tokens": 100}}
```

The gateway checks the request against Google's documented limits before any call (`400 invalid_decision` otherwise), and forwards it with only `model` replaced; the answer is relayed as received.

| Field | Accepted |
| --- | --- |
| Top level | `model`, `input` and `questions` only |
| `input` | A non-empty string, or content blocks: `{"type": "text", "text"}`, or `image`, `audio`, `video`, `document` (PDF) with exactly one of `data` (base64) or `uri` (https, fetched by Google) and `mime_type`; `resolution` (`low`, `medium`, `high`; `ultra_high` images only) on images and videos |
| `questions` | 1 to 1,000, keyed `[A-Za-z0-9_-]{1,64}` |
| Instructions | Required text: a string, a text block or a list of text blocks |
| `noul` | Optional `criteria` with `true_description` and `false_description` |
| `choice` | `criteria` mapping 2 to 255 option IDs (1-128 characters, at most 512 bytes, no control characters, no leading or trailing space) to a description or `null` |
| `score` | `criteria`, 2 to 255 non-empty ordered levels (index `i` scores `i`) |

Any `uri` on the Gemini API host (`generativelanguage.googleapis.com`, where Files API URIs live, whatever the path spelling) is refused with `422 file_uri_unsupported`: it names a file in the Google project every team shares; public objects such as `storage.googleapis.com` URLs are accepted. A body that repeats a member name at any depth is refused (`400 invalid_request`), whatever the policies, so the gateway and Google always read the same request. The 262,144-token context and the inline-data size limits are Google's; the request body limit is the gateway's (8 MiB by default, up to 64 MiB per alias with `models[].max_request_body_mib`). Google answers a safety block with `400` and no answers; the gateway relays it.

**Pricing.** Google bills US$0.10 per million input tokens, every modality alike, and nothing for output; the shared input is billed once however many questions the request asks. The community catalogs do not list `gemini-decision-1` yet, so approve its rate in the [price book](/docs/features/price-book-management/):

```yaml
price_book:
  - provider_id: gemini
    model_id: gemini-decision-1
    input_per_million: "0.1"
    output_per_million: "0"
    effective_from: "2026-11-11T00:00:00Z"
    source_url: https://aistudio.google.com/docs/pricing
```

With [usage valuation](/docs/features/usage-valuation/) on, an answer is valued from `usage.total_input_tokens`; it stays `unknown` when the usage reports output, cached, thought or tool tokens, grounding calls, a modality split that does not add up or a `total_tokens` that is not input plus output, and when the answer was blocked (`prompt_feedback.block_reason`) or has no `answers`. Analytics and request logs record the operation as `gemini_decisions`.

**Budgets and token limits** (`quota_native_protocols`, with an approved quota rate) admit text input only: the reservation is the request's bytes, which bound the shared input and every question's instructions and criteria, at the input price, and settles from the same usage. Image, audio, video and PDF input is refused under them (`media_input_not_bounded`): its tokens follow Google's tiling and duration rules, unknown before the call.

**No Chat Completions mapping.** The gateway does not offer `gemini-decision-1` on `/v1/chat/completions` and does not translate Gemini Decisions to or from the OpenAI Decisions and System One routes. A chat answer is generated text: it would lose the per-option probabilities, the 0-1 confidence and the keyed answers of up to 1,000 questions in one call, and a client would be back to parsing labels out of text, which is what a decision model avoids. Use the native route.

## How translation works

Translation only converts what can be preserved without losing meaning. The gateway prepares all targets before the first call; if any of them would require discarding information, the request returns `422 decision_translation_unsupported`, without spending anything.

| Input | Accepted in translation |
| --- | --- |
| Envelope | Only `model`, `input`/`state` and `questions` |
| `input` (OpenAI) | Non-empty text |
| `state` (System One) | Text; an object; or an array of objects, which becomes an `input_json` part |
| Questions | 1 to 64, each with an explicit text instruction |
| Predicate / noul | Direct probability conversion; noul with `criteria` stays native only |
| Choice | 2 to 255 values (string or boolean) or text criteria |
| Score | 2 to 10 ordered levels, with text labels and descriptions |

Conversion guarantees:
- **Types preserved.** The boolean `true` and the string `"true"` stay distinct, and the response returns exactly the type requested. Different spellings of the same value (`"a"` and `"\u0061"`) are duplicates, and the request is rejected.
- **Order and names preserved.** In OpenAI → System One, internal IDs (`q000`, `c000`) keep the order and the public name; they never reach the client. In System One → OpenAI, question names stay the same.
- **Nothing made up.** The gateway does not inject generic instructions or turn criteria into a prompt prefix. If the question depends on that, use the native format.
- **Structured input** up to 256 KiB, 32 nesting levels and 10,000 values, with exact integers (never passed through floating point).

The translated response is read and validated in full (up to 8 MiB) before any byte goes to the client: model, number and identity of the answers, types, probabilities between 0 and 1, scores within the levels. `null` does not become a score of zero. An invalid response becomes an upstream error or a fallback to the next target, always before the first byte.

## Limits

Outside translation (valid in the native format, when the provider supports them):
- structured or multi-part instructions, multiple messages, images, `box`, tools, streaming and typed extraction;
- fields with no equivalent, such as `safety_identifier` and cache options;
- structured or null System One criteria, single-level Choice/Score and `noul.criteria`;
- an OpenAI refusal when the client expects System One: there is no matching type.

Other limits:
- **Media:** images and `box` go only to TypeSafe directly. For Cloudflare, OpenRouter, vLLM Semantic Router or a translated target, the request returns 422 before the call. OpenRouter used to accept an image and ignore it; that is why the gateway rejects it.
- **Cloudflare:** the gateway builds the `/ai/run/@cf/cloudflare/{clef|clef-flash|clef-omni}` path and validates the success envelope before converting.
- **Credentials:** the client's key never reaches the upstream.
- A well-formed response proves neither quality nor equivalence between models.

## See also

- [Capabilities and routes](/docs/features/capabilities/): where `decisions` and `systemone` fit in.
- [Circuit breaker](/docs/features/resilience/): it applies to decisions too.
- [Inference flags](/docs/reference/inference-flags/).
- External references: [OpenAI Decisions](https://developers.openai.com/api/reference/resources/decisions/methods/create), [TypeSafe OpenAPI](https://api.typesafe.ai/openapi.json), [Cloudflare Clef](https://developers.cloudflare.com/workers-ai/models/clef/).
