# Gemini Decisions API vs. TypeSafe Jev vs. Cloudflare Clef: System One Routing in Production

> Source: <https://codingcat.dev/post/gemini-decisions-api-vs-jev-vs-clef>
> Published: 2026-11-14 18:00:00+00:00

# Gemini Decisions API vs. TypeSafe Jev vs. Cloudflare Clef: System One Routing in Production

If you are still calling a frontier reasoning model with `response_schema` just to check a content guardrail or route a support ticket into one of five queues, you are paying a massive latency and compute tax for work that does not require text generation. Autoregressive decoding was built to write essays and synthesize code token by token, not to flip a boolean switch on your hot path.

With Google's launch of the [**Gemini Decisions API**](https://blog.google/innovation-and-ai/technology/developers-tools/gemini-decisions-api/) (`gemini-decision-1`) alongside [**TypeSafe AI's Jev**](https://typesafe.ai) (` jev-1.14`) and [** Cloudflare's Clef**](https://huggingface.co/Cloudflare/clef) (`@cf/cloudflare/clef`), "System One" discriminative models have officially graduated from a niche startup thesis into a standard layer of the modern AI stack. Instead of generating JSON strings character by character, these models evaluate a shared payload against typed questions in a **single forward pass**, bill **zero output tokens**, and return calibrated probabilities in roughly **100ms to 250ms**.

Let's break down why structured outputs on generative LLMs hit an architectural wall at scale, why all three providers converged on the exact same `noul`, `choice`, and `score` primitives, and how to wire `gemini-decision-1` into a real TypeScript media pipeline.

## Why Structured Outputs Are Overkill for Routing

Over the last two years, constrained decoding (`response_schema`, `response_format`, and tool-forced JSON schemas) became the default hammer for every classification nail in production. Need to check if an incoming prompt violates policy, classify user intent across six product pillars, and rate urgency from 1 to 5? Most teams serialize a JSON schema, call a frontier LLM, and `JSON.parse()` the response.

Under the hood, that workflow is wildly inefficient for closed-set decisions:

1. **Sequential Token Decoding Overhead** : Even when constrained by a finite-state grammar, an autoregressive LLM still runs sequential decoding passes to emit`{` ,`"` ,`r` ,`o` ,`u` ,`t` ,`e` ,`"` ,`:` ,`"` ,`b` ,`i` ,`l` ,`l` ,`i` ,`n` ,`g` ,`"` ,`}` . If the model has an active reasoning or "thinking" budget enabled by default, it may burn hundreds of hidden reasoning tokens before emitting that first curly brace.
2. **Output Token Billing Multipliers** : Generative APIs charge 3x to 8x more per million output tokens than input tokens. When you evaluate 25 rubric checks against a single document, verbose JSON keys and enum labels compound your bill on every request.
3. **Question Cross-Contamination** : When an autoregressive model generates Field B*after* generating Field A in the same JSON object, its own sampled tokens for Field A condition the probability distribution of Field B. Changing the key order in your schema can silently shift your classification accuracy.
4. **Uncalibrated Binary Guessing** : Asking a chat model to output`{"is_safe": true}` forces a discrete sample. Unless you manually wrangle raw token`logprobs` across multi-token strings, your application cannot tell the difference between a rock-solid`0.99` certainty and a coin-flip`0.51` guess.

| Architectural Dimension | Generative LLM ( `response_schema` ) | System One Decision Model ( `noul` /`choice` /`score` ) | Why It Matters on the Hot Path | 
|---|---|---|---|
| **Inference Pass** | Prefill + `N` sequential decode steps | **Single forward pass** (prefill + parallel scoring head) | Latency stays flat whether you ask 1 question or 100 questions. | 
| **Typical End-to-End Latency** | `600ms to 2,500ms+` | `100ms to 250ms` | Fits comfortably inside synchronous API gateways and edge middleware. | 
| **Output Token Cost** | `$0.40 to $15.00` / 1M output tokens | `$0.00` (zero output tokens generated) | Eliminates output token billing completely. | 
| **Multi-Question Independence** | Later JSON fields attend to earlier generated fields | **Strict question isolation** in a single pass | Reordering questions never mutates individual answers. | 
| **Uncertainty Signal** | Discrete string ( `"true"` or`"billing"` ) | **Calibrated probabilities (**`0.0` **to** `1.0`**) +** `confidence` | Enables deterministic threshold routing in TypeScript. | 

## Shared "System One" Primitives: `noul`, `choice`, and `score`

Borrowing Daniel Kahneman's cognitive framing, **System Two** models deliberate step by step over open-ended reasoning problems, while **System One** models make fast, instinctive, bounded judgments over a known state.

**TypeSafe AI** pioneered this exact API contract with **Jev** (named after 19th-century economist William Stanley Jevons and the *Jevons Paradox*: when you make machine decisions orders of magnitude faster and cheaper, total demand for automated evaluation explodes rather than shrinks). When Cloudflare launched **Clef** in October 2026 and Google followed with **Gemini Decision 1** in November 2026, neither company invented a proprietary wrapper format. Both adopted TypeSafe's three core typed question primitives almost verbatim:

### 1. `noul` (Calibrated Boolean Probability)

Why is a yes/no check called a `noul` instead of a `bool`? TypeSafe named the primitive as a nod to a **Bernoulli trial** (confirmed by TypeSafe CEO Diogo Almeida): a random experiment with exactly two possible outcomes, parameterized by a continuous probability `p` in `[0.0, 1.0]`.

A `bool` gives you `true` or `false`. A `noul` evaluates a proposition against your input state and returns the calibrated probability that the statement holds (for example, `0.982`), alongside a `confidence` score.

### 2. `choice` (Unordered Categorical Routing)

Used when picking one winner from a closed, unordered set of options (such as intent classification, tool selection, or department routing). You pass a dictionary mapping option keys to plain-English criteria, and the model returns the winning `choice`, a normalized `probabilities` map across every option summing to `1.0`, and a `confidence` metric.

### 3. `score` (Ordered Rubric Evaluation)

Used when grading an input against an ordered scale from lowest to highest (such as incident severity, audio clarity, or lead quality). Unlike `choice`, `score` understands ordinal rank. In `gemini-decision-1`, you define `2` to `255` ordered rubric level descriptions (indexed starting at `0`), and the API returns both per-level `probabilities` and a continuous, probability-weighted expected `score`:

That continuous expected value is gold for ranking feeds or sorting queues without ties, because an item with an 80% chance of Level 2 and a 20% chance of Level 3 (`2.20`) cleanly outranks an item with an 80% chance of Level 2 and a 20% chance of Level 1 (`1.80`).

### Tuning Thresholds Instead of Trusting Hallucinations

Because System One models are explicitly post-trained for **probability calibration** (when the model predicts `0.85`, that proposition holds roughly 85% of the time on held-out distributions), your application code regains deterministic control over risk. Instead of praying a prompt tweak stops false positives, you implement explicit three-band routing:

- **Auto-Execute (`noul >= 0.85` and `confidence >= 0.80`)** : Route the ticket, approve the clip, or fire the webhook immediately in ~180ms.
- **Escalate to System Two (`0.20 < noul < 0.85` or `confidence < 0.80`)** : Ambiguous edge case detected. Forward only this 10% to 15% slice of traffic to Gemini 2.5 Pro, Claude, or a human reviewer.
- **Auto-Reject (`noul <= 0.20` and `confidence >= 0.80`)** : Drop spam, block policy violations, or skip expensive downstream processing immediately.

## Head-to-Head Comparison: Gemini Decision 1 vs. TypeSafe Jev vs. Cloudflare Clef

While all three models speak the same conceptual `noul` / `choice` / `score` language, their underlying backbones, modality support, context ceilings, and licensing models target very different parts of your architecture.

| Dimension | Gemini Decision 1 ( `gemini-decision-1` ) | TypeSafe Jev ( `jev-1.14` ) | Cloudflare Clef ( `@cf/cloudflare/clef` ) | 
|---|---|---|---|
| **Licensing & Hosting** | Proprietary managed API (Google AI Studio / Gemini API `v1beta` , includes free prototyping tier) | Proprietary managed API ( `api.typesafe.ai` ) | **Apache 2.0 Open Weights** (`Cloudflare/clef` on Hugging Face) + serverless**Cloudflare Workers AI** | 
| **Model Architecture** | Native Gemini multimodal discriminative prefill + isolated parallel scoring | Custom non-autoregressive System One decision architecture | **27B parameters** post-trained on`Qwen/Qwen3.8-27B` + custom joint schema transformer head (plus 9B`clef-flash` sibling) | 
| **Supported Input Modalities** | **Text, Images, Raw Audio, Video, and Multi-Page PDFs** | Text, structured JSON, and Images (PNG/JPEG) + experimental spatial `box` primitive | Text, structured JSON, and Images / sampled video frames (via Qwen3.8 vision encoder) | 
| **Context Window** | `262,144` **tokens (**`256K`**)** standard | `64,000` **tokens** per request (`32,768` per question) default;`262,144` **tokens** opt-in via header | `65,536` **tokens (**`65k`**)** | 
| **Max Questions per Request** | Up to `1,000` **isolated questions** | **Token-budget-bound** (no hard question cap within context limit) | Up to `64` **typed questions** | 
| **Typical Latency** | `150ms to 250ms` | `70ms to 250ms` | `120ms to 300ms` (Workers AI edge GPUs) | 
| **Pricing per 1M Input Tokens** | `$0.10` (`$0` output tokens) | `$0.042` (`$0` output tokens) | `$0.24` on Workers AI (`$0` output tokens) or**compute-only** self-hosted | 

## Working TypeScript Example: Multimodal Podcast Clip Triage with `@google/genai`

Let's look at a real production workflow we run into constantly on **CodingCat.dev**: triaging incoming raw **Podcast Episode** segments and short-form video clips.

Historically, evaluating a 90-second MP4 or MP3 clip required a brittle three-stage chain: upload audio to an object bucket, run speech-to-text transcription (losing vocal tone, crosstalk, and on-screen code context), and finally feed the transcript into an LLM with a JSON schema. Because `gemini-decision-1` is natively multimodal, we can pass the raw audio or video bytes directly alongside episode metadata and evaluate sponsor safety (`noul`), topic pillar routing (` choice`), and viral Shorts potential (` score`) in a single ~200ms forward pass.

Install the current Google GenAI SDK:

Here is the complete, copy-pasteable TypeScript module:

### Calling the Raw REST Endpoint at the Edge (`fetch`)

If you are running inside a lightweight edge isolate where you prefer zero SDK dependencies, the exact same payload posts directly to `https://generativelanguage.googleapis.com/v1beta/decisions` using the `x-goog-api-key` header:

Notice how clean the failure and latency profile is here: there is no markdown code-fence stripping, no broken JSON repair loop, and no surprise 4-second latency spike when a reasoning model decides to overthink a simple yes/no check.

## Architectural Verdict: Which System One Model Should You Pick?

Because all three models share the `noul`, `choice`, and `score` mental model, migrating between them takes less than an afternoon of adapter code. Pick your primary engine based on your payload modalities, hosting constraints, and request fan-out:

| Scenario | Recommended Model | Architectural Rationale | 
|---|---|---|
| **High-Volume Text/JSON & Spatial Boxes** | **TypeSafe Jev (**`jev-1.14`**)** | Lowest input cost on the market ( `$0.042` / 1M tokens), blazing sub-150ms text/JSON throughput, unbounded question fan-out within your token budget, and unique`box` bounding-box localization on images. | 
| **Cloudflare Edge Stack or Self-Hosted VPC** | **Cloudflare Clef (**`@cf/cloudflare/clef`**)** | Zero-egress `env.AI.run()` binding directly inside Cloudflare Workers and Hono, plus**Apache 2.0 open weights** (`Cloudflare/clef` 27B and`clef-flash` 9B) that you can run on your own vLLM GPU clusters with zero per-token API fees. | 
| **Multimodal Payloads & Massive Policy Rubrics** | **Gemini Decision 1 (**`gemini-decision-1`**)** | Only System One model that natively ingests **raw audio, video, and multi-page PDFs** without upstream transcription or OCR pipelines, while evaluating up to**1,000 isolated questions** over a`256K` window at`$0.10` / 1M tokens. | 

### The Real Win: Pairing System One with System Two

The sharpest architectural move in late 2026 is not replacing frontier reasoning models: it is **putting a System One gatekeeper in front of every System Two call**.

When a `$0.042` to `$0.10` per-million-token decision pass absorbs 85% of routine routing, moderation, and rubric scoring in 180ms, and uses calibrated `confidence` thresholds to escalate only genuinely ambiguous 15% edge cases to a heavy reasoning model, your p95 latency drops by an order of magnitude and your monthly inference bill plummets. Stop paying essay writers to flip switches.

## how this post connects together.

Follow AJ from first principles to production-ready architecture.

## Watch the Related Video Deep Dive: Cloudflare Agents, Durable Objects & Stateful Workflows in TypeScript

Build stateful, long-running AI agents and resilient multi-step workflows using the Cloudflare Agents SDK, Durable Objects with embedded SQLite, WebSockets hibernation, and Workflows.

[View Full Page →](https://codingcat.dev/course/cloudflare-agents-durable-workflows-typescript)
