---
title: "Classify text (realtime)"
method: POST
path: "/v1/reflex/predict"
tags: ["Reflex"]
---

# Classify text (realtime)

`POST /v1/reflex/predict`

Run a Reflex over text and get a label back in ~90ms. Pass a single `model` for the flat `{model, mode, classes}` envelope, or `models` (an array) to run several classifiers over one shared prefill for `{predictions}`. Use a default Reflex name or a model you trained. Billed per event at the realtime rate.

## Request body

- ReflexPredictRequest
  - `model` string — A default Reflex name (`jailbreak`, `guardrail`, `leaked-thinking`, `stuck-in-a-loop`, `incomplete-thought`, `user-frustrated`, `ambiguity`, `difficulty`, `domain`) or a model you trained (its `fine_tuned_model` name or job id). Pass this **or** `models`.
  - `models` string[] — Run several classifiers over the same `text` in one shared-prefill call. Pass this **or** `model`.
  - `text` string, required — The text to classify. Up to 65,536 tokens.
  - `threshold` number — Override each model's configured selection threshold for this request.

## Response `200`

Prediction. A single `model` returns the flat envelope; `models` returns `{predictions}`.

- union
  - ReflexPredictResponse — Returned when you pass a single `model`.
    - `model` string
    - `mode` 'single_label' | 'multi_label'
    - `classes` ReflexClass[]
      - `class_id` integer — Stable index of the class.
      - `label` string — The class name.
      - `score` number — Confidence for this class, 0–1.
      - `selected` boolean — Whether the server picked this class (top scorer above its threshold). A Reflex can select nothing.
    - `inference_time_ms` number — Server-side classification time only. End-to-end is ~90ms including network.
    - `prefill_tokens` integer — Tokenized input length, charged once per request.
  - ReflexMultiPredictResponse — Returned when you pass `models` (an array). One entry per model, with per-model error isolation.
    - `predictions` ReflexPrediction[]
      - `model` string
      - `mode` 'single_label' | 'multi_label' — `single_label` scores are a softmax summing to 1 (at most one selected); `multi_label` scores are independent 0–1 (zero or more selected).
      - `classes` ReflexClass[]
        - `class_id` integer — Stable index of the class.
        - `label` string — The class name.
        - `score` number — Confidence for this class, 0–1.
        - `selected` boolean — Whether the server picked this class (top scorer above its threshold). A Reflex can select nothing.
      - `error` string — Present instead of `classes` when this model failed.
    - `inference_time_ms` number
    - `prefill_tokens` integer — Charged once for the shared prefill, regardless of how many models ran.

## Other responses

- `400` — Missing `model`/`text`, both `model` and `models`, or `threshold` out of [0,1].
- `401` — Invalid or missing API key.
- `404` — `model_not_found` — a named model doesn't exist.
- `409` — `model_not_ready` — a named model hasn't finished training.

---

[API](https://skmtc.net/morphllm/apis/morph-api.md) · [All operations](https://skmtc.net/morphllm/apis/morph-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/morphllm/morph-api/versions/9e3d888071b5/schema)
