classifier.dev
Zero-shot text classification. Plain text in, a label and a calibrated
confidence out. No key, no signup. Up to a thousand texts per request.
curl https://classifier.dev/spam,not+spam/Win+a+free+iPhone
spam
curl "https://classifier.dev/?labels=spam,not+spam&text=Win+a+free+iPhone" # same call, query form
spam
Single Cloudflare Worker. No database, no framework, no build step beyond esbuild.
CLI
npm i -g classifier-dev
classify bug,feature,praise < feedback.txt
cli/ is a separate npm package (classifier-dev, bin classify): one
dependency-free Node file, tests against a mock API (npm test), semver with
its own CHANGELOG, released with npm run release patch|minor|major which
tags cli-v<version> and lets .github/workflows/publish-cli.yml publish
(needs an NPM_TOKEN repo secret). It talks to the API exactly like curl does.
Layout
src/index.ts routing, validation, tiers, LLM fallback chain, analytics
src/query.ts the GET query form, read and written with nuqs; the URL an error suggests
src/jev.ts TypeSafe's Jev: packs inputs into requests, reads probabilities
src/limiter.ts Durable Object: per-IP rate limiting
src/report.ts digest — Analytics Engine SQL -> Resend, flags model fallbacks
src/alerts.ts every 15 minutes; emails only when something is wrong
src/feedback.ts agent feedback, feedback.now protocol -> email
src/privacy.ts keyed pseudonyms: nothing kept points back at a caller
src/cost.ts per-request upstream spend, from the providers' own accounting
src/docs.ts the site (GET / and GET /benchmark), plain text
src/home.ts the same two documents rendered, for browsers only
src/ui.ts the shared look: markdown in a terminal
cli/ the `classify` command, published to npm as classifier-dev
eval/ benchmarks; read eval/README.md before quoting a number
finish-dns.sh one-shot DNS wiring, see below
wrangler.example.toml the Worker config, minus the account-specific ids
The site
curl classifier.dev prints plain text, exactly as it always has. A browser
sends Accept: text/html and gets the same document rendered — headings,
bracketed links, copy buttons — from src/home.ts. Nothing is duplicated: the
page is generated from DOCS and BENCHMARK at request time, so the text
stays canonical and the two cannot drift. ?format=text opts out by hand, and
both responses carry Vary: accept.
Agent feedback
Implements the feedback.now protocol (schema 1.1), so
any agent that speaks it can report a problem without being told how:
GET /.well-known/agent-feedback.json what this host accepts
GET /api/v1/policy categories, severities, limits
POST /api/v1/feedback full structured report
POST /api/v1/observations lighter signal
POST /api/v1/feedback/{id}/attachments more evidence, later
GET /api/v1/receipts/{id} did it land, and was it any good
Accepted submissions are emailed to REPORT_TO. Reports are kept in KV for 90
days. A repeat of the same domain + surface + category + title is stored and
acknowledged as a duplicate but not emailed again, so one looping agent cannot
empty itself into the inbox; the hourly budget is 100 per IP and the remainder
comes back on every receipt.
Testimonials use signal.category: "testimonial". They require
reporter.agent_type and reporter.agent_description, so praise arrives with
enough context to understand what kind of agent benefited and how it works.
quality_score is a deterministic function of how complete the report is — an
agent can read the rule and write a better one next time. Nothing here calls
the classifier or Analytics Engine: this is where reports arrive saying those
are broken, so it must work when they do not.
Deploy
Merging to main deploys. .github/workflows/deploy.yml typechecks, runs the
Worker and CLI tests, runs wrangler deploy, and then asks the live service for
/v1/health and one classification, so a deploy that uploads a broken Worker
fails in CI rather than in somebody's terminal.
By hand, to try something before it is merged:
cp wrangler.example.toml wrangler.toml # once, then fill in your own ids
npx wrangler deploy
wrangler.toml is gitignored and holds the two values that are specific to one
Cloudflare account: account_id, and the STATS KV namespace id that
npx wrangler kv namespace create STATS hands back. The tracked
wrangler.example.toml carries everything else — crons, bindings, migrations —
so the deployment shape is in the repository and only the identifiers are not.