Create Decision
curl --request POST \
--url https://api.electronhub.ai/v1/systemone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "<string>",
"questions": {},
"model": "jev"
}
'import requests
url = "https://api.electronhub.ai/v1/systemone"
payload = {
"state": "<string>",
"questions": {},
"model": "jev"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: '<string>', questions: {}, model: 'jev'})
};
fetch('https://api.electronhub.ai/v1/systemone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.electronhub.ai/v1/systemone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'state' => '<string>',
'questions' => [
],
'model' => 'jev'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.electronhub.ai/v1/systemone"
payload := strings.NewReader("{\n \"state\": \"<string>\",\n \"questions\": {},\n \"model\": \"jev\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.electronhub.ai/v1/systemone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"state\": \"<string>\",\n \"questions\": {},\n \"model\": \"jev\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/systemone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"state\": \"<string>\",\n \"questions\": {},\n \"model\": \"jev\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "decision",
"model": "jev",
"answers": {},
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}API Reference
Decisions
Get structured judgments your code can act on
POST
/
systemone
Create Decision
curl --request POST \
--url https://api.electronhub.ai/v1/systemone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "<string>",
"questions": {},
"model": "jev"
}
'import requests
url = "https://api.electronhub.ai/v1/systemone"
payload = {
"state": "<string>",
"questions": {},
"model": "jev"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: '<string>', questions: {}, model: 'jev'})
};
fetch('https://api.electronhub.ai/v1/systemone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.electronhub.ai/v1/systemone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'state' => '<string>',
'questions' => [
],
'model' => 'jev'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.electronhub.ai/v1/systemone"
payload := strings.NewReader("{\n \"state\": \"<string>\",\n \"questions\": {},\n \"model\": \"jev\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.electronhub.ai/v1/systemone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"state\": \"<string>\",\n \"questions\": {},\n \"model\": \"jev\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/systemone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"state\": \"<string>\",\n \"questions\": {},\n \"model\": \"jev\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "decision",
"model": "jev",
"answers": {},
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Send the facts in
Each question has:
Every question sees the same
A written description is ordinary text, including one stored under a field named
Descriptions may be strings, objects, or arrays, and may be empty. A
Read each answer by its question ID, then apply your own rules. Validate thresholds on your own examples.
Failed requests are not charged.
state and the judgments you need in questions. The answer is a pick from a set, a score on a scale, or a yes/no measure. state is text or JSON. The model does not read images, and it does not write chat text.
jev is TypeSafe’s decision model at $0.042 per million input tokens. Output tokens are free. Requests count toward your normal rate limits.
Create Decision
POST /systemone
POST /decisions is the same endpoint.
Request Body
jev. jev-latest, typesafe/jev, and typesafe/jev-latest are aliases. Version pins such as typesafe/jev-1.13 are rejected because only the current Jev is served. Proxy keys must send model.The facts needed to answer: the ticket, records, conversation, or policy. A string, object, or array, including an empty one. Numbers, booleans, and
null are rejected. Image parts and data-URL images are rejected. See Images.A non-empty map of question IDs to question definitions. Answers use the same IDs. IDs must be non-empty and cannot be
__proto__.The question to answer. The question ID only labels the answer; it is not read as the question.
What each option or level means. Required for
choice and score, optional for noul. See Question types.state. Send independent questions together in one call and keep each one focused on a single judgment. The combined state and questions can be up to 32,000 tokens. Other body fields, such as user, session_id, or assets, are ignored.
Images
Jev does not read image bytes. An image part instate (image_url, image, or input_image), or any data:image/ URL, is rejected with 400 and param set to state. Describe the image with a vision model such as gemini-2.5-flash, then put that description in state.
auth = {"Authorization": "Bearer YOUR_API_KEY"}
text = requests.post("https://api.electronhub.ai/v1/chat/completions", headers=auth, json={
"model": "gemini-2.5-flash",
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Describe this image."},
{"type": "image_url", "image_url": {"url": data_url}}]}],
}).json()["choices"][0]["message"]["content"]
answer = requests.post("https://api.electronhub.ai/v1/decisions", headers=auth, json={
"model": "jev", "state": text,
"questions": {"colour": {"type": "choice", "instructions": "Dominant colour?",
"criteria": {"red": "red", "green": "green", "blue": "blue"}}}}).json()
image. There is no box question type. Ask a choice, score, or noul about the description.
Question types
| Type | criteria | Answer fields |
|---|---|---|
choice | Object of option ID to description. 1 to 255 options. | choice, probabilities, confidence |
score | Array of level descriptions, lowest first. 1 to 10 levels. An object keyed "0", "1", … with no gaps is also accepted. | score, legend, probabilities, confidence |
noul | Optional. If sent, an object with both true and false keys and no others. | noul |
choice description may also be null. Numbers and booleans are rejected.
Reading answers
choice: the selected option ID.probabilitiesmaps every option ID to a probability.score: the expected level on the 0-based scale, as a decimal (for example2.82of 0 to 3).legendmaps each level index to the description you sent.probabilitiesmaps each level index to a probability.noul: the probability of yes, from 0 to 1. Near 0.5 means uncertain. There is noconfidencefield.confidence: a separate certainty signal from 0 to 1. It is not the largest probability and may be omitted; treat a missing value as unknown.
Example
curl -X POST "https://api.electronhub.ai/v1/systemone" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jev",
"state": "My card was charged twice. Please help ASAP.",
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments and refunds",
"technical": "Bugs and integrations",
"sales": "Pricing and new accounts"
}
},
"severity": {
"type": "score",
"instructions": "How severe is this request?",
"criteria": [
"No impact",
"Minor inconvenience",
"The customer is blocked",
"Money or data is at risk"
]
},
"urgent": {
"type": "noul",
"instructions": "Does this need a response today?",
"criteria": {
"true": "The customer is blocked or money is at risk",
"false": "It can wait"
}
}
}
}'
const response = await fetch('https://api.electronhub.ai/v1/systemone', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'jev',
state: 'My card was charged twice. Please help ASAP.',
questions: {
team: {
type: 'choice',
instructions: 'Which team should handle this?',
criteria: {
billing: 'Payments and refunds',
technical: 'Bugs and integrations',
sales: 'Pricing and new accounts'
}
}
}
})
});
const { answers } = await response.json();
console.log(answers.team.choice);
import requests
response = requests.post(
'https://api.electronhub.ai/v1/systemone',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'model': 'jev',
'state': 'My card was charged twice. Please help ASAP.',
'questions': {
'team': {
'type': 'choice',
'instructions': 'Which team should handle this?',
'criteria': {
'billing': 'Payments and refunds',
'technical': 'Bugs and integrations',
'sales': 'Pricing and new accounts',
},
}
},
},
timeout=60,
)
print(response.json()['answers']['team']['choice'])
Response
{
"id": "gen-dec-1791097042-2ZZZZefJjFbJsulpQa5T",
"object": "decision",
"model": "jev",
"answers": {
"team": {
"type": "choice",
"choice": "billing",
"probabilities": { "billing": 1, "sales": 0, "technical": 0 },
"confidence": 1
},
"severity": {
"type": "score",
"score": 2.82,
"legend": {
"0": "No impact",
"1": "Minor inconvenience",
"2": "The customer is blocked",
"3": "Money or data is at risk"
},
"probabilities": { "0": 0, "1": 0.08, "2": 0.01, "3": 0.91 },
"confidence": 0.82
},
"urgent": {
"type": "noul",
"noul": 0.88
}
},
"usage": {
"input_tokens": 434,
"output_tokens": 68,
"total_tokens": 502
}
}
const { team } = data.answers;
if ((team.confidence ?? 0) < 0.8) {
queueForReview(ticket);
} else {
routeTicket(ticket, team.choice);
}
Describe the endpoint
GET /systemone (or GET /decisions) returns the default model (jev), its context length and price, the question types, and a models list with every decision model. No API key is needed. jev allows 32,000 tokens.
Errors
| Status | Meaning |
|---|---|
| 400 | Invalid body, such as a missing instructions, an unknown type, invalid criteria, or image content in state. param names the field. Also returned for a version-pinned or unsupported model, and when the request exceeds that model’s context limit. |
| 401 | Missing or invalid API key. |
| 402 | Insufficient balance. |
| 429 | Your rate limit was reached, or the decision model is busy. Wait for Retry-After when present, then retry with backoff. |
| 503 | The decision model is temporarily unavailable. Retry with backoff. |
Body
application/json
