Text Classification API With Custom Labels in 2026: Use an LLM Enum Schema, and Calibrate for Thresholds
Google shut down AutoML Text and Azure custom text classification retires in 2029. An enum schema on OpenAI, Claude or Gemini is the default now, but its confidence field cannot set a review threshold.
For most teams in 2026, the best API for text classification with custom labels is an LLM called with an enum structured-output schema. OpenAI Structured Outputs, Claude structured outputs and Gemini's enum output all support it. The schema makes every answer one of your labels, but it does not make the answer correct. A confidence number that the model writes into the JSON is not a calibrated probability. If you need a rule such as "send to a human below 0.8," use a model that returns probabilities per label and check them against your own labelled items.
The trained-classifier services are closed, retiring or frozen
The older route was to label a few thousand examples and train a classifier inside a cloud service. That route is narrowing on every major cloud.
Google deprecated Vertex AI AutoML Text on September 15, 2024, and its deprecations page says that existing models could be used only until June 15, 2025. Google's replacement is "moving to Vertex AI Gemini prompts and tuning." Its own comparison page states the main loss plainly: "Gemini doesn't support confidence scores."
Microsoft's custom text classification page now opens with a banner that says the feature "retires from Azure Language on March 31, 2029." Its model lifecycle table adds an earlier date. The current training configuration expires on March 31, 2028, and after that date training requests with an expired configuration return an error. Microsoft's June 10, 2026 transition post recommends "fine-tuning a foundation model with your data" in Foundry and suggests Ministral-3B as the base.
Amazon Comprehend is the exception. Its April 30, 2026 change closed topic modeling, event detection and prompt safety classification to new customers, and AWS says that the change "does not impact the availability of other Amazon Comprehend features." Custom classification is still open.
| Service | Status on November 24, 2026 | Key date |
|---|---|---|
| Vertex AI AutoML Text | Shut down | June 15, 2025 |
| Azure custom text classification | Retiring | Training config expires March 31, 2028; service ends March 31, 2029 |
| Amazon Comprehend custom classification | Available | Other Comprehend features closed to new customers April 30, 2026 |
| OpenAI fine-tuning | Closed to new users | Existing customers can create jobs until January 6, 2027 |
The OpenAI row matters for anyone who planned to fine-tune a small OpenAI model as a classifier. Its fine-tuning guide now opens with "OpenAI is winding down the fine-tuning platform."
An enum schema guarantees a valid label, not a correct one
Structured outputs work by constrained decoding. The API compiles your JSON schema into a grammar, and the model can only produce tokens that fit it. When the label field is an enum, the model cannot invent a label, misspell one or return free text in its place.
That guarantee covers the format, and each provider says so. OpenAI's guide says that Structured Outputs "constrains completed, non-refusal model output" and that applications must still "validate any business rules that the schema does not express." Google's Gemini guide advises developers to plan for "schema-compliant but semantically incorrect outputs."
Each API has a few details that change how you build the classifier:
- On OpenAI, you set
text.formattotype: "json_schema"withstrict: true, and a schema can hold up to 1,000 enum values across all enum properties. That limit is large enough for most intent and ticket-topic sets. - On Claude, you pass the schema in
output_config.format, and Anthropic warns that structured outputs do not guarantee capitalization of enum values. Compare labels case-insensitively, and avoid two labels that differ only in case. - On Claude, the first request with a new schema is slower while the grammar compiles, and the compiled grammar is cached for 24 hours from last use. A change to the structure of the schema clears that cache.
- On Gemini, a string
enumis documented as the tool for "classification tasks," and Vertex AI also accepts a plaintext/x.enumresponse type that returns just the label.
Two design choices matter more than the provider. The first is a "none of these" label. An enum forces a choice, so an item that fits no category will be assigned to the nearest wrong one unless the schema offers an exit. The second is a short description for each label in the prompt, because the model sees only the label name otherwise. Refusals and responses cut off at max_tokens can still break the schema on Claude, so the code that reads the label needs a fallback path.
A confidence field that the model writes is not a calibrated probability
A classifier is calibrated when its stated probabilities match how often it is right. Among items that it scores at 0.8, about 80 percent should be correct. Only a calibrated score can set a threshold that sends uncertain items to a person.
Anthropic's own classification example includes a confidence field next to the category. That field is text that the model generates, like any other field. Research on this pattern points the wrong way for thresholds: Xiong and co-authors found that "LLMs, when verbalizing their confidence, tend to be overconfident." An overconfident score lets wrong labels through above the threshold.
The useful measure is coverage at a precision target. You sort items by score, then find the share that you can resolve automatically while keeping 95 percent of those labels correct. A calibrated score lets you pick that cut-off once and expect it to hold. A self-reported score gives no such assurance, because nothing ties its values to error rates.
Four kinds of option return a score that is meant to be a probability:
- Google's Gemini Decisions API returns a
probabilitiesmap that sums to 1 and aconfidencevalue for single-choice questions with 2 to 255 options. Google calls these "calibrated probabilities" but publishes no method or accuracy figures. Its guide also warns that the API distributes probability "across your options, even when none fits," so a "none" option is still needed. The endpoint isv1beta, and it supports neither the Batch API nor context caching. - Amazon Comprehend custom classification returns a
Scorefor each class. It needs training data, at least 50 documents per class in CSV form for multi-class mode, and supports up to 1,000 classes. - An embeddings model plus logistic regression that you train yourself produces probabilities that scikit-learn's documentation describes as "more likely" to be well calibrated by default. Its
CalibratedClassifierCVclass can correct the rest with sigmoid or isotonic calibration. - A dedicated decision model ranks a fixed list of options and returns a probability for each.
Parsec, a small language model lab, offers one decision model of this kind, called TOD. Its predict call takes a list of options and returns one probability per option, summing to 1, and the repo says that it was measured with up to 300 options. The TOD page lists $0.30 per 1,000 decisions, billed on input only. Parsec has not published accuracy or calibration results for custom-label text classification, and the released adapters need Google's Gemma 4 base weights under the Gemma licence.
Cost per 1,000 items runs from under a cent to several dollars
Price depends far more on the model tier than on the provider. The figures below use list prices and one set of assumptions. Each item is a support ticket of 300 tokens, the prompt adds 700 tokens of label names and descriptions, and the answer is 15 tokens. For Comprehend, which bills by characters, the same ticket is assumed to be 1,200 characters.
| Approach | Cost per 1,000 items | Per month at 100,000 items a day |
|---|---|---|
OpenAI gpt-6-luna, enum schema |
$0.11 | $322.50 |
| Gemini Decision 1, choice question | $0.10 | $300 |
| Claude Sonnet 5.5, enum schema | $2.15 | $6,450 |
| Comprehend custom, asynchronous | $6.00 | $18,000 |
| Embeddings plus logistic regression | $0.006 plus your own compute | $18 plus compute |
The gpt-6-luna figure is 1 million input tokens at $0.10 per million plus 15,000 output tokens at $0.50 per million. If the 700 shared prompt tokens are billed at OpenAI's $0.01 cached rate, the cost falls to about $0.04 per 1,000. Claude Haiku 5.5 has the same list rates as gpt-6-luna. Anthropic says that its newer tokenizer produces about 30 percent more tokens for the same text, which puts Haiku 5.5 at about $0.14 per 1,000. Gemini Decision 1 bills only input, at $0.10 per million tokens.
Comprehend's price is $0.0005 per 100 characters, so a 1,200-character ticket costs $0.006. A real-time Comprehend endpoint costs $1,296 a month for each inference unit that runs for 30 days, whether it is called or not. At this volume the endpoint needs about 14 units, which brings it to about the same $18,000 a month.
The break-even point for a trained classifier follows from the gap. Against gpt-6-luna without caching, an embeddings classifier saves about $101.50 per million items. At 3 million items a month that is about $305, so the trained model pays for itself only if building and running it costs less. Against Claude Sonnet 5.5, the saving is about $6,430 a month at the same volume. Latency for these options on the same hardware and network has not been measured.
The right choice depends on labels, data, volume and thresholds
Five common situations each point to a different option:
- If you have little or no labelled data and fewer than a few hundred labels, start with a small LLM and an enum schema. Changing a label then means editing the prompt and schema, not retraining.
- If you need a review threshold that holds, use a probability-returning option: Gemini Decision 1, a calibrated embeddings classifier or a decision model. Then check its calibration on your own data before you trust any cut-off.
- If you classify millions of items a day with a stable label set, label a few thousand items with an LLM and train an embeddings classifier on them. At about $0.006 per 1,000 items, the API bill becomes almost irrelevant.
- If you run Azure custom text classification today, plan the move before March 31, 2028. That is the posted expiry of the current training configuration. Microsoft may extend it, but training requests with an expired configuration return an error.
- If you are already on Comprehend custom classification, it remains open and returns a per-class score. Its per-character price is far above the small LLMs at this ticket size.
No published test compares these options on the same custom labels
No provider or independent group has published accuracy, macro-F1, calibration error or coverage at 95 percent precision for these approaches on the same custom-label datasets. Google publishes no accuracy figures for Gemini Decision 1, and Parsec publishes none for TOD on this task. The only reliable comparison is one that you run on your own items.
A test that settles the choice takes a few days:
- Pull 200 to 500 real items from production, and have two people label each one with your label set, including "none of these."
- Run two or three candidates on the same items: one small LLM with an enum schema, one probability-returning option and, if you have training data, an embeddings classifier.
- Record accuracy or macro-F1 for each, plus the cost per 1,000 items from the bill and the median response time.
- For the options that return probabilities, plot a reliability diagram, which shows observed accuracy against predicted probability in bins. Then find the share of items that each option resolves at 90 and 95 percent precision.
- Keep the cheapest option that meets your accuracy bar, and set its review threshold from the coverage curve rather than from the model's own confidence field.
Sources
- Google Cloud, Vertex AI deprecations: https://docs.cloud.google.com/vertex-ai/docs/deprecations
- Google Cloud, AutoML Text and Gemini comparison: https://docs.cloud.google.com/vertex-ai/docs/start/automl-gemini-comparison
- Google Cloud, Control generated output (Vertex AI): https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output
- Google, Gemini API structured output: https://aistudio.google.com/docs/structured-output
- Google, Gemini Decisions API: https://aistudio.google.com/docs/decisions-api
- Google, Gemini Decision 1 model page: https://aistudio.google.com/docs/models/gemini-decision-1
- Google, Gemini API pricing: https://aistudio.google.com/docs/pricing
- Microsoft Learn, Custom text classification overview: https://learn.microsoft.com/en-us/azure/ai-services/language-service/custom-text-classification/overview
- Microsoft Learn, Model lifecycle for Azure Language: https://learn.microsoft.com/en-us/azure/ai-services/language-service/concepts/model-lifecycle
- Microsoft Tech Community, Transitioning from Azure Language features to Foundry models: https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/transitioning-from-azure-language-features-to-foundry-models/4524092
- AWS, Amazon Comprehend feature availability change: https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-availability-change.html
- AWS, Amazon Comprehend document history: https://docs.aws.amazon.com/comprehend/latest/dg/doc-history.html
- AWS, Amazon Comprehend guidelines and quotas: https://docs.aws.amazon.com/comprehend/latest/dg/guidelines-and-limits.html
- AWS, ClassifyDocument API reference: https://docs.aws.amazon.com/comprehend/latest/APIReference/API_ClassifyDocument.html
- AWS, Amazon Comprehend pricing: https://aws.amazon.com/comprehend/pricing/
- OpenAI, Structured Outputs guide: https://developers.openai.com/api/docs/guides/structured-outputs
- OpenAI, Supervised fine-tuning guide: https://developers.openai.com/api/docs/guides/supervised-fine-tuning
- OpenAI, API pricing: https://developers.openai.com/api/docs/pricing
- Anthropic, Structured outputs: https://platform.claude.com/docs/en/build-with-claude/structured-outputs
- Anthropic, Pricing: https://platform.claude.com/docs/en/about-claude/pricing
- Xiong et al., Can LLMs Express Their Uncertainty?: https://arxiv.org/abs/2306.13063
- scikit-learn, Probability calibration: https://scikit-learn.org/stable/modules/calibration.html
- Parsec, TOD: https://parseclab.ai/tod/
- Parsec, TOD repository: https://github.com/daseinlabs/tod
- Parsec, TOD model card: https://huggingface.co/parsecai/tod