Authenticate using a bearer API key. Send JSON containing model, state and a nonempty questions object. Question names identify corresponding entries in answers. The usage object reports the number of input and output tokens.
{
"model": "ngila-judge",
"state": "The book is red.",
"questions": {
"red": {
"type": "noul",
"instructions": "Is the book red?"
}
}
}Response
{
"model": "ngila-judge",
"answers": {
"red": {
"type": "noul",
"noul": 0.98065,
"probabilities": {
"yes": 0.98065,
"no": 0.01935
},
"confidence": 0.98065
}
},
"usage": {
"input_tokens": 94,
"output_tokens": 0
}
}Errors
401 indicates missing or revoked authorization. 402 means insufficient credit. Check the model identifier and question definitions for 400 or 422. On a 503, retry transient inference failures with a bounded backoff.
Request fields
Supply one state value and an object mapping unique question names to definitions. Pass the assets map when any question needs a photo.
| Field | Meaning |
|---|---|
| model | ngila-judge |
| state | Evidence shared by the questions. |
| questions | Each entry declares a question type. Span requires instructions and accepts no criteria. |
| assets | Named JPEG or PNG data. JSON accepts base64; multipart can reference a file part. |
Timing
The Server-Timing header contains the Ngila handler duration in milliseconds. The Playground shows this separately from the remaining round-trip time.
Authentication
Send the workspace key as Authorization: Bearer $NGILA_API_KEY. Use application/json for JSON requests, or send the request and its files as multipart form data.
Cache affinity
Optionally send X-Ngila-Affinity with a stable ID of your choice, up to 256 characters: a session or conversation ID when you have one, otherwise an account or end-user ID. Requests with the same value go to the same model replica, so a state that grows by appending (an agent transcript, a chat) reuses the part already processed and returns faster. Omit it and requests are spread across replicas. The value only affects routing, never answers, and is not shared across workspaces.
Use the response
Read answers by question name and check each answer’s type before reading the primitive-specific fields. Use usage.input_tokens when reconciling request costs. See request rules and errors.