Clef API
Cloudflare's open-source Clef decision model family: Clef (27B) and Clef Flash (9B) turn states and typed questions into probabilistic decisions.
Clef API
cloudflare/clef
Cloudflare Clef is a 27B multimodal decision model that turns text, JSON, images, or video into structured probability-based JSON answers.
Clef API Background
Overview
Clef is Cloudflare's open-source decision model family, served on Cloudflare Workers AI. It turns a state plus a schema of typed questions into decisions, returning a probability for every allowed option of every question in a single forward pass. The family includes Clef, a 27B multimodal model fine-tuned from Qwen3.8-27B, and Clef Flash, a fast 9B model fine-tuned from Qwen3.5-9B.
Development History
Cloudflare publicly released the Clef decision models as open-weight models (Apache-2.0). Clef is post-trained from Qwen3.8-27B with its vision encoder plus a joint schema head; Clef Flash is the smaller, faster variant post-trained from Qwen3.5-9B. Both are served on Cloudflare Workers AI.
Key Innovations
- Single forward pass returns a probability for every option of every question
- Joint schema head scores all options of all questions jointly
- Accepts text, JSON, and images as input
- No free-form text generation and no output parsing
- Fully compatible with the Jev and SystemOne decision APIs
Clef API Technical Specifications
Architecture
Clef uses the Qwen3.8-27B backbone with its vision encoder, stored as standard sharded safetensors, plus a joint schema head that reads the backbone's final hidden states, routes evidence from the state to each question, and scores all options jointly. Clef Flash uses the smaller Qwen3.5-9B backbone.
Parameters
Clef: 27B parameters. Clef Flash: 9B parameters.
Capabilities
- Multimodal decision making over text, JSON, and images
- Choice, score, and true/false (noul) question types
- Workflow routing and tool selection
- Classification and guardrails
- Structured, schema-driven decisions
Limitations
- No free-form text generation; output is decisions only
- Clef is CPU/GPU-served via custom code or Cloudflare Workers AI
Clef API Performance
Strengths
- High decision accuracy across classification, tool-retrieval, and reasoning benchmarks
- Very low latency
- Joint scoring across all questions and options
- Clef Flash is optimized for speed
Real-world Effectiveness
Clef targets end-to-end business workflows such as invoice processing, customer service triage, security incident classification, and agent trace observability, where fast and consistent structured decisions matter.
Clef API When to Use
Scenarios
- You need fast, consistent routing or classification decisions over text or images. The Clef API family returns calibrated probabilities for every option instead of free-form text.
- You are building agentic workflows that must select tools or guardrails reliably. Clef API scores each allowed option in one forward pass for low-latency decisioning.
- You process business documents such as invoices and need structured decisions. Clef API maps a state and a schema of typed questions directly to probabilities.
Best Practices
- Define each question with a clear type (noul, choice, or score) and explicit criteria
- Keep the state focused on the decision at hand to maximize accuracy
- Choose Clef Flash when latency and cost matter more than maximum accuracy