Classification
A transparent heuristic. Not a hidden model.
Every request is classified before it is routed. The same rules live in Python and in the TypeScript SDK.
Output
json
{
"p_small_quality": 0.43,
"recommended_tier": "frontier",
"complexity": 5,
"category": "system_design"
}P(quality | small)
The classifier does not answer easy/hard. It estimates the chance an economy or standard model will clear the quality bar. ≥ 0.90 routes economy, ≥ 0.72 standard, below that frontier. Complexity and category are features that move the probability — not the routing rule.
Signals
Length, code fences, language keywords, math, design language, proofs, races, safety terms, and constraint words. Categories include factual_recall, math, code_generation, code_debug, system_design, reasoning, analysis, and safety_sensitive.
Offline
ts
import { classifyText } from "promptimizer";
classifyText("Design a rate limiter for 1 million QPS");