Paths
Everypath parameter is a spec file or a folder of specs, relative to HUNCH_PROJECTS. A path that resolves outside that folder (.., an absolute path, a symlink) is refused with 403.
Authentication
WithHUNCH_SERVER_TOKEN set, every request needs the token, in any one of:
- the header
Authorization: Bearer <token>, - the query parameter
?token=<token>, - a form field
token(the review page’s buttons send it this way).
401. Without HUNCH_SERVER_TOKEN the server is open.
Errors
JSON endpoints (/v1/...) answer errors as {"error": "<message>"}. Pages answer an HTML page with the message.
Cost cap
HUNCH_SERVER_MAX_COST (default 0.01 USD), per judgment per request. Above it, nothing is asked: 422. HUNCH_MAX_COST is ignored.
JSON API
POST /v1/judge
Judges one row, the same as ajudge.
The response is what
ajudge returns: label, p, margin, route and cached for each question.
GET /v1/runs?path=
The project’s runs, newest first, at most 50, from the store’s _hunch_runs table.
status is complete, or failed: <error> for a run that raised.
GET /v1/drift?path=&node=
For each question of one judgment (node may be left out for a one-judgment project), the label mix of every run and how much it changed from the previous run.
change: total variation distance from the previous run’s shares (0 same mix, 1 no overlap; null for the first run). alert: change above 0.10.
Pages
The review queue
The same queue ashunch review, from answers already in the store; asks nothing. audit (default 30): random rows per question to spot-check. Each card shows the state, the model’s top three answers and one button per verdict:
Verdicts are appended to the judgment’s reviews file:
<judgment>.reviews.csv next to its spec, or the file its reviews: key names. The reviewer name is the X-Reviewer header, else the reviewer parameter, else server.
POST /review accepts a verdict only for a row the current queue offers, with the same state hash and kind; anything else is 409, so spot checks stay random.