> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opper.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Classifier node

> Route each request by intent: a decision model reads the request, picks one of your cases, and the route sends it to that case's model.

A classifier node routes on what a request is about, such as its intent,
topic, or complexity, which an If / Else condition can't express. You
describe up to ten cases in plain words. On every request, a model reads the
user's message, picks the case it belongs to, and the route follows that
case's branch: short, simple requests to a fast, cheap model, and multi-step
work to a frontier model.

By default, the model that decides is a
[decision model](https://docs.opper.ai/build/gateway/decision-models.md). It answers with a
probability for each case instead of writing text, which keeps the
classification fast enough to run in front of every request.

![A classifier's inspector with two cases, simple and complex. A tried message lands in simple at 98%, decided by typesafe/jev-latest, with the model on Automatic](https://mintcdn.com/opper/zA9OWIY9iAGUbLjg/images/routes/route-classifier-inspector.png?fit=max\&auto=format\&n=zA9OWIY9iAGUbLjg\&q=85\&s=e28582d9682d53b1986c1617954f972a)

## Add a classifier

Click the **+** on an edge and choose **Classifier**. Give each case:

* **A name**, which is the answer the model gives. Names must be unique,
  ignoring case.
* **A description** of the requests that belong to it, such as "Multi-step
  reasoning, code generation, or long-form work."

Then connect each case to the node that should answer it: a model, a pool,
or another If / Else, split, or classifier. Each case needs a node of its
own, because a node takes only one incoming edge. A classifier needs at
least two cases and takes up to ten.

**Context** is optional. Use it to say what the route serves, such as "This
route serves a customer support assistant," so that similar cases are
easier to tell apart.

## Try a message

Once two cases have names, type a message below them to see which case it
lands in. With a decision model, every case also shows its probability, so
you can see how close the call was and sharpen a description before you
publish. Trying a message uses the node as you are editing it, unsaved
changes included, and is neither billed nor recorded.

## Choose the model

The **Model** setting picks which model classifies.

**Automatic**, the default, tries a decision model first. If that call is
refused or fails, it moves on to general chat models, for example when your
[model access rules](https://docs.opper.ai/control-plane/rules/model-access.md) exclude the
decision model by provider or by location. Hover the setting to see the
models it tries, in order. Opper may update that list, and a route on
Automatic follows it without being republished.

To pin a model, pick it in the **Model** setting: any decision model or chat
model your rules allow, such as a newer decision model you have tried on
your own messages. A pinned model has no fallback: if it fails, is retired,
or is denied by your rules, the classifier fails. Choose **Automatic** again
to go back.

On the free plan, decision models and the chat models Automatic falls back
to all need a paid plan, so a classifier on Automatic fails. Pin a free chat
model instead.

To list the decision models, call
[`GET /v3/models?type=evaluation`](https://docs.opper.ai/v3-api-reference/models/list-models).
Add `&include=policy` to see which of them your rules allow.

Each classification is a call of its own, billed alongside the answer. On a
decision model, it is recorded and billed like a call to
`/v3/compat/decisions`.

## What the classifier reads

The classifier reads the text of the latest user message that has text, up
to its first 4,000 bytes (about 4,000 characters of English). Earlier turns,
the system prompt, images, and tool results are not part of the decision, so
in a conversation each turn is routed on what the user just said.

It runs after your [checks](https://docs.opper.ai/control-plane/rules/checks.md) on input. A call
they block never reaches it, and it reads the text a redaction left.

## When classification fails

A classifier has no default branch. If every model it tries fails, or the
answer matches none of your cases, the route returns `502` with the code
`route_classifier_failed` instead of guessing a branch. Put the safety net
on the nodes that answer: a model's fallbacks, or a pool's fallback edge.

There is no confidence threshold. The case the model picks wins, however
close the call. The probabilities are there for you to inspect.

The call's trace records each classification: the case chosen, the model
that decided, how long it took, and, from a decision model, every case's
probability.

## From the API

In a graph sent through the
[Management API](https://docs.opper.ai/control-plane/management-api.md#deploy-a-dynamic-route-from-code),
a classifier node looks like this:

```json theme={null}
{
  "id": "complexity",
  "type": "classifier",
  "properties": {
    "context": "This route serves a customer support assistant.",
    "cases": [
      { "id": "simple", "label": "simple", "instructions": "Short, low-complexity requests such as greetings or single factual questions." },
      { "id": "complex", "label": "complex", "instructions": "Multi-step reasoning, code generation, or long-form work." }
    ]
  },
  "outputs": {
    "simple": { "elementId": "fast" },
    "complex": { "elementId": "frontier" }
  }
}
```

A case's `label` is its name and `instructions` its description. Each case
`id` needs an output of the same name.

With no `model`, the node is on Automatic.
[Listing your routes](https://docs.opper.ai/v3-api-reference/management/list-dynamic-routes.md)
returns `meta.default_classifier_chain`, the models Automatic tries. To pin
a decision model, set `model` to its full catalog ID, such as
`typesafe/jev-1.14.0`. Unlike on the decision endpoints, a bare name such as
`jev-1.14.0` does not work here: the route deploys, but every request fails
to classify.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.