Set up Clef (Cloudflare)

Capture the decisions your code asks of Clef, Cloudflare's decision model on Workers AI, through a relay on your computer.

Clef is Cloudflare's decision model on Workers AI, in two sizes: clef and clef-flash. It answers typed questions the same way as Jev. Worsley captures calls to Workers AI's REST API through a relay on your computer.

Decision-model sessions aren't shown in Worsley yet. They're measured by DY (Decision Yield), not ROIP, so they're captured and kept safely in your account now and will appear when DY arrives. Until then they don't show in History and aren't scored.

Sign in to the Worsley CLI

Do this once on each computer where you run your code that calls Clef.

  1. 1Install the Worsley CLI. It runs on macOS, Windows and Linux and needs Node.js 22.23.4 or later (on a Mac, brew install node works too). On macOS or Linux, run:
curl -fsSL https://www.worsley.ai/install.sh | sh

On Windows, in PowerShell:

irm https://www.worsley.ai/install.ps1 | iex

The installer checks the download against its published checksum, puts the CLI in your home folder (~/.worsley, or %LOCALAPPDATA%\Worsley on Windows) and adds it to your PATH. Open a new terminal window afterward so the worsley command is found. Run the same command again any time to update.

  1. 1Sign in. The command below prints a link and a short code, then waits.
worsley login
  1. 1Open the link. Log in to Worsley if asked, check that the code on the page matches the one in your terminal and that it names this computer, then select Connect. If you last logged in more than 10 minutes ago, Worsley asks you to log in again first. Opened the page without the code? Type it in.
  2. 2Back in the terminal, Worsley confirms Signed in as your email. The sign-in is kept in your system's credential store (macOS Keychain, Windows Credential Manager or Secret Service on Linux), never in a plain file. The code expires after 10 minutes; run worsley login again if it does.

Start the Worsley relay

your code talks to its model over an API, so instead of reading files, Worsley sits between the two as a small relay on your own computer. Requests and replies pass through unchanged, streaming included, and Worsley keeps a copy of each exchange.

  1. 1Start the relay, and leave it running in its own terminal window while you work. Press Ctrl+C to stop it.
worsley proxy --upstream clef

It listens on 127.0.0.1:11435, on this computer only. Port taken? Add --port <number>, and use that port in the next step.

Point your code at the relay

  1. 1Where your code calls https://api.cloudflare.com, use the relay's address instead and keep the rest of the path. Keep your Cloudflare API token as it is.
http://127.0.0.1:11435/client/v4/accounts/<your account id>/ai/run/@cf/cloudflare/clef

For Clef-flash, end the path with @cf/cloudflare/clef-flash. Only Clef's calls are recorded; anything else you send to Cloudflare through the relay passes through untouched.

  1. 1Use your code as you normally do. Each exchange is uploaded a few seconds after it finishes and appears in Worsley shortly after.

Your API key goes straight through the relay to the provider over HTTPS. Worsley never records or logs it.

Calls made inside a Cloudflare Worker through its AI binding (env.AI.run) run on Cloudflare, not on your computer, so the relay can't see them. Call the REST API from your own computer to capture them. Running Clef's open weights on your own server? Start the relay with --upstream and your server's address: calls whose model is named Clef are recorded as Clef.

Check that it's working

  • Each call your code makes shows in the relay's window as Recorded a decision from clef, with how many answers it had and the input tokens.
  • Run worsley status. Nothing should be left waiting to upload a few seconds after a call.

What's captured

  • The state you sent, as text, or as JSON when you sent structured data.
  • Every question: its id, its type (yes/no, choice or score), its instructions, and its options or score levels.
  • Every answer, with all its numbers: the option chosen, the score, or the probability of yes; the probability of every option or level; and the model's own confidence, exactly as the model returned them.
  • The model you asked for (such as jev-latest or clef-flash) and the exact model that answered.
  • Tokens and timing: input and output tokens, as the model reports them, and how long each call took.
  • Images: how many you sent and their type (PNG, JPEG, WebP). Never the images themselves.
  • Not captured: your API key, the images, and calls that fail. Secrets in the state (keys, tokens, passwords) are removed on your computer before anything is uploaded, and the questions and answers are encrypted like the rest of your conversations.

A session is a run of calls to one model: it ends after 30 minutes without a call, or after 500 calls, and the next call starts a new one.

If a session doesn't appear

  • Browser: check that the Worsley icon isn't showing Not Connected, Reconnect or No Site Access, and reload the tool's tab. More in Extension isn't capturing.
  • Terminal: check that worsley watch or worsley proxy was running while you worked, and run worsley status. If it says the sign-in was revoked or expired, run worsley login again.
  • Still missing after a few minutes? Contact support and tell us which tool and which browser or terminal you used.

Still need help?

Our team will get back to you.

Contact support