---
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 — Realtime classification request for one Reflex or several over a shared prefill.
  - `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 — Flat single-model envelope, or the `{predictions}` envelope when `models` was passed.
  - ReflexPredictResponse — Returned when you pass a single `model`.
    - `model` string, required — The Reflex that ran.
    - `mode` 'single_label' | 'multi_label', required — How this Reflex scores: one winner (`single_label`) or independent labels (`multi_label`).
    - `classes` ReflexClass[], required — Scores for every class, with `selected` marking what the server picked.
      - `class_id` integer, required — Stable index of the class.
      - `label` string, required — The class name.
      - `score` number, required — Confidence for this class, 0–1.
      - `selected` boolean, required — Whether the server picked this class (top scorer above its threshold). A Reflex can select nothing.
    - `inference_time_ms` number, required — Server-side classification time only. End-to-end is ~90ms including network.
    - `prefill_tokens` integer, required — 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[], required — One entry per requested model, in the order you passed them.
      - `model` string, required — The Reflex that produced this result.
      - `mode` 'single_label' | 'multi_label', required — `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[] — Every class this Reflex scores, ordered by class index.
        - `class_id` integer, required — Stable index of the class.
        - `label` string, required — The class name.
        - `score` number, required — Confidence for this class, 0–1.
        - `selected` boolean, required — 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, required — Server-side time to run every model over the shared prefill.
    - `prefill_tokens` integer, required — Charged once for the shared prefill, regardless of how many models ran.

## Other responses

- `400` — Malformed request — missing or invalid fields.
- `401` — Missing or invalid API key.
- `429` — Rate limited — retry after the interval in the Retry-After header.
- `500` — Internal error — safe to retry with backoff.

## Changes

- **2026-08-13** `b9a74274b2ab` — 2 warning, 14 info
  - removed the optional property `error/type` from the response with the `400` status
  - removed the optional property `error/type` from the response with the `401` status
  - api operation id `reflexPredict` removed and replaced with `predictReflex`
  - the endpoint scheme security `bearerAuth` was added to the API
  - …12 more

[Change history](https://skmtc.dev/morphllm/apis/morph-api/changes/v1/reflex/predict/post.md)

---

[API](https://skmtc.dev/morphllm/apis/morph-api.md) · [All operations](https://skmtc.dev/morphllm/apis/morph-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/morphllm/morph-api/revisions/b9a74274b2ab/schema)
