--- title: Router Classify API emoji: 🛰️ colorFrom: green colorTo: indigo sdk: docker pinned: false license: other license_name: polyform-noncommercial-1.0.0 license_link: https://polyformproject.org/licenses/noncommercial/1.0.0 --- # Router Classify API REST endpoint that runs the GreenRouting classifier and returns a routing decision against a configurable downstream model registry. ## Endpoints - `POST /classify` — Run the classifier and pick a model. - Request: `{ "message": "...", "recentMessages": [{"role": "...", "content": "..."}] }` - Response: `{ "category", "complexity", "model_id", "capability_weights", "difficulty", "energy_savings_pct", "method", "reason" }` - `GET /health` — Liveness probe. ## Configuration The registry of candidate models is supplied at runtime via a Space secret. Set one of: - `PARTNER_REGISTRY_JSON` — the registry as raw JSON (preferred) - `PARTNER_REGISTRY_PATH` — a file path inside the container Other env vars: - `CLASSIFIER_ARTIFACT_DIR` — defaults to `models/classifier_v1` - `INCLUDE_REASON` — `1` (default) to include the `reason` string in responses, `0` to omit