Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use Clef as a typed decision model instead of asking a chat model to write a classification paragraph. Your Cloudflare Worker can submit a prompt, receive an allowed tier such as coding or simple plus a confidence value, and route the request deterministically. In a 20-prompt test repeated 10 times, both Clef and Clef-flash made no observed routing errors, while a Llama 4 Scout classifier scored 75% with strict parsing and 85% with a safe default. That result is encouraging but small: production routing still needs a larger, labelled test set, a conservative fallback, and authentication around the Worker.
Why replace a chat classifier in an LLM router?
A conventional router asks a generative model to return a label in natural language. Even when the instruction says “reply with coding or simple,” the model can add punctuation, explanations, code fences, or a different spelling. Your Worker then has to parse an unconstrained string before it can select a downstream model.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Clef changes the contract. Cloudflare describes it as a decision model: it reads an input state and typed questions, then returns probabilities for answers that you define. It does not generate a paragraph that your application must interpret. A choice question can expose only the options your router allows, while the response includes the selected option and confidence.
What this removes
- Free-form parsing: there is no need to strip prose, normalize labels, or guess whether a response means “coding.”
- Ambiguous labels: your criteria explicitly define what belongs in each tier.
- Opaque uncertainty: the decision includes probabilities, so the router can send uncertain cases to a stronger model.
Clef supports noul yes/no questions, choice questions over developer-defined options, and score questions over an ordered rubric. A request may contain up to 64 questions. The state can be text, JSON, an image, or video, which makes the same pattern useful beyond text routing.
Popular on Amazon
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
How should you define coding and simple tiers?
Write criteria as policy, not as vague descriptions. In this router, the coding tier includes writing, debugging, reviewing, or explaining code, scripts, SQL, regular expressions, configuration, and developer tooling. The simple tier covers general knowledge, writing, translation, advice, and everything else.
That boundary matters. “Translate this SQL error into French” contains both a language task and a technical artifact; under the stated policy it belongs to coding. A cover letter for a developer job is writing, not code, and therefore belongs to simple unless your own policy says otherwise. Put such decisions in the criteria so the model and your test suite use the same definition.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11questions: {
classify: {
type: "choice",
instructions: "Which model tier should handle this user request?",
criteria: {
coding: "Writing, debugging, reviewing or explaining code, scripts, SQL, regex, configs or developer tooling",
simple: "General knowledge, writing, translation, advice and everything else"
}
}
}
Keep the number of choices small. Two well-defined tiers are easier to validate than a long list of overlapping destinations. If you later add a research or vision tier, give each option a non-overlapping criterion and add dedicated examples to the benchmark.
How do you call Clef from a Cloudflare Worker?
Bind Workers AI to the Worker, send the prompt in state, and select the model that matches the endpoint. Do not send the text in a chat-style messages array; Clef expects the value to evaluate in state.
Minimal Workers AI binding call
export default {
async fetch(request, env) {
const prompt = await request.text();
const out = await env.AI.run("@cf/cloudflare/clef", {
model: "clef",
state: prompt,
questions: {
classify: {
type: "choice",
instructions: "Which model tier should handle this user request?",
criteria: {
coding: "Writing, debugging, reviewing or explaining code, scripts, SQL, regex, configs or developer tooling",
simple: "General knowledge, writing, translation, advice and everything else"
}
}
}
});
return Response.json(out);
}
};
For Clef-flash, use the corresponding endpoint and selector: env.AI.run("@cf/cloudflare/clef-flash", { model: "clef-flash", ... }). The selector and endpoint must agree. A mismatch is a common integration error and can produce an invalid request rather than a useful classification.
Also popular on Amazon
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Keep classification separate from generation
Add a /classify route that returns the decision without invoking Claude or another answer model. This lets you inspect labels, probabilities, and failures cheaply while developing the policy. Your normal request path can call that function first, then invoke the selected model only after the routing decision passes validation.
The decision response should be treated as typed data. Check that the question exists, that its selected value is one of your allowed keys, and that confidence is numeric. If any check fails, do not attempt to parse prose from the response; use the stronger-model fallback.
What routing policy handles uncertainty safely?
Use a fail-safe policy: route only an explicit, sufficiently confident simple decision to the cheaper model. Send coding decisions, unknown values, malformed responses, and low-confidence results to the stronger tier.
- Call Clef with the user prompt as
state. - Read the selected choice and its confidence for
classify. - If the choice is
simpleand confidence is at least0.7, use the lower-cost model. - If the choice is
coding, use the stronger coding-capable model. - If the output is missing, unexpected, or below the confidence threshold, use the stronger model and log the event.
This asymmetry reflects the cost of mistakes. Sending a genuinely simple request to Sonnet costs more, but sending a coding prompt to an inexpensive general model can produce an answer the user cannot use. A confidence threshold therefore protects quality even when the classifier is mostly right.
const result = await classify(prompt);
const decision = result?.classify;
const isSafeSimple = decision?.choice === "simple"
&& Number(decision.confidence) >= 0.7;
const target = isSafeSimple ? "cheap-model" : "strong-model";
return runAnswerModel(target, prompt);
Log the original prompt identifier, selected tier, confidence, fallback reason, and downstream result quality. Avoid logging sensitive prompt contents unless your data-retention policy permits it.
Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
What is the difference between Clef and Clef-flash?
Clef is the larger model with more context and higher input-token pricing. Clef-flash is smaller, substantially cheaper, and faster. Neither is universally better: Cloudflare’s benchmark table shows each leading on different datasets, so your labelled workload should decide the production choice.
| Attribute | Clef | Clef-flash |
|---|---|---|
| Model size | 27B parameters | 9B parameters |
| Context window | 65,536 tokens | 24,576 tokens |
| Input price | $0.24 per million input tokens | $0.038 per million input tokens |
| Output-token charge | Not charged | Not charged |
| Published median latency | 209.3 ms | 38.8 ms |
| Published p95 latency | 238.6 ms | 122.4 ms |
| Latency measurement | Cloudflare’s figures across 43 benchmark runs | |
Both models are multimodal. The standard Clef model documentation allows up to four embedded images in the state. For a text-only router, the important trade-off is usually decision quality and context headroom versus classification cost and latency.
How accurate is Clef for LLM routing?
In the supplied Worker benchmark, Clef and Clef-flash made no observed errors, but that is not a guarantee of universal 100% accuracy. The test used 20 labelled prompts—10 coding and 10 general—repeated for 10 runs per classifier, for 200 requests per classifier.
| Classifier and policy | Correct requests | Observed accuracy | Misrouted prompts |
|---|---|---|---|
| Llama 4 Scout, strict parsing | 150/200 | 75.0% | Five |
| Llama 4 Scout, safe default | 170/200 | 85.0% | Three |
| Clef | 200/200 | 100.0% | Zero |
| Clef-flash | 200/200 | 100.0% | Zero |
The same mistakes repeated on every run for the Llama configurations, while neither Clef model misrouted one of the 20 examples. Read “100%” precisely: it means no errors on these 20 prompts under 10 repetitions. It does not estimate performance on every language, user population, or mixed-intent prompt.
How should you build a stronger routing benchmark?
Expand the labelled set before changing the production threshold. Preserve the exact prompt, expected tier, model response, selected choice, confidence, latency, and fallback reason for every trial.
Also popular on Amazon
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Include boundary cases
- API explanations that contain no code.
- Requests to translate an error message or a configuration file.
- Developer-job cover letters and technical documentation.
- Prompts that mix writing with SQL, regular expressions, or configuration.
- Very long context, empty input, malformed JSON, and unsupported media.
Measure more than accuracy
- Per-class recall: missing a coding request may be more damaging than over-routing a simple one.
- Confidence calibration: check whether low-confidence decisions actually contain more errors.
- Fallback rate: a threshold that protects quality but sends half of traffic to the expensive model may not meet your budget.
- Latency percentiles: measure classification plus downstream generation, not only the model call.
Run the benchmark against both Clef variants if cost or latency matters. Keep a fixed holdout set so threshold changes are comparable rather than tuned to the examples used during development.
What does Clef cost in a high-volume router?
The documented input-token prices are $0.24 per million tokens for Clef and $0.038 per million for Clef-flash; output tokens are not charged. Your total routing bill also depends on prompt length and how many requests are sent to the classifier, so calculate cost from your actual token distribution rather than multiplying a headline rate by request count.
Clef’s larger context window can matter when you classify long conversations or multimodal state. For short, single-turn prompts, Clef-flash’s lower price and published latency may make it the practical first choice, provided its error rate on your labelled set remains acceptable. A common design is to use flash for normal traffic and reserve Clef or the stronger answer model for low-confidence cases.
How do you secure a Worker that calls paid models?
The sample Worker does not authenticate callers. Anyone who discovers its URL could submit requests and spend the owner’s Anthropic credits through the downstream route. Put access control in front of the endpoint before exposing it publicly.
- Require Cloudflare Access for internal tools or authenticated applications.
- For service-to-service calls, validate a bearer token and reject missing or invalid credentials before classification.
- Add rate limits, request-size limits, and timeouts so one caller cannot exhaust quota.
- Keep provider credentials and model configuration in Worker secrets or bindings, never in client-side code.
- Record usage and fallback events so unexpected spend is visible quickly.
Authentication protects the bill; input validation protects the classifier. Reject empty bodies, enforce a maximum prompt size, and decide explicitly how to handle binary or multimodal state rather than allowing arbitrary uploads to reach the model.
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
What else can a Clef decision model classify?
Cloudflare lists support triage, threat-intelligence classification, trust-and-safety scoring, agent action guardrails, and visual classification as decision-model use cases. The same typed-question approach can decide whether an agent may call a tool, whether a support ticket needs escalation, or how an image should be queued for review.
You can invoke Clef through the Workers AI binding, the /ai/run REST API, or AI Gateway. For non-text state, define questions that describe the decision rather than asking for a generated explanation; your application still receives constrained answers and probabilities.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesProduction checklist for a Clef router
- Define mutually exclusive criteria for every destination.
- Send evaluated content in
state, notmessages. - Match
model: "clef"ormodel: "clef-flash"to the selected endpoint. - Validate the returned choice and confidence as typed data.
- Route only high-confidence
simpleresults to the cheap tier. - Fallback on unknown output, errors, and confidence below
0.7. - Test boundary prompts and keep a holdout set.
- Measure class-specific errors, latency, cost, and fallback rate.
- Protect the Worker with Access or bearer-token authentication.
- Re-run the benchmark when criteria, models, or downstream prompts change.
What should you remember about Clef routing?
A decision model does not write an answer; it chooses among answers you permit. That makes the router easier to validate than a chat classifier, gives you an explicit confidence signal, and supports a conservative policy that protects quality. Clef provides more context at a higher price, while Clef-flash prioritizes speed and low input cost. The right choice is the one that performs reliably on your own labelled traffic, with authentication and fallback handling in place.
Frequently Asked Questions
Can Clef classify JSON instead of plain text?
Yes. The decision-model state can be JSON as well as text, images, or video. This lets a router classify structured request metadata together with the user’s prompt, provided your questions and criteria explain how those fields affect the decision.
Should I use Clef or Clef-flash for every request?
Not necessarily. A practical deployment can benchmark both, then use the faster model for routine traffic and reserve the larger model for long context or uncertain cases. The published dataset does not establish a universal winner across all routing workloads.
How do I expose the classifier without exposing my model budget?
Keep the classification route behind Cloudflare Access or a validated bearer token, and add rate and body-size limits. Also separate public client code from Worker secrets so callers cannot invoke paid downstream providers directly.
Can a confidence threshold eliminate routing errors?
No threshold guarantees that result. It trades false positives, false negatives, and expensive fallbacks, so select it from a labelled validation set and monitor confidence against real misroutes after deployment.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

