What Are Cloudflare Clef Decision Models: The Beginner's Guide (Wiring One Into an AI Agent)

CodexFuse Team · 2026-11-03T12:49:26.939Z · 12 min read min read

What Is a Cloudflare Clef Decision Model, Exactly?

What are Cloudflare Clef decision models? They are open-weight AI models that answer your questions with probabilities instead of generating text. Cloudflare launched Clef and Clef-flash on October 1, 2026, as a new kind of model built for one job: making fast, cheap decisions inside software, especially AI agents. If you have read our Cloudflare Workers beginner guide, this is the model family that lets your Worker judge a situation instead of just reacting to it.

Here is the core idea. You hand Clef two things: a state (the situation, as text or JSON) and a schema of typed questions about that situation. Clef reads the state in a single prefill-only forward pass and returns a probability for every allowed answer of every question. There is no free-form text generation, no reasoning tokens, and no output parsing. You get numbers back, and your code branches on them. So what is a decision model, stripped to one sentence? A model that trades the ability to write for the ability to judge.

That sounds small, but it fixes one of the most annoying patterns in agent building: asking a chat model "should I do this?" and then writing fragile code to parse "Yes, I think you should proceed" out of a paragraph. A decision model skips the paragraph and gives you the answer as data.

How Is a Decision Model Different From a Regular AI Model?

A regular AI model generates: it writes text one token at a time, and you hope the text contains something your code can use. A decision model scores: it evaluates your fixed set of options in parallel and returns a probability for each one. The difference is prose versus numbers.

Take support-ticket routing. With a generative model you prompt "which team should handle this ticket?" and receive a sentence you must parse. With Clef you ask a typed choice question and receive billing: 0.08, technical: 0.91, sales: 0.01. The 0.91 is your routing decision, and the 0.08 tells you how uncertain the model is. No JSON mode, no regex, no "the model apologized instead of answering."

This is also why decision models are so fast. A generative model like the ones in our Claude Haiku 5.5 explainer spends most of its time and money emitting tokens. Clef never emits tokens at all. It reads your input once, scores the options, and stops. For the narrow job of judging, that is both cheaper and more reliable than generation.

The mental model comes from psychology: TypeSafe, the company behind the rival Jev decision model, named its product line "System One" after Daniel Kahneman's fast, intuitive thinking. Generative models are System Two, slow and deliberative. Decision models are System One, fast and instinctive. Agents need both.

Clef vs Clef-Flash vs Clef-Omni: Which One Do You Need?

Pick Clef-flash when speed and price matter most, Clef when the decision is hard, and Clef-omni when the decision needs eyes and ears. The short version is in the table; the details follow.

ModelBackboneContext windowMedian latency*Price per 1M input tokensReach for it when…
Clef27B, post-trained from Qwen3.8-27B (frozen backbone, rank-256 LoRA adapters)65,536 tokens209.3 ms$0.24the decision is hard: nuanced classification, fine-grained routing
Clef-flash9B, post-trained from Qwen3.5-9B24,576 tokens38.8 ms$0.038you need an answer in tens of milliseconds: guardrails, real-time gates
Clef-omni30B mixture-of-experts, 3B activecheck the docs pagecheck the docs page$0.15decisions need audio, video, or images as well as text (added Oct 9, 2026)

*Latency figures are Cloudflare's own, from 43 benchmark runs — vendor-reported, not independently reproduced.

On Cloudflare's own decision benchmarks, Clef leads 7 out of 10. The highlights: on BFCL case-exact, Clef-flash scores 98.76 and Clef 98.47 against Jev's 95.75; on BANKING77 intent classification, Clef reaches 94.20 macro-F1 versus Jev's 79.74; on CLINC150 with out-of-scope detection, Clef hits 97.43 against Jev's 89.27. But the same table keeps the vendors honest: Clef-flash scores only 66.77 on CLINC150+OOS, below Jev, and Jev wins the knowledge-heavy sets outright (GPQA Diamond, MMLU-Pro, BBH, When2Call). The pattern is consistent: decision models judge; they do not recall facts.

Clef vs Jev, in one paragraph

