Decision API Guide
POST /v1/systemone and its alias POST /v1/decisions return typed answers to questions about text and images. Use a direct Inferway API key; streaming and chat sampling parameters are not supported.
Models and billing
Input tokens are billed per million tokens; output tokens are not charged.
| Model | Input per 1M tokens (USD / CNY) | Output |
|---|---|---|
typesafe/jev-1.14 | $0.034 / ¥0.24 | Free |
Request
state accepts text, an object, or an array. questions maps question IDs to four question types:
- noul: a yes probability; nonempty instructions required, optional criteria with true and false keys.
- choice: select an option from a nonempty criteria object; instructions is optional.
- score: a continuous score over ordered criteria levels, at most ten; instructions is optional.
- box: locate an object in an image using nonempty instructions; omit criteria. Supported by typesafe/jev-1.14 only, and requires an image.
{
"model": "typesafe/jev-1.14",
"state": "Classify this ticket: the invoice was charged twice.",
"questions": {
"billing": {
"type": "noul",
"instructions": "Is this about billing?"
},
"category": {
"type": "choice",
"criteria": {
"billing": "payment",
"technical": "service"
}
},
"urgency": {
"type": "score",
"criteria": [
"low",
"medium",
"high"
]
}
}
}Images and limits
Images go in assets, keyed by a reference string used in a text value in state, an instruction, or a criterion. Every asset must be referenced. Each asset uses format (png, jpg, or jpeg) and standard data_base64 without a data URL prefix. A type of image is optional. Decoded images are limited to 16 MiB each and the complete request body to 32 MiB. Images must be static, with each side between 280 and 1,568 pixels; dimensions and animation are checked.
The combined state and questions are limited to 64K tokens, and the state plus the longest single question to 32K tokens. Images count toward context. Requests support at most 64 questions and 255 choice options.
Response
answers maps each question ID to its typed result: noul gives a probability, choice a selected option and probabilities, score a numeric level and legend, and box normalized top, bottom, left, and right coordinates. id is the Inferway request ID, also returned in the Inference-Id header; model is the public model ID. usage.input_tokens is the input count used for billing. usage.output_tokens is informational and is not charged. object and created may be absent.
{
"id": "req_example",
"model": "typesafe/jev-1.14",
"answers": {
"billing": {
"type": "noul",
"noul": 0.93,
"probabilities": {
"yes": 0.93,
"no": 0.07
}
},
"category": {
"type": "choice",
"choice": "billing",
"probabilities": {
"billing": 0.91,
"technical": 0.09
}
},
"urgency": {
"type": "score",
"score": 2,
"legend": {
"0": "low",
"1": "medium",
"2": "high"
},
"probabilities": {
"0": 0.05,
"1": 0.16,
"2": 0.79
}
}
},
"usage": {
"input_tokens": 454,
"output_tokens": 0
}
}Errors
| HTTP | Meaning |
|---|---|
400 | Invalid request, unsupported question, image, or content policy refusal. |
401 | Missing or invalid API key. |
402 | Insufficient eligible balance; the request is not run. |
403 | The credential or key policy does not permit the route or model. |
404 | The model is unavailable or the feature is disabled. |
429 | Gateway key rate limit. |
502 | The model service returned a transport or response error. |
503 | The model is temporarily unavailable. The response carries Retry-After, in seconds; retry after that interval. |
504 | The request timed out. |
Requests are not automatically retried. A retry is a new request and may incur a separate charge.