Skip to main content
The Decisions API returns a typed judgment instead of generated text. Send the content to judge and a set of questions. The model returns one typed answer per question. Use it for classification, routing, scoring, and yes/no checks, where a structured answer is needed and not free text.
/v1/decisions does not support streaming. A stream parameter in the request is ignored.

Quick Start

Set model to @integration-slug/model. The integration holds the provider credentials, so no provider headers are needed. Request shape depends on the provider. Workers AI (Cloudflare), TypeSafe, and OpenRouter use the Jev shape. OpenAI and Azure OpenAI use the OpenAI shape. The examples below are the same three questions in each shape.
Responses follow the shape of the request (values are illustrative):
Either shape works with any provider. See Switching Shapes.

Supported Providers

Any provider accepts either request shape. The AI Gateway converts the request to the provider’s native shape and converts the answers back. See Switching Shapes.

Request Shapes

The shape is detected from the body. A body that mixes fields from both shapes, or matches neither, returns 400.

Question Types

Each question sets a type. The type sets the shape of the answer: A score is the probability-weighted average of the level indices, so it can fall between levels.

Refusals

Any question can come back as { "type": "refusal" } while other questions in the same request still return answers. In the OpenAI shape the refusal also carries the question name. Check each answer’s type before reading its result. The AI Gateway also returns a refusal for a question the provider returned no answer for, when converting a Jev-shaped answer to the OpenAI shape.

Response Shapes

Every response includes provider, the slug that served the request.

Switching Shapes

The AI Gateway converts between shapes, so one request body works across providers. To fail over between a Jev provider and an OpenAI-native one, keep the same text-only body and switch the model per target.
Fallback config
Conversion rules:
  • Jev state that is an object or array is JSON-stringified into input.
  • noul criteria are appended to the question’s instructions, since a predicate has no criteria field.
  • OpenAI input is flattened to text for Jev providers. Only input_text parts are kept.
  • Unnamed questions are keyed q0, q1, and so on.
Jev providers return a 400 for requests they cannot serve:
  • input_image parts. Jev is text-only.
  • safety_identifier.
  • Duplicate question name values, since names become response keys.

Errors

Upstream errors return the standard AI Gateway error shape. The message is prefixed with the provider slug, and provider is included:
A 200 response from the provider without an answers field also returns an error, not an empty result.

Gateway Features

Decisions requests go through the same gateway as other endpoints:
  • Routing — Retries, fallbacks, load balancing, and circuit breaking through Configs
  • Caching — Simple and semantic caching
  • Guardrails — Before-request checks on the content to judge only: state in the Jev shape, or the text in input in the OpenAI shape. See Guardrails for Decisions
  • Observability — Logs, cost tracking, and analytics in Observability

API Reference

TypeSafe

Provider setup and pricing

API Reference

Decisions API reference

Universal API

All API formats

Guardrails for Decisions

Scan the content to judge before it reaches the model
Last modified on November 2, 2026