Jev is the decision model Clef is measured against. It comes from TypeSafe AI, launched in early access on September 15, 2026, founded by Diogo Almeida (formerly of OpenAI's InstructGPT team) with Erik Gafni and Sasha Sheng, and backed by a $40M seed round led by DCVC. Jev is text-only with a 32K context window on its hosted API, costs $0.042 per million input tokens with unmetered output, and ships no open weights. Clef is explicitly API-compatible with Jev, so code written against Jev's hosted API ports to Clef with minimal changes — which is exactly why Cloudflare benchmarks the two head to head.

What Kinds of Questions Can You Ask Clef?

Clef understands three typed question kinds, and everything else is just combinations of them. Each type returns probabilities, never prose.

TypeWhat you get backExample question
noulprobability of "yes""Is this refund request fraudulent?" → 0.93
choiceper-option probabilities plus a confidence score (2–255 options)"Which team owns this ticket?" → billing 0.08, technical 0.91, sales 0.01
scoreprobability-weighted score across 2–10 ordered levels, plus a legend"How severe is the outage?" → No impact / Minor / Major / Critical → 2.7

A single request can carry up to 64 questions and up to 4 images, so one call can triage, route, and score a situation all at once. The state itself can be text, JSON, images, or video, depending on the model.

How Do You Wire Clef Into an AI Agent?

If you came here asking how to use Cloudflare Clef, this is the section: you add the AI binding to a Worker, describe the situation as state, ask typed questions, and branch your agent's code on the probabilities. Five steps, and you have your first decision.

  1. Add the AI binding. In wrangler.jsonc, add "ai": { "binding": "AI" }. Your Worker now has env.AI ready to call models.
  2. Write the state. Describe the situation the agent faces, as text or JSON. Example: a refund request with the order total, the customer's history, and the reason they gave.
  3. Ask typed questions. Define the decisions: a noul question ("Is this refund request fraudulent?"), a choice question ("approve automatically, or escalate to a human?"), and a score question ("risk level 1 to 5").
  4. Call the model. One line does the whole job:
    const decision = await env.AI.run("@cf/cloudflare/clef-flash", {
      model: "clef-flash",
      state: "Refund request: order #4821, $189, customer since 2024, reason: item arrived damaged, photo attached.",
      questions: {
        fraud: { type: "noul", instructions: "Is this refund request fraudulent?" },
        route: { type: "choice", instructions: "How should this refund be handled?",
          criteria: { auto: "Approve automatically", human: "Escalate to a human agent" } },
        risk: { type: "score", instructions: "What is the fraud risk level?",
          criteria: ["None", "Low", "Medium", "High", "Critical"] }
      }
    });
    // decision.answers.fraud -> probability of fraud
    // decision.answers.route -> chosen route with per-option probabilities
    // decision.answers.risk  -> probability-weighted risk score
  5. Branch on the numbers. This is building agent guardrails with decision models: if the fraud probability is above your threshold, hold the refund for a human; otherwise approve it in code. The question "should my agent take this action?" gets answered in tens of milliseconds, before the action happens. A popular variant is generate-then-decide: your LLM generates a draft answer, Clef judges whether the evidence supports it, and your code enforces the verdict — a pattern one early builder used as a RAG evidence gate.

That last step is ai agent routing with decision models in its simplest form: the highest-probability option wins, and the runner-up's score tells you when to escalate to a human instead.

Not running on Workers? Workers AI decision models are also reachable over plain REST: POST https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/@cf/cloudflare/clef with your account ID and an API token. If you are already building agents with coding assistants, our Claude Code beginner guide pairs well with this — the agent writes the branching logic, Clef makes the judgment calls.

What Does Clef Cost to Run?

You pay for input tokens only; output is unmetered because there is no output text. The current per-model pricing, from the official Workers AI docs pages:

ModelPrice per 1M input tokens
Clef$0.24
Clef-flash$0.038
Clef-omni$0.15

Every Cloudflare account also gets 10,000 Neurons of Workers AI usage free per day, resetting at 00:00 UTC. On the free plan, going over the allocation fails with an error; on a paid plan, overage bills at $0.011 per 1,000 Neurons. Cloudflare does not publish how many Neurons a Clef call consumes, so there is no honest way to convert that free allocation into a number of decisions per day — treat any such figure you see elsewhere as a guess.

Two freshness notes, because this space moves fast. First, some launch-day coverage quotes $0.09 per million tokens for Clef-flash; the October 9 announcement cut it to $0.038, so always check the docs page, not old articles. Second, both models are listed with zero data retention, which matters if your agent handles customer data.

Where Do the Weights Live, and Can You Run Clef Yourself?

Yes. The weights are published on Hugging Face under the Cloudflare organization — Cloudflare/clef is live and verified — under the Apache 2.0 license. You can download them, fine-tune them, and run them on your own hardware.

One precision matters here: "open weights" is the accurate term, not "open source" in the fullest sense. The weights and the license are public; the training data is not. That is standard for open-weight releases — our Mistral AI beginner guide covers another model family that ships the same way — but it means you cannot fully reproduce the training, only the inference.

Under the hood, Clef is a 27B model post-trained from Qwen3.8-27B with the backbone frozen and rank-256 LoRA adapters plus a joint schema head, trained with an RL method Cloudflare calls RLCD; Clef-flash is the 9B sibling from Qwen3.5-9B. Both keep their vision encoders. Alongside the models, Cloudflare also launched an RL fine-tuning service (AI Gateway to Workers AI to Containers to a new Trainer), starting with forward-deployed engineers and self-serve later — no price or date announced yet.

When Should You NOT Use a Decision Model?

Use a decision model when you need judgment; use a generative model when you need knowledge or prose. The boundary is clean.

Do not use Clef for knowledge-heavy questions. Even Cloudflare's own benchmark table shows Jev winning GPQA Diamond, MMLU-Pro, BBH, and When2Call — decision models are trained to judge situations, not to recall facts. Do not use it for anything that must produce free text: drafts, summaries, explanations, code. And do not use it where you need an auditable reasoning trace, because there is no trace — just probabilities.

The category itself is only weeks old: TypeSafe's Jev landed September 15, 2026, OpenAI's Decisions API entered limited preview September 29, Cloudflare's Clef and Amazon's Strands Decider 2B both launched October 1, and Liquid AI's d1 arrived September 30. Expect the numbers, prices, and APIs on this page to keep moving, and re-check the official docs before you build on them.

Sources

  • Cloudflare — "Introducing Clef: our open-source decision models, and new RL fine-tuning platform" (blog.cloudflare.com, October 1, 2026)
  • Cloudflare — "Introducing Clef-omni with full multimodality, plus a faster Clef and a cheaper Clef-flash" (blog.cloudflare.com, October 9, 2026)
  • Cloudflare Workers AI docs — clef-flash model page: context window, unit pricing, binding/REST/curl usage (developers.cloudflare.com/workers-ai/models/clef-flash/, verified November 3, 2026)
  • Cloudflare Workers AI docs — clef and clef-omni model pages (developers.cloudflare.com)
  • Cloudflare changelog — Clef launch entry (developers.cloudflare.com/changelog)
  • Hugging Face — Cloudflare/clef model card: single-forward-pass decision API, Apache 2.0 (huggingface.co/Cloudflare/clef)
  • Sanity.io glossary — "What is Cloudflare Clef? Decision model explained"
  • Flavio Copes — Clef hands-on guide with working Worker code (flaviocopes.com/clef)
  • dev.to — "Generate, then decide: using Cloudflare Clef as a decision layer" (RAG evidence-gate proof of concept)
  • DataNorth — "Cloudflare releases Clef and Clef-flash" (datanorth.ai/news/cloudflare-releases-clef-and-clef-flash)
  • Oossa — "Cloudflare releases open-weight decision models for AI agents" (oossa.com/en/cloudflare-releases-open-weight-decision-models-for-ai-agents)
  • BitcoinVersus — Clef launch coverage citing The Register on latency and open-weights precision (bitcoinversus.tech/2026/10/04/cloudflare-clef-38-8ms-decision-models-ai-agents/)

Frequently Asked Questions

Is Cloudflare Clef really open source?

The weights are open under the Apache 2.0 license and published on Hugging Face, which is what "open weights" means. The training data is not public, so it is not open source in the fullest sense — but you can download, fine-tune, and self-host the models freely.

What is the difference between Clef and Clef-flash?

Clef is the 27B flagship for the hardest decisions (65,536-token context, 209.3 ms median latency, $0.24 per million input tokens). Clef-flash is the 9B fast model for real-time gates (24,576-token context, 38.8 ms median, $0.038 per million). Pick Clef-flash by default and step up to Clef when accuracy on tricky classifications matters more than speed.

What is Jev, and why does Cloudflare compare Clef to it?

Jev is TypeSafe AI's "System One" decision model, launched in early access on September 15, 2026. Clef is explicitly API-compatible with Jev, so teams can migrate with minimal code changes — that compatibility is why Cloudflare benchmarks Clef directly against it. Unlike Clef, Jev ships no open weights; it is a hosted API only.

Can I use Clef without Cloudflare Workers?

Yes. The Workers AI REST API exposes the same models with an account ID and API token, the weights are downloadable from Hugging Face for self-hosting, and third-party reports place both models on OpenRouter as well.

Does Clef replace the LLM in my agent?

No — it sits beside it. The winning pattern is generate-then-decide: your LLM generates a draft answer or a proposed action, Clef judges it against your typed questions, and your code enforces the verdict. The LLM writes; Clef decides.

Featured on Twelve Tools Hunt for Tools Featured on LaunchBuff Launch Llama Tools Launch your MCP Top Web Development Companies in the US - OnToplist.com Designer Listings Listed on SeeWhatNewAI