🛒 Retail / E-commerce

Your 4.2★ average is hiding a safety complaint

A Cloudflare Worker intercepts your existing reviews API and enriches every response with real-time AI sentiment scores. Your backend never changes. distilbert-sst-2-int8 costs $0.026 per 1M input tokens — scoring 1M reviews ≈ $3.90.

The Problem

""We have thousands of product reviews but no idea if customers are happy or frustrated — and our infra team says adding AI will take 3 months.""

The Outcome

1

hidden negative review surfaced inside a 4.2★ average — scoring 1M reviews costs ≈ $3.90.

Live demo below

The problem

Your 4.2-star average is hiding a safety complaint.

""We had a 5-star review that said our shelf nearly hit a customer's child. Our dashboard showed 4.2 stars — nothing to action. We only found out when they posted on social media.""

Head of E-commerce, retail company with 50K+ products

Both sides run simultaneously — real API calls, no mocks

Without AI — stars only
Legacy API · raw star scores

Response time

With Workers AI Sentiment
distilbert · every review scored

Response time

The win

⚠️
1
Hidden negative caught
5-star rating, negative sentiment
🔌
0
Backend changes
Worker is additive — origin untouched
<1s
All reviews scored
Parallel inference at the edge

Productionising this

What changes when you ship this for real

Cache by review id

Reviews don't change. Hash (productId, reviewId, content) → KV cache the sentiment result for the review's lifetime. distilbert is cheap but KV is free for hot reads.

Batch via Promise.all

Workers AI is concurrent-safe. The current demo runs all reviews in parallel — keep that pattern. For >50 reviews per request, break into chunks of 25 to stay under subrequest limits.

Sentiment audit log

Every flagged-negative review should be written to a Cloudflare Queue + processed into your incident-management system (PagerDuty, Linear). Don't let a safety complaint sit in a database silo.

Confidence threshold

distilbert returns confidence per label. Filter sentiment.confidence ≥ 0.85 for action items, ≥ 0.6 for analytics — anything below is noise.

Observability

Log via console.error('[sentiment]', err, reviewId). Workers Logs gives you a per-review trace so you can debug why a particular review was misclassified.

Cost ceiling

distilbert: $0.026/M input tokens. Set a Workers AI usage alert in the dashboard at 80% of your monthly budget so a runaway loop doesn't surprise you.