Cloudflare's Clef: open-weight decision models for typed classification steps
Cloudflare released Clef and Clef-flash, Apache 2.0 decision models on Workers AI, for builders who need a fast, bounded classifier step in a workflow.
Picture an ops lead at a ten-person agency who has vibe-coded a small inbox router. Every inbound email (a client complaint, a vendor invoice, a sales lead) goes to a small LLM with a prompt like "return JSON with category and urgent." It mostly works. Then, a few times a week, the model returns a category that isn't on the list, wraps the JSON in prose, or labels the same email differently on a rerun. She adds a retry loop, a regex cleanup and a fallback, and the router slowly becomes a pile of patches around one decision: which bucket does this go in?
That step is what Cloudflare is targeting with Clef and Clef-flash, two decision models released October 1, 2026. You don't get generated text back. You define the possible answers up front and the model returns a probability for each one. Your code reads the numbers and branches. If a model can't write free text, it can't invent a fourth category or hand back broken JSON.
What it is
Cloudflare describes a decision model as one that "produces bounded structured outputs cheaply, quickly and consistently" and returns "typed answers with probabilities" that code can use to route, escalate or defer to a human. Here is what shipped, according to the announcement and Cloudflare's docs:
- Two sizes. Clef is a 27B model and Clef-flash is a 9B model. Both are hosted on Workers AI. Cloudflare positions Clef as the precision model and Clef-flash as the option for latency-critical calls.
- Typed questions. One request carries a
state(a string or structured data) and 1 to 64 questions of three types:noul(yes/no probability),choiceandscore. Flavio Copes' hands-on deep dive reports that a Choice takes 2 to 255 options and a Score takes 2 to 10 ordered levels. That covers the lede's pain: the answer space is fixed, so there is nothing to parse or repair. - Images. Each request can include up to 4 embedded PNG, JPEG or WebP images. Remote URLs are not accepted (docs). Cloudflare says Jev is text-only, and a community explainer on Hugging Face also says Jev does not take images, audio or video as direct inputs.
- Jev-API compatible. Cloudflare calls the models "fully Jev-API compatible." Copes says most code written for Jev works with Clef.
- Open weights. The weights are on Hugging Face under Apache 2.0. BenchLM notes that the hosted window is 65,536 tokens, while the self-hosted example defaults to 16,384 input tokens.
- How it's fast. Per Cloudflare, Clef runs a frozen Qwen backbone (Qwen3.8-27B for Clef, Qwen3.5-9B for Clef-flash) in a single prefill-only pass. It then scores every valid schema choice in parallel, with no token-by-token generation. Cloudflare says training included a Brier loss "to refine probability calibration."
Cloudflare also announced an RL fine-tuning service. It starts as a hands-on engagement with its forward-deployed engineer team, and a self-serve platform comes later.
Alternatives, with one-line trade-offs:
- Typesafe AI's Jev System One: the original decision model whose API Clef copies. It is text, JSON or text arrays only, and on Cloudflare's numbers it is slower (explainer).
- Laya: Cloudflare's own post says Laya is "very fast but trades off quality" on its benchmarks. That is a competitor's characterization.
- A small LLM with structured output: this is the status quo from the lede. It is flexible and can explain itself, but you are parsing generated text.
Two more entrants landed in the same window. Copes notes that OpenAI announced a Decisions API in limited preview on September 29, and AI Weekly reports that Amazon shipped Strands Decider 2B the same day as Clef.
Who it's for
Pick it up if your workflow has a recurring bounded judgment: ticket routing, invoice categorization, "does this need a human?" gates, or domain or content classification. It fits especially well if you already run on Workers or call Jev today. The open weights also matter if you want an exit from hosted inference later.
Skip it if the step needs open-ended reasoning, written explanations or tool calls; that's LLM territory, as both Cloudflare and the Jev explainer say. Skip it too if your categories are fuzzy or constantly expanding, or if a small LLM with structured output already passes your own evals and the failure modes above don't bite you.
Before and after
Before (LLM-as-classifier):
- Write a prompt listing the categories and asking for JSON.
- Call the LLM and wait for it to generate the answer.
- Parse the output, validate it against the allowed labels, and retry or repair on failure.
- Pick a threshold with no real probability to anchor it.
After (decision model):
- Define
stateplus typed questions, each with explicit criteria. - Make one call and get back answers keyed by your question IDs, with probabilities.
- Branch in code: route if the top choice clears your threshold, defer to a human otherwise.
Cloudflare's own example is threat-intel domain classification. It reports that Clef took 2.2s to fetch, render and classify a site, versus 4.7s for gpt-oss-120b in the same workflow, which also returned fewer classifications. That is Cloudflare's internal test, not an independent one.
Try it
Copes' walkthrough describes the setup: in the Cloudflare dashboard, open Workers AI, select Use REST API, create a token from the Workers AI API Token template, and export CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN. Then send the request shown in the announcement:
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/cloudflare/clef \
-X POST \
-H "Authorization: Bearer $CLOUDFLARE_AUTH_TOKEN" \
-d '{
"model": "clef",
"state": "Checkout has been failing for every customer for the last hour.",
"questions": {
"urgent": { "type": "noul", "instructions": "Is this support request urgent?" },
"team": {
"type": "choice",
"instructions": "Which team should handle this request?",
"criteria": {
"billing": "Payments, invoices, and refunds",
"technical": "Outages, errors, and configuration",
"sales": "Plans and upgrades"
}
},
"severity": {
"type": "score",
"instructions": "How severe is the customer impact?",
"criteria": ["No impact", "Minor", "Major", "Critical"]
}
}
}'
To try the smaller model, swap in @cf/cloudflare/clef-flash and "model": "clef-flash".
Cost. Workers AI pricing is $0.011 per 1,000 Neurons, with 10,000 Neurons per day free; usage beyond that requires Workers Paid. Copes and Crypto Briefing report $0.24 per million input tokens for Clef and $0.09 for Clef-flash, with output not billed.
A sane first eval. A GitHub issue lays out a migration plan:
- Replay at least 50 real past Jev verdicts through both models.
- Measure agreement with Jev, p50/p95 latency and neurons per call.
- Swap only if a model agrees on 90% or more of rows, keeping thresholds unchanged.
The same recipe works against your current LLM classifier: export real labeled rows and compare the outputs.
Where it breaks
- The quality numbers are the vendor's. AI Weekly relays Cloudflare's figures: BANKING77 macro-F1 of 94.20 versus 79.74 for Jev, and median latency of 209.3ms versus 524.1ms. These come from Cloudflare's own selection of 10 benchmarks, partly framed around the Jev Decision Index. BenchLM lists zero independently sourced benchmark rows. By AI Weekly's reading of Cloudflare's table, Jev comes out ahead on some tests (When2Call, BRIGHT). On Typesafe's workflow suite, Cloudflare says Clef won 3 of 4 areas. No independent head-to-head against Jev or a small LLM on practitioner data has been found.
- Calibration is a claim, not a measurement. Cloudflare says it trained for calibration. Whether the probabilities are actually well calibrated, and how Clef handles ambiguous labels or large, open-ended category sets, is undocumented.
- Self-hosting is unsized. The VRAM and quantization needed to run the 27B and 9B weights were not confirmed; BenchLM explicitly has no hardware estimate. The self-hosted example also defaults to 16,384 input tokens, not the hosted 65,536.
- Throughput is unverified. No batch API was found. Whether one call per row becomes the bottleneck at thousands of rows is unverified.
- Prices are secondhand. Per-token prices come from secondary sources and weren't confirmed on the pricing page excerpt reviewed here.
- Fine-tuning isn't self-serve yet. The RL fine-tuning service is partner-led for now, and the issue tracker above calls it "partner-only." Cloudflare itself notes that fine-tuning can trade away general-purpose performance.
- Long inputs get truncated. The docs say long text state is truncated to fit the token limit. They don't say whether the response flags it, so check input length before you send.
- Lock-in is mixed. API compatibility with Jev and Apache 2.0 weights lower switching costs. But the hosted speed story depends on Cloudflare's edge GPUs, and images must be embedded inline rather than linked.
Sources
- Introducing Clef: our open-source decision models, and new RL fine-tuning platform · Cloudflare Blog
- Cloudflare Open-Sources Clef, Beats Jev Latency on Edge GPUs | AI Weekly · AI Weekly
- A deep dive into Clef, Cloudflare's decision model · Flavio Copes
- Clef Context, Specs & Sources (October 2026) · BenchLM
- Cloudflare releases Clef and Clef-flash decision models on Workers AI · Crypto Briefing
- clef-flash (Cloudflare) · Cloudflare AI docs · Cloudflare Workers AI docs · Cloudflare
- clef (Cloudflare) · Cloudflare AI docs · Cloudflare Workers AI docs · Cloudflare
- Pricing · Cloudflare Workers AI docs · Cloudflare
- jev: replace typesafe/jev with Cloudflare Clef on Workers AI, if a replay of real verdicts agrees · Issue #6381 · Nishfleet/0509 · GitHub
- Jev System One Model: How Typed AI Decisions Work in Software · Hugging Face