Clef

Clef

Cloudflare · Business · Other

Clef is Cloudflare's open-source decision model for Workers AI. It returns calibrated probabilities for typed questions, not generated text, so agents can classify, route, and act fast.

Interface preview of Clef

About Clef

What Is Clef

Clef is a decision model, which means it answers multiple-choice and yes-or-no questions with probabilities instead of writing paragraphs. You hand it a state (a support ticket, a JSON record, a screenshot) and a schema of typed questions. It hands back a number for every allowed option.

Cloudflare trained two versions. Clef carries 27 billion parameters and a 65,536-token context window. Clef-flash is a 9 billion parameter model with a 24,576-token window, built for decisions that sit in the hot path of an agent. Both read text, JSON, and images, and both are hosted on Workers AI behind one API endpoint.

The point is speed and cost. A general LLM has to generate tokens before it can answer, and that text has to be parsed afterward. Clef scores the valid answers in one pass, so there's no output to parse and no output tokens to pay for. Cloudflare measured a median latency of 209.3 ms on Clef and 38.8 ms on Clef-flash, against 524.1 ms for Jev, the model that inspired this category.

The limit is scope. Clef only chooses among the options you define. Ask it a question your schema doesn't cover and you get a confident answer to the wrong question. It also doesn't explain itself, so the reasoning has to live in your code and your logs.

Getting Started

  1. Open a Cloudflare account and turn on Workers AI. The model ids are @cf/cloudflare/clef and @cf/cloudflare/clef-flash.
  2. Write the state you want judged. It can be a plain string, a JSON object, or up to four images placed before the state.
  3. Define one to 64 questions with a type for each: noul for a probability between 0 and 1, choice for a set of labeled options, score for an ordered scale.
  4. Send the request through a Worker binding or the REST endpoint, then read answers and route, escalate, or defer to a human based on the returned numbers.
  5. For air-gapped work, download the Apache 2.0 weights from Hugging Face and run them on your own GPUs.

Product Information

A quick look at Clef's pricing, supported platforms, and performance.

Free PlanYes
Paid Plans$0.038 - $0.24 per M input tokens
PlatformWeb API, Workers AI, self-hosted
DeveloperCloudflare
CategoryBusiness · Other
Release DateOct 2026
Latest UpdatedOct 2026
Website Visits1.8M
Website Global RankN/A
API AvailabilityYes

Best for

The users, tasks, and scenarios where this tool fits best.

Users

  • Platform and backend engineers
  • Trust and safety teams
  • Support operations leads

Tasks

  • Ticket routing
  • Content classification
  • Agent gating
  • Visual checks

Scenarios

  • A checkout fails for every customer
  • A crawler has to be judged good or bad at scale
  • A workflow already calls a Jev endpoint

Key features

Typed Questions With Probabilities

Every request is a schema. You define the question ids, pick noul, choice, or score, and list the criteria. Clef returns a probability for each allowed option, so a routing service can set its own threshold instead of accepting a single label. The distribution also tells you when the model is torn between two answers, which is exactly when a human should look. Those structured outputs drop straight into a switch statement.

Multimodal Input

Clef takes images as well as text and JSON. Up to four PNG, JPEG, or WebP files can sit in front of the state, which covers a screenshot of a checkout page, a photo of a damaged parcel, or a dashboard grab. Each image is capped at 1,024 tokens, and media tokens count toward the context window.

Two Sizes for Two Latency Budgets

The 27B Clef model is the accuracy pick, scoring 98.47 on BFCL case exact and 94.20 macro-F1 on BANKING77 in Cloudflare's runs. Clef-flash trades some of that for speed, with a 38.8 ms median and a much lower price. Most teams start with Clef-flash and move specific questions to the bigger model.

Jev-Compatible API

The request and response shape follows the System One API that Jev popularized. If you already run a Jev call, you change the model id and keep your parsing code. That compatibility matters for teams that want a second opinion without rewriting a workflow.

Open Weights Under Apache 2.0

Both models are on Hugging Face with Apache 2.0 licenses. You can inspect the weights, run them locally, and keep sensitive traffic off someone else's network. For regulated work, that option often decides the purchase on its own.

Fine-Tuning Through Cloudflare

Cloudflare runs a forward-deployed engineering team that tunes Clef on your labeled decisions, and it's building a self-serve reinforcement learning product around AI Gateway, Workers AI, and Containers. Fine-tuning costs some general accuracy, so it makes sense when you have years of labeled outcomes in one narrow domain.

Pros and cons

Pros

  • Decisions come back in roughly 200 ms on Clef and under 40 ms on Clef-flash, which is fast enough to sit inside a live request rather than a background job.
  • You pay for input tokens only. There are no output tokens to budget for, and the rate starts at $0.038 per million.
  • The vision encoder handles screenshots and scans, a step beyond the text-only decision models that came first.
  • Open weights plus a Jev-compatible API give you an exit route. You can self-host or switch providers without touching your application code.

Cons

  • Clef can't write text or show its reasoning. Anything that needs an explanation, a summary, or a tool call still belongs to an LLM.
  • Accuracy depends on your schema. A missing option, a vague criterion, or two overlapping labels produces a confident wrong answer, and nothing in the response warns you.
  • It doesn't win every benchmark. Jev scored higher on When2Call and BRIGHT in Cloudflare's own comparison, so a quick check against your data is worth the hour.
  • Self-serve fine-tuning isn't available yet. Custom training currently runs through a Cloudflare engineering engagement, which rules out small teams for now.

Frequently asked questions

Clef is a family of decision models from Cloudflare. It reads a state and a set of typed questions, then returns a probability for every allowed answer. Cloudflare ships two versions, Clef and Clef-flash, and hosts both on Workers AI.