File size: 1,149 Bytes
e9564be
6f0ff99
 
 
 
e9564be
 
6f0ff99
 
 
e9564be
 
6f0ff99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
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