Skip to content

Guide

What is a decision API? A plain-English guide

A decision API returns calibrated probabilities instead of text. Learn how it works, compare benchmarks, and see why teams choose it over LLMs for routing.

Laya Studio7 min read

On this page (8 sections)

You're routing support tickets, but your LLM returns essays instead of labels, wasting tokens and time. A decision API is a specialized endpoint that returns calibrated probabilities for specific questions instead of generating text. It solves the cost and latency issues of using large models for simple classification tasks.

Key takeaways

  • Decision APIs output scores, not prose, reducing cost and hallucination.
  • Calibrated probabilities let you set confidence thresholds for automation.
  • Providers like Laya offer Swiss residency and zero retention for compliance.

What is a decision API?

A decision API accepts text and typed questions, returning probabilities instead of free text. It is built for tasks where you need a clear signal, like routing or scoring, without the overhead of generating sentences.

Traditional large language models (LLMs) are designed to write. When you ask an LLM to classify a customer message, it often responds with a short paragraph explaining its reasoning. This creates parsing overhead and consumes tokens you do not need. A decision API skips the generation step. You send a payload with your input text and a schema of questions, and the model returns a JSON object with scores for each question.

This architecture is faster and cheaper because it avoids the autoregressive decoding loop. In our tests, we see single-shot latency around 120 milliseconds from Europe. This speed allows us to route requests in real time without blocking user interfaces. It also means the model cannot hallucinate a label because there is no text to invent.

For engineers building pipelines, this means you can treat the API as a deterministic function. You define the inputs and outputs, and the system handles the inference. This reduces the boilerplate code usually required to parse LLM responses.

How does an AI classification API differ from an LLM?

An AI classification API differs by outputting structured scores instead of natural language. It is optimized for speed and cost on specific tasks rather than general conversation or content creation.

The core difference lies in the objective function. Generative LLMs predict the next token to minimize perplexity. Classification models predict a label to minimize error on a specific task. While you can fine-tune an LLM to classify, a dedicated API enforces the schema at the architectural level. This prevents format drift and ensures your downstream code always receives valid data.

Here is how the trade-offs compare in a typical production setup:

FeatureDecision APIGenerative LLMRule-Based System
OutputProbability scoreText or JSONLabel only
Latency~120 ms~500 ms+<10 ms
CostLowHighFree
FlexibilitySchema-boundHighLow
HallucinationNonePossibleNone

When you need to process thousands of requests an hour, the cost gap is significant. Using a generative model for a simple yes/no question wastes 90% of the tokens on filler. A decision API charges per question. This pricing model makes it viable for high-volume triage where an LLM would be prohibitively expensive.

However, the API is not a replacement for creative tasks. If you need to draft a response or summarize a document, you still need an LLM. We recommend using a hybrid approach. Use the decision API to tag the intent, then pass high-value tickets to a larger model for writing.

Why do calibrated probabilities matter?

Calibrated probabilities mean the score reflects how often the model is correct. If the model says 80%, it should be right 80% of the time in the long run.

This distinction is vital for automation. In many systems, models output confidence scores that are poorly calibrated. They might be overconfident, giving 99% for wrong answers, or underconfident, giving 50% for clear cases. With uncalibrated scores, you cannot trust the thresholds. You might route urgent tickets to a generic queue because the score was too low.

Calibration ensures your thresholds are meaningful. If you set a rule to auto-approve when probability exceeds 95%, you know the risk is actually 5%. This allows engineers to write safe automation logic without constant manual review. We validate this by comparing predicted scores against ground truth on held-out test sets.

You can see how models perform across different datasets in our public benchmarks. For instance, on the Banking77 dataset, some models score lower than expected compared to specialized systems. Honesty about these numbers helps you choose the right tool. We document these results openly so you can decide if the accuracy meets your use case.

How does a text classification API work in practice?

A text classification API works by sending a JSON payload with your text and desired categories. The endpoint processes the input and returns a structured response with confidence scores for each category.

