Classify and Tag Tickets, Reviews and Leads at Scale with AI
Sort support tickets, tag product reviews and score leads with a low-priced AI model. Labels, prompts, JSON output, checking accuracy and cost per 10,000 items.

Some of the best returns on AI come from the plainest jobs: putting a label on each of thousands of short texts. Which team should get this ticket? Is this review about delivery, quality or price? Is this lead worth a call? A small model does this quickly and cheaply, and once it is set up it runs on its own. This guide shows how.
Where it helps
- Support tickets: route to billing, technical or sales; flag urgent ones.
- Reviews and survey answers: tag the topic and the sentiment, then count.
- Leads and sign-ups: sort by company size, industry, intent.
- Content moderation: flag posts that need a person to look.
- Search and analytics: add tags to old records so they can be filtered.
1. Define the labels
Write down every label with a one-line description and one or two examples. Clear labels matter more than the model:
billing Payments, invoices, refunds, top-ups. "I was charged twice." technical Errors, API problems, integration questions. "I get a 401." account Login, password, email, deleting an account. sales Prices for large volume, contracts, partnerships. other Anything else.
Always include an "other" label. Without it, the model has to force odd texts into the wrong box.
2. Ask for JSON
Use a JSON schema with an enum, so the answer can only be one of your labels:
import json
from openai import OpenAI
client = OpenAI(base_url="https://api.apistore.cloud/v1", api_key="sk-...")
LABELS = ["billing", "technical", "account", "sales", "other"]
schema = {
"type": "object",
"properties": {
"label": {"type": "string", "enum": LABELS},
"urgent": {"type": "boolean"},
},
"required": ["label", "urgent"],
"additionalProperties": False,
}
def classify(text):
reply = client.chat.completions.create(
model="gemini-3.1-flash-lite",
messages=[
{"role": "system", "content": LABEL_GUIDE}, # the list from step 1, same every time
{"role": "user", "content": text},
],
response_format={"type": "json_schema", "json_schema": {"name": "ticket", "schema": schema, "strict": True}},
)
return json.loads(reply.choices[0].message.content)Put the label guide in the system prompt and keep it the same for every request: it is then read from cache at the lower cached price.
If your model supports it, set reasoning_effort to low. Classification rarely needs long thinking, and thinking tokens are billed as output.
3. Pick the smallest model that is accurate enough
Start with a low-priced model and only move up if it misses:
| Model | Input / output per 1M tokens |
|---|---|
gemini-3.1-flash-lite | see the price list / see the price list |
gpt-6-luna | $0.07 / $0.35 |
claude-haiku-5-5 | $0.07 / $0.35 |
To choose, label 200 real texts by hand, run each model over them, and count how many it gets right. Look at the mistakes: often they show a label that needs a better description, not a better model.
4. Run it at volume
- Send in parallel, a few requests at a time, and keep within your key's rate limit.
- Retry 429 and 5xx with a short wait; see errors and retries.
- Save each result with the model name and the date, so you can rerun with a better model later and compare.
- Use a separate key for the batch job, with a daily spending cap, so a bug can't spend more than you planned.
What it costs
A ticket or review is typically 100–300 tokens, the label guide a few hundred more (mostly cached after the first request), and the JSON answer about 15–20 tokens. So for 10,000 texts:
- Input: about 10,000 × 300 = 3 million tokens of new text, plus the cached guide.
- Output: about 10,000 × 20 = 0.2 million tokens.
On Gemini 3.1 Flash Lite that is 3 × see the price list plus 0.2 × see the price list, plus the cached guide at see the price list per million. Run the first thousand and read the real total on the Usage page before you run the rest.
Keep it honest
Once a week, take 50 newly labelled texts and check them by hand. If accuracy drops, your texts have probably changed: a new product, a new kind of complaint. Add a label or an example, and run your test set again before you switch.
Also in Tiếng Việt, Español, Português, Bahasa Indonesia



