Create Decision
Answer typed questions about a state with a decision ("System One") model, in TypeSafe's /v1/systemone shape, so clients written for TypeSafe work by changing their base URL and key.
A decision model scores non-Box questions. Box questions are sent separately to an image-capable localizer chat model.
Question types: noul (yes/no) answers noul, the probability of yes. choice picks one of 1 to 255 options and answers the most likely choice, every option's probabilities and a confidence. score rates on 1 to 10 ordered levels and answers score, the probability-weighted level (it can land between levels), with a legend, probabilities and confidence.
Confidence is 1 when the distribution is on one answer and 0 when it is spread evenly. For choice, it is (k * p_max - 1) / (k - 1). For score, it is TypeSafe's ordered-level formula: with m the first level index holding the maximum probability, 1 - sum(p_i * abs(i - m)) / (sum(abs(i - (n - 1) / 2)) / n), floored at 0. noul answers carry none; read noul itself.
Long inputs over the model's maximum input length are rejected with 400 and metadata.error_type: max_tokens_exceeded, never truncated.
Box: Requires images and has no criteria. Coordinates are fractions from the top-left, with null confidence. The localizer reads the images referenced by its instructions, or the sole image if none are referenced. With multiple images, each Box question must reference an image in its instructions. An absent target still produces a box.
Billing: decision input tokens are billed against the decision model. Box localizer prompt and completion tokens are billed against the localizer model; prompt tokens are included in usage.input_tokens.
Images: send them in assets with the TypeSafe-Danger-Zone-Images: true header, inline as base64 or as the multipart form TypeSafe's SDKs send (a part named request with the JSON body, then a part per image). The request shape is TypeSafe's: state, instructions, criteria and score legends keep the references and text you sent, and an image in a question's instructions or criteria is read for that question alone. TypeSafe calls images experimental. A model reads images when GET /v1/models lists image among its input_modalities, and at most as many per request as that input's supported_ says (1024 for clef-flash, 8 for clef-omni).
Audio and video: not TypeSafe's. A model that lists audio or video among its input_modalities (clef-omni: 8 clips and 4 videos a request) reads WAV or MP3 assets of type: audio and MP4 or WebM assets of type: video, with the same header, references and limits as images. A request with any audio or video is read as Clef-Omni was trained: every asset in one block before the state, each kind in the order its reference first appears, shared by every question, so a question's own image is read with the rest. A video's soundtrack is heard with it when every video has one; audio clips cannot be sent with videos that have soundtracks. The media's tokens are billed as input tokens.
Compression: a body may be sent compressed with Content-Encoding: zstd or gzip (one layer; a zstd window of at most 8 MiB), as TypeSafe's SDKs send bodies of 1 KiB or more. A body may be at most 32 MB, compressed and decompressed.
Header parameters
-
Content-Encoding string
The body's compression, if any. One of
zstd,gziporx-gzip; no stacked encodings.zstdgzipx-gzipidentity -
TypeSafe-Danger-Zone-Images string
trueto send images inassets, as TypeSafe requires; a request with assets without it is a 400.true
Body
application/jsonTypeSafe's /v1/systemone request. A request with images also sends assets and the TypeSafe-Danger-Zone-Images: true header, and goes to a model that reads images (its input_modalities in GET /v1/models list image).
-
model string required
The decision model to use.
-
state string or object or array of any required
What to decide about. A string, or structured data (an object or array), which the model reads as JSON.
-
questions object required
A non-empty map of questions, by id. Each answer comes back under its question's id. Requests beyond 64 questions require the coordinated engine rollout that accepts them.
-
assets object
Images (and, for a model that reads them, audio clips and videos), keyed by a reference of your choosing (a per-image UUID is a good one; at most 1,024 bytes, and 65,536 for all of them). Write the reference into
state, a question'sinstructionsor itscriteriawhere the image belongs: a string that is exactly the reference is the image, and inside longer strings references are found left to right without overlap. Object keys are never read. Every asset must be referenced.Every use of a reference inserts its image at that location, including repeated uses of the same asset. An image in a question's instructions or criteria is read for that question alone; put an image several questions need in
state.The images count toward the model's input and are billed as input tokens. The images together may be at most 32 MiB, and so may the expanded request: the state and questions with each image counted at every place it is referenced.
assetsitself is not counted, so an image sent inline in base64 counts the same as one sent as a multipart part.A model reads at most a set number of images per request, its image input's
supported_ininputs. references. max GET /v1/models(1024 forclef-flash, 8 forclef-omni); a request with more is refused with 400.clef-omnireads at most 8 audio clips and 4 videos a request.
Body
multipart/form-dataResponses
OK
application/json · systemone-response-payload
The body is not valid JSON or its Content-Encoding cannot decode it; an input is over the model's maximum context length (metadata.error_type: max_tokens_exceeded); or images were sent without the opt-in header, to a model that reads none, more than the model reads per request, or break an asset or multipart rule
application/json · error-payload
The API key is missing, unknown or not active. Send it as Authorization: Bearer <key>.
application/json · error-payload
This model requires a funded account. Funded subscriptions and internal accounts may use it.
application/json
The body is over 32 MiB, compressed or decompressed; an image is over 16 MiB, 1,568 pixels a side or 2,458,624 pixels; or the images, or the state and questions with each image counted at every reference, are over 32 MiB
application/json · error-payload
The Content-Encoding is not zstd or gzip, or is more than one layer
application/json · error-payload
The request failed validation or the model is not a decision model
application/json · error-payload
Rate limit exceeded
application/json · error-payload
The model returned an unusable response
application/json · error-payload
The configured Box localizer is unavailable
application/json · error-payload
The model is overloaded or unavailable; retry with backoff
application/json · error-payload
curl https://api.vultrinference.com/v1/systemone \
-H "Authorization: Bearer $VULTR_INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "clef",
"state": {
"ticket": "Everything is down and we have a demo at noon."
},
"questions": {
"urgent": {
"type": "noul",
"instructions": "Does the customer need a reply within the hour?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "invoices, payments, refunds",
"technical": "bugs, outages, errors"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": [
"Calm",
"Frustrated",
"Very angry"
]
}
}
}'import os
import requests
response = requests.post(
"https://api.vultrinference.com/v1/systemone",
headers={"Authorization": f"Bearer {os.environ['VULTR_INFERENCE_API_KEY']}"},
json={
"model": "clef",
"state": {
"ticket": "Everything is down and we have a demo at noon.",
},
"questions": {
"urgent": {
"type": "noul",
"instructions": "Does the customer need a reply within the hour?",
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "invoices, payments, refunds",
"technical": "bugs, outages, errors",
},
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": [
"Calm",
"Frustrated",
"Very angry",
],
},
},
},
)
print(response.json())const response = await fetch("https://api.vultrinference.com/v1/systemone", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VULTR_INFERENCE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "clef",
"state": {
"ticket": "Everything is down and we have a demo at noon."
},
"questions": {
"urgent": {
"type": "noul",
"instructions": "Does the customer need a reply within the hour?"
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "invoices, payments, refunds",
"technical": "bugs, outages, errors"
}
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": [
"Calm",
"Frustrated",
"Very angry"
]
}
}
}),
});
console.log(await response.json());{
"model": "string",
"answers": {},
"usage": {
"input_tokens": 0,
"output_tokens": 0
}
}