Step 1: score each review
def analyse(review):
r = client.chat.completions.create(model="claude-haiku-5-5", temperature=0, messages=[{"role": "user", "content":
f'Review: "{review[:1500]}"\nReturn JSON: {{"sentiment": "positive|neutral|negative", "score": -1.0 to 1.0, "themes": [up to 3 short themes], "feature_request": string|null}}'}])
return json.loads(r.choices[0].message.content)Process reviews concurrently with a small worker pool (see rate limits).
Step 2: aggregate in code
from collections import Counter
themes = Counter(t for r in results for t in r["themes"])
negative = [r for r in results if r["sentiment"] == "negative"]
print(themes.most_common(15))Counting in code is free and exact; don't ask the model to count thousands of items.
Step 3: summarise the insights
report = client.chat.completions.create(model="claude-sonnet-4-6", messages=[{"role": "user", "content":
f"Top themes: {themes.most_common(20)}\nSample negative reviews: {[r['text'] for r in negative[:30]]}\n"
"Write a 1-page report: what customers love, the top 3 problems with examples, and recommended fixes."}])Tips
- Theme names drift (“slow delivery” vs “late shipping”). Give the model a fixed list of themes after a first exploratory pass.
- Keep a sample for manual checking; it's how you know the numbers are trustworthy.
Claude, GPT, Gemini, DeepSeek, image and video models through one OpenAI- and Anthropic-compatible endpoint. Prepaid, pay only for what you use.