{"openapi":"3.1.0","info":{"title":"llamajev","description":"TypeSafe Jev-compatible `/v1/systemone` served by an unmodified llama-server: one chat-template render, one cache-warming call, one single-token call per question, candidate-label logprobs renormalized with softmax.","version":"0.1.0"},"paths":{"/v1/systemone":{"post":{"summary":"Evaluate typed questions against a shared state","operationId":"systemone_v1_systemone_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemOneRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemOneResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"Content Too Large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Bad Gateway","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"504":{"description":"Gateway Timeout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"529":{"description":"Additional Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/models":{"get":{"summary":"Models","operationId":"models_v1_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/limits":{"get":{"summary":"Limits","operationId":"limits_v1_limits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LimitsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/health/live":{"get":{"summary":"Live","operationId":"live_health_live_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ChoiceAnswer":{"properties":{"type":{"type":"string","const":"choice","title":"Type","default":"choice"},"choice":{"type":"string","title":"Choice","description":"Option key with the highest probability."},"probabilities":{"additionalProperties":{"type":"number"},"type":"object","title":"Probabilities","description":"Probability per option; sums to 1."},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"1 minus normalized entropy. Not calibrated correctness."}},"additionalProperties":false,"type":"object","required":["choice","probabilities","confidence"],"title":"ChoiceAnswer"},"ChoiceQuestion":{"properties":{"type":{"type":"string","const":"choice","title":"Type"},"instructions":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}],"title":"Instructions","description":"Question or instructions for choosing one option."},"criteria":{"additionalProperties":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"},{"type":"null"}]},"type":"object","maxProperties":64,"minProperties":2,"title":"Criteria","description":"Map of 2-64 option keys to descriptions (string, object or array). The model sees only the description, or the option key when its description is null. Returned answers use the keys. TypeSafe allows 255 options; this server's single-token labels cap it at 64."}},"additionalProperties":false,"type":"object","required":["type","instructions","criteria"],"title":"ChoiceQuestion"},"ErrorDetail":{"properties":{"message":{"type":"string","title":"Message"},"code":{"type":"string","enum":["validation","body_too_large","unknown_model","too_many_tokens","unsupported_content","backend_unreachable","backend_error","backend_timeout","readout_truncated","overloaded","client_disconnected"],"title":"Code"}},"additionalProperties":false,"type":"object","required":["message","code"],"title":"ErrorDetail"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail"}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse"},"HealthResponse":{"properties":{"status":{"type":"string","enum":["ok","unavailable"],"title":"Status"},"backend_url":{"type":"string","title":"Backend Url"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"n_slots":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Slots"},"n_ctx":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Ctx"},"vision":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Vision"},"labels_verified":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Labels Verified"},"startup_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Startup Seconds"}},"additionalProperties":false,"type":"object","required":["status","backend_url"],"title":"HealthResponse"},"JsonValue":{},"LimitsResponse":{"properties":{"max_answers_per_question":{"type":"integer","title":"Max Answers Per Question"},"max_questions":{"type":"integer","title":"Max Questions"},"max_body_bytes":{"type":"integer","title":"Max Body Bytes"},"max_input_tokens":{"type":"integer","title":"Max Input Tokens"},"max_concurrent_requests":{"type":"integer","title":"Max Concurrent Requests"},"top_n":{"type":"integer","title":"Top N"}},"additionalProperties":false,"type":"object","required":["max_answers_per_question","max_questions","max_body_bytes","max_input_tokens","max_concurrent_requests","top_n"],"title":"LimitsResponse"},"ModelsResponse":{"properties":{"object":{"type":"string","const":"list","title":"Object","default":"list"},"data":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Data"},"models":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Models"}},"additionalProperties":false,"type":"object","required":["data","models"],"title":"ModelsResponse"},"NoulAnswer":{"properties":{"type":{"type":"string","const":"noul","title":"Type","default":"noul"},"noul":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Noul","description":"Probability of true, normalized over true/false."}},"additionalProperties":false,"type":"object","required":["noul"],"title":"NoulAnswer"},"NoulCriteria":{"properties":{"true":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}],"title":"True","description":"Meaning of a positive answer.","default":"Yes"},"false":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}],"title":"False","description":"Meaning of a negative answer.","default":"No"}},"additionalProperties":false,"type":"object","title":"NoulCriteria"},"NoulQuestion":{"properties":{"type":{"type":"string","const":"noul","title":"Type"},"instructions":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}],"title":"Instructions","description":"The yes/no question or evaluation instructions."},"criteria":{"$ref":"#/components/schemas/NoulCriteria","description":"Optional definitions of true and false."}},"additionalProperties":false,"type":"object","required":["type","instructions"],"title":"NoulQuestion"},"ScoreAnswer":{"properties":{"type":{"type":"string","const":"score","title":"Type","default":"score"},"score":{"type":"number","minimum":0.0,"title":"Score","description":"Expected zero-based level index."},"legend":{"additionalProperties":{"type":"string"},"type":"object","title":"Legend","description":"Stringified level index to rubric description (structured levels serialized as JSON)."},"probabilities":{"additionalProperties":{"type":"number"},"type":"object","title":"Probabilities","description":"Probability per level index; sums to 1."},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"1 minus normalized entropy. Not calibrated correctness."}},"additionalProperties":false,"type":"object","required":["score","legend","probabilities","confidence"],"title":"ScoreAnswer"},"ScoreQuestion":{"properties":{"type":{"type":"string","const":"score","title":"Type"},"instructions":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}],"title":"Instructions","description":"Question or instructions for applying the rubric."},"criteria":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}]},"type":"array","maxItems":64,"minItems":2,"title":"Criteria","description":"Ordered rubric, lowest to highest (strings, objects or arrays). Scores use zero-based indices: three descriptions correspond to levels 0, 1, and 2."}},"additionalProperties":false,"type":"object","required":["type","instructions","criteria"],"title":"ScoreQuestion"},"SystemOneRequest":{"properties":{"state":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"},{"items":{"$ref":"#/components/schemas/JsonValue"},"type":"array"}],"title":"State","description":"Shared text, structured JSON, or a chat transcript to evaluate. Chat messages may carry image_url parts (data: URIs) when the backend was started with an mmproj."},"model":{"type":"string","minLength":1,"title":"Model","description":"jev-latest or the served model name."},"questions":{"additionalProperties":{"oneOf":[{"$ref":"#/components/schemas/NoulQuestion"},{"$ref":"#/components/schemas/ChoiceQuestion"},{"$ref":"#/components/schemas/ScoreQuestion"}],"discriminator":{"propertyName":"type","mapping":{"choice":"#/components/schemas/ChoiceQuestion","noul":"#/components/schemas/NoulQuestion","score":"#/components/schemas/ScoreQuestion"}}},"type":"object","maxProperties":64,"minProperties":1,"title":"Questions","description":"1-64 questions keyed by your own identifiers; the response preserves them."}},"additionalProperties":false,"type":"object","required":["state","model","questions"],"title":"SystemOneRequest","example":{"model":"jev-latest","questions":{"department":{"criteria":{"billing":"Payments and refunds","technical":"Software bugs"},"instructions":"Which department should handle this?","type":"choice"},"refund":{"instructions":"Does the user request a refund?","type":"noul"},"urgency":{"criteria":["Routine","Urgent","Emergency"],"instructions":"How urgent is this?","type":"score"}},"state":"I was charged twice. Please refund the duplicate."}},"SystemOneResponse":{"properties":{"model":{"type":"string","title":"Model"},"answers":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/NoulAnswer"},{"$ref":"#/components/schemas/ChoiceAnswer"},{"$ref":"#/components/schemas/ScoreAnswer"}]},"type":"object","title":"Answers"},"usage":{"$ref":"#/components/schemas/Usage"}},"additionalProperties":false,"type":"object","required":["model","answers","usage"],"title":"SystemOneResponse"},"Usage":{"properties":{"input_tokens":{"type":"integer","minimum":0.0,"title":"Input Tokens","description":"Backend prompt tokens summed over warm-up and branches, cached included."},"output_tokens":{"type":"integer","minimum":0.0,"title":"Output Tokens","description":"N + 1 for N questions."}},"additionalProperties":false,"type":"object","required":["input_tokens","output_tokens"],"title":"Usage"}},"securitySchemes":{"HTTPBearer":{"type":"http","description":"API key. Send `Authorization: Bearer <key>` on /v1/* endpoints. Omit only if the server was started without an API key (local use).","scheme":"bearer"}}}}