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
payload.json
JSON
| 1 | { |
| 2 | "p_small_quality": 0.43, |
| 3 | "recommended_tier": "frontier", |
| 4 | "complexity": 5, |
| 5 | "category": "system_design" |
| 6 | } |
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
example.ts
TYPESCRIPT
| 1 | import { classifyText } from "promptimizer"; |
| 2 | classifyText("Design a rate limiter for 1 million QPS"); |