In practice, this simplifies your stack. Instead of managing GPU instances or writing custom parsers, you call a single HTTP endpoint. You can query multiple questions in one forward pass. For example, you can ask "Is this a complaint?", "What is the topic?", and "Is sentiment negative?" simultaneously. This parallelism saves bandwidth and latency.

The API supports over 100 languages, so you do not need separate models for different regions. This is critical for global applications where maintaining language-specific pipelines is costly. We also ensure zero data retention. Your text is used for inference only and is not stored. This aligns with strict data handling requirements common in health or financial sectors.

Consider a support team routing tickets. They send the message to the API. The response tells them the intent (billing, technical, general) and urgency. The backend routes the ticket automatically based on the scores. If the score is ambiguous, it escalates to a human. This reduces manual triage time and speeds up resolution.

Is this a viable LLM alternative for classification?

Yes, for structured tasks like routing or moderation, a decision API is a viable LLM alternative. It is cheaper, faster, and avoids the generation overhead of larger models.

However, it is not a drop-in replacement for every task. LLMs excel at open-ended understanding and generation. Decision APIs excel at specific, repeated queries. You should choose based on your output requirements. If you need a label, use an API. If you need an essay, use an LLM.

We build our models to be transparent about performance. On standard benchmarks, you will see where we match competitors and where we lag. For example, in specific domain tests, general-purpose models might still outperform specialized ones. We believe in sharing these comparisons so you can evaluate risk.

MetricDecision APILLM Prompting
Cost per 1M queries~$5~$100+
Latency100 ms500 ms+
Schema ControlStrictLoose
ReasoningHiddenExplicit

This table highlights the efficiency gain. If you are processing high volumes, the cost difference is the deciding factor. But if your edge cases are complex, an LLM might catch nuances the API misses. We suggest starting with the API for the bulk of your traffic and falling back to an LLM for low-confidence cases.

How do I choose a provider?

Choose a provider based on latency, data residency, and pricing transparency. Look for open benchmarks and clear documentation on how scores are calculated.

Start by checking the model's performance on your specific data. General benchmarks are useful, but your domain matters. Ask for access to test the API on a sample of your logs. Verify that the provider keeps data private. In regulated industries, data residency laws like GDPR require servers in specific locations. Providers running in Switzerland with zero retention simplify this compliance.

Also check the protocol compatibility. If you are moving from another system, a compatible API saves engineering effort. We support a protocol compatible with TypeSafe Jev, allowing for easier migration without rewriting your client code. Finally, ensure the pricing is predictable. Pay-per-question models help you budget accurately compared to token-based billing.

FAQ

What is the cost of using a decision API?

Pricing is typically per question. We offer 100,000 free questions, then $5 per million. This is significantly cheaper than token-based LLM billing.

Is my data stored by the provider?

No, reputable providers use zero retention. Your text is used for inference only and is not stored after the request completes.

Can I migrate from other systems like Jev?

Yes, protocol compatibility helps. Our API is compatible with TypeSafe Jev's /v1/systemone protocol for easier switching.

Are calibrated probabilities always accurate?

No, they depend on the model and data. We provide benchmarks on specific datasets so you can see performance variance.

Next steps

If you need reliable classification with predictable costs, try a decision API. You can review our documentation, benchmarks, and pricing details at Laya Studio. Start your free tier to see how it fits your pipeline.

Topics

  • decision API
  • AI classification API
  • calibrated probabilities
  • text classification API
  • LLM alternative for classification

Keep reading

Live demo

Reading is good. Trying is better.

See real answers on five example messages, with a calibrated probability for every answer in about a tenth of a second. Sign up and your first 5 runs on your own messages are free.

Example answer, captured live

Answered in Switzerland

“Hi, I was charged twice for order #4821 ($129.00). Please refund the duplicate charge before Friday, our books close then. This is the second billing mistake this quarter and we're starting to look at other vendors.”

What does the customer want?

  • refund100%
  • other<0.1%
  • cancel0%
Is it urgent: 17.7%Might they leave: 30.3%

0 words generated · 3 questions in one pass · 354 ms round trip when captured