router-api / README.md
spectralman's picture
Initial deploy: classifier + FastAPI router
6f0ff99 verified
---
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