{"openapi":"3.1.0","info":{"title":"Jev API","version":"1.0.0","description":"Jev answers typed questions about any state (text, object or array) with a choice, a score on your scale, or a yes/no likelihood, plus probabilities. Each call uses prepaid credits."},"servers":[{"url":"https://www.getjevai.com"}],"security":[{"bearerAuth":[]}],"paths":{"/api/v1/decisions":{"post":{"operationId":"createDecision","summary":"Answer questions about a state","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRequest"},"example":{"state":{"message":"This is the third time my order arrived broken. I want a refund."},"questions":{"sentiment":{"type":"score","instructions":"How upset is the customer?","criteria":["calm","annoyed","angry"]},"route":{"type":"choice","instructions":"Which team handles this?","criteria":{"refunds":"Refund requests","shipping":"Delivery problems","sales":"New purchases"}},"churn":{"type":"noul","instructions":"The customer is likely to cancel."}}}}}},"responses":{"200":{"description":"Answers, one per question","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionResponse"},"example":{"id":"gen-dec-1790301303-…","model":"typesafe/jev-1.13","answers":{"sentiment":{"type":"score","score":1.87,"legend":{"0":"calm","1":"annoyed","2":"angry"},"probabilities":{"0":0,"1":0.13,"2":0.87},"confidence":0.81},"route":{"type":"choice","choice":"refunds","probabilities":{"refunds":0.96,"shipping":0.04,"sales":0},"confidence":0.94},"churn":{"type":"noul","noul":0.64}},"usage":{"input_tokens":398,"output_tokens":72,"credits":0.84},"credits_remaining":99999.16}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"401":{"description":"Missing, invalid or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"402":{"description":"Not enough credits","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"413":{"description":"Body over 100 KB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"502":{"description":"Jev is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}}}},"/api/v1/balance":{"get":{"operationId":"getBalance","summary":"Credits balance","responses":{"200":{"description":"Credits left on the account","content":{"application/json":{"schema":{"type":"object","properties":{"credits":{"type":"number"}},"required":["credits"]}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key starting with jev_"}},"schemas":{"DecisionRequest":{"type":"object","required":["state","questions"],"properties":{"state":{"description":"The context Jev judges: a string, object or array.","oneOf":[{"type":"string"},{"type":"object"},{"type":"array"}]},"questions":{"type":"object","description":"Up to 20 questions, keyed by the name you want in the response.","minProperties":1,"maxProperties":20,"additionalProperties":{"$ref":"#/components/schemas/Question"}}}},"Question":{"oneOf":[{"title":"choice","type":"object","required":["type","instructions","criteria"],"properties":{"type":{"const":"choice"},"instructions":{"type":"string"},"criteria":{"type":"object","description":"Label → description","additionalProperties":{"type":"string"}}}},{"title":"score","type":"object","required":["type","instructions","criteria"],"properties":{"type":{"const":"score"},"instructions":{"type":"string"},"criteria":{"type":"array","description":"Levels, lowest first","minItems":2,"items":{"type":"string"}}}},{"title":"noul","type":"object","required":["type","instructions"],"properties":{"type":{"const":"noul"},"instructions":{"type":"string","description":"A statement; the answer is the probability it's true."},"criteria":{"type":"object","properties":{"true":{"type":"string"},"false":{"type":"string"}}}}}]},"DecisionResponse":{"type":"object","required":["model","answers","usage","credits_remaining"],"properties":{"id":{"type":"string"},"model":{"type":"string"},"answers":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Answer"}},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"credits":{"type":"number","description":"Credits this call used"}}},"credits_remaining":{"type":"number","description":"Credits left after this call"}}},"Answer":{"oneOf":[{"title":"choice","type":"object","properties":{"type":{"const":"choice"},"choice":{"type":"string"},"confidence":{"type":"number"},"probabilities":{"type":"object","additionalProperties":{"type":"number"}}}},{"title":"score","type":"object","properties":{"type":{"const":"score"},"score":{"type":"number","description":"0 to the last level's index, probability-weighted"},"confidence":{"type":"number"},"legend":{"type":"object","additionalProperties":{"type":"string"}},"probabilities":{"type":"object","additionalProperties":{"type":"number"}}}},{"title":"noul","type":"object","properties":{"type":{"const":"noul"},"noul":{"type":"number","minimum":0,"maximum":1}}}]}}}}