October 4, 2026
Cloudflare Clef: What Decision Models Do
By Synthex
An AI assistant can write a helpful reply and still struggle with a much smaller job: deciding which team should receive a message, whether a request needs urgent attention, or which tool to call next.
Software needs those answers in a form it can act on. If the model replies "this probably belongs with the delivery team," the application still has to turn those words into a decision it can use.
Cloudflare Clef is a family of AI models built for decisions with defined answers. You give the model the situation and the available choices. It returns structured results and probabilities that your software can use. Cloudflare introduced Clef and Clef-flash on October 1, 2026, alongside a service for adapting them to particular workloads. Cloudflare's announcement (opens in new tab).
What you'll learn
You'll understand why decision models are appearing in AI workflows, how Clef works, and how it differs from a chatbot. We'll also work through a support example and explain the fine-tuning announcement.
The context: AI agents need to make small decisions
An AI agent is software that uses a model alongside tools to carry out a task. A support agent might read a message, look up an order, choose an appropriate next action, and prepare a reply.
Those steps ask for different kinds of intelligence. Writing the reply needs flexible language. Routing the message needs a choice from a short list. Checking whether the order qualifies for a refund may involve an exact business rule.
For example, imagine an online shop receiving this message:
I paid for next-day delivery. The tracking page says delivered, but the package never arrived.
A useful workflow might assign the message to delivery support, retrieve the tracking history, and ask a person to review conflicting evidence before offering compensation. The customer shouldn't have to repeat the story to three teams.
Decision models focus on the judgments inside that workflow. TypeSafe AI helped bring attention to this approach with Jev, introduced on September 15, 2026. It calls these "System One" models: models designed to turn a situation into fast, typed decisions. An API is the interface an application uses to send information to a service and receive a result. Clef follows the same API shape. TypeSafe's Jev introduction (opens in new tab).
Classification itself is familiar. Spam filters have long assigned labels to messages. Here, developers describe the questions and permitted answers in each request. The same interface can handle different decision tasks.
What you give Clef, and what comes back
The request has two main pieces. The state is the information the model should consider. The schema defines the questions and their permitted answers. A schema is simply a description of the result's structure. Question and criteria definitions (opens in new tab).
For the delivery message, a request body could look like this:
This is an example request body, not a complete API call. questions contains a question named team; criteria describes its allowed answers. The format follows the Workers AI Clef API documentation (opens in new tab).
Suppose a model assigned the following probabilities. These numbers are invented to explain the idea, not results from running this request.
| Allowed answer | Example probability |
|---|---|
| Delivery | 0.84 |
| Billing | 0.11 |
| General | 0.05 |
Your application can use those values to choose a route or send an uncertain case to a person. The application sets the policy and permissions for what happens next, including whether a refund is allowed.
The interface supports three question types:
| Type | What it asks | Example |
|---|---|---|
choice | Which named option fits? | Delivery, billing, or general |
noul | How likely is a statement to be true? | Does this message describe a missing package? |
score | Where does this fall on an ordered scale? | Low, medium, or high urgency |
The unusual name noul is the API's name for a true-or-false probability from 0 to 1. A score uses probabilities across the ordered options to return a weighted score. You can combine question types in one request. TypeSafe's question-type documentation (opens in new tab), Clef answer fields (opens in new tab).
How this differs from asking a chatbot for JSON
JSON is a common text format for exchanging structured data. Many language-model systems can constrain their output to a JSON schema. For example, llama.cpp, software for running language models, supports converting a subset of JSON Schema into a grammar that restricts generation. llama.cpp's grammar documentation (opens in new tab).
Language models can already return structured information. Clef uses a different process to produce the decision.
A typical autoregressive language model generates a response one token at a time. Tokens are the pieces of text a model processes. Each new output token depends on what has already been generated. Hugging Face's generation documentation (opens in new tab).
Clef uses a Qwen model to process the input, then a specialized component to score the allowed answers together. It doesn't generate an intermediate written response token by token. Cloudflare's model card describes this as a single forward pass, meaning one evaluation through the model. Clef's model card (opens in new tab).
The decision step produces scores without generating a prose explanation. To write a customer reply or explain the decision in ordinary language, the application needs a language model as well.
One possible architecture is to let Clef classify the message, use ordinary code to select an approved action, and ask a language model to draft the reply using the relevant order details. Each component has a clear job.
Clef and Clef-flash
Cloudflare provides two models through Workers AI, its service for running hosted AI models:
| Model | Size | Hosted input price |
|---|---|---|
| Clef | 27 billion parameters | $0.24 per million input tokens |
| Clef-flash | 9 billion parameters | $0.09 per million input tokens |
Parameters are learned numerical values inside a model. These counts describe size; they don't tell you which model will make better decisions for your particular task. Both hosted listings specify a 65,536-token context window and vision support. The context window is the amount of information a model can process in one request. Prices are the published model rates on October 4, 2026. Clef documentation (opens in new tab), Clef-flash documentation (opens in new tab).
Vision support allows decisions about images, such as whether a photograph shows damaged packaging. The hosted API accepts embedded images and doesn't accept remote image URLs. The downloadable models also document video-frame inputs, so check the interface you're using before assuming the hosted endpoint accepts the same media inputs. Hosted input requirements (opens in new tab), Clef-flash model card (opens in new tab).
Both releases use the Apache 2.0 license and include downloadable weights, the learned values needed to run the models yourself. Self-hosting requires suitable hardware and software that can run the model's decision component. Cloudflare's local examples were tested on an NVIDIA H200 GPU; they aren't a promise that either model will run comfortably on an ordinary laptop. Clef model files and license (opens in new tab), Clef-flash local usage (opens in new tab).
What the speed claims tell you
Cloudflare's published Decision Index results report median request latency of 209.3 milliseconds for Clef and 38.8 milliseconds for Clef-flash, compared with 524.1 milliseconds for Jev in that evaluation. Median means the middle result across measured requests. These are vendor-reported results, and the same results show different models winning different tasks. Cloudflare's published benchmark results (opens in new tab).
Treat those figures as a reason to test. Your application may spend time retrieving a customer record, processing a photograph, waiting on the network, or calling another service. A fast decision doesn't make those other steps disappear.
Compare the models on the messages you expect to receive. Track wrong routes as well as speed. A model that answers quickly but repeatedly sends missing-package complaints to billing would be a poor fit for this shop.
How to judge reliability
A valid answer can still be a wrong answer. Restricting the model to delivery, billing, and general prevents it from inventing a fourth team. It doesn't guarantee that it understands the message correctly.
The probabilities need evaluation too. Calibration means that probability estimates match observed correctness over many examples. Roughly, among decisions assigned an 80% probability, about 80% should be correct if the model is well calibrated for that task. Research on neural-network calibration explains why confidence alone doesn't establish reliability. On Calibration of Modern Neural Networks (opens in new tab).
For a support workflow, you can test a proposed automatic-routing threshold against messages that people have already labeled. Include incomplete messages and cases that could reasonably belong to more than one team. If the model makes confident errors on those cases, raising the threshold may not solve the problem.
Keep an appropriate fallback. An uncertain routing decision can go to a person; a decision about compensation can require separate checks against the order record and refund policy. Choose those controls according to the cost of a mistake.
What the fine-tuning announcement means
Fine-tuning means further training an existing model for a particular task or domain. Reinforcement learning, or RL, uses a reward signal to train a model toward desired behavior. For a decision task, that signal can score whether its choices match the desired outcomes. Hugging Face's reward-based training documentation (opens in new tab).
Cloudflare calls its decision-focused training approach Reinforcement Learning for Calibrated Decisions, or RLCD. It aims to improve decision accuracy and probability calibration.
The fine-tuning offer starts with hands-on help from Cloudflare's forward-deployed engineers, who work with customers on specific workloads. A self-service platform for collecting data, training, and redeploying models is planned. The planned workflow uses AI Gateway to collect requests, Workers AI to run the model, and Containers to score results in a training environment. A Trainer updates the weights, and Workers AI with Bring Your Own Model handles redeployment. Some pieces are still in progress. Cloudflare's fine-tuning announcement (opens in new tab).
For the shop, that could mean adapting a model to its own support categories using reviewed historical decisions. It would require useful examples and a way to measure success. You'll also need a way to establish the correct answers; customer traffic alone doesn't provide them.
A useful first experiment
I'd start with one repeated decision, such as assigning support messages to a team. Write down the allowed categories and what each one means before choosing a model.
Then take a small set of past messages with known answers. Compare Clef and Clef-flash using the same questions, and review their mistakes. Measure response time from your application and check whether the probabilities help separate straightforward cases from uncertain ones.
For the hosted route, use the examples in the Workers AI Clef documentation (opens in new tab). You'll need a Cloudflare account, its account ID, and an API token with permission to use Workers AI. The REST API getting-started guide (opens in new tab) explains that setup. For self-hosting, follow the model card's decision-model examples and documented GPU setup.
Once that decision works reliably on your examples, connect it to a low-impact action, such as assigning a queue. Keep reviewing the cases it gets wrong before giving it decisions that carry a larger cost.
