Decision models use the native System One protocol to answer classification, scoring, yes/no, or image-localization questions about text, structured state, or images.
Endpoint and authentication
| Item | Value |
|---|---|
| Request endpoint | POST https://51kik.com/decision/v1/systemone |
| Authentication | Authorization: Bearer <API-Key> |
| Content-Type | application/json or multipart/form-data |
| Response mode | Synchronous JSON; streaming is not supported |
Find model codes in the decision model catalog.
Quick example
curl -X POST https://51kik.com/decision/v1/systemone \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-review-20260930-001' \
-d '{
"model": "jev",
"state": {
"order": { "amount": 1280, "currency": "CNY" },
"customer": { "risk_level": "medium" }
},
"questions": {
"review": {
"type": "choice",
"instructions": "Decide whether this order can be approved.",
"criteria": {
"approve": "Approve when the risk is acceptable.",
"reject": "Reject when the risk is unacceptable."
}
}
}
}'
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Decision model code, up to 128 characters. |
state | null | string | object | array | Yes | Business state supplied to the model. |
questions | object | Yes | 1–32 questions. Each key is a non-blank question ID up to 128 characters. |
assets | object | No | Images keyed by reference strings used in state, instructions, or criteria. |
session_id | string | No | Cache-affinity session ID, up to 256 characters. Used for platform routing and not forwarded upstream. |
System One extension fields outside these platform fields are forwarded using the native protocol. The request body limit is 32 MiB, including JSON, base64 text, and multipart framing.
JSON and multipart requests support single-layer gzip, x-gzip, or zstd compression through Content-Encoding. Both compressed and decoded bodies have a 32 MiB limit; zstd windows are limited to 8 MiB. Official SDKs compress larger requests by default. If the service environment rejects a codec with 415, set compression: false in the SDK.
Question types
Each question must contain type and may contain instructions. The supported types are:
type | criteria | Use |
|---|---|---|
choice | Object with 1–255 choices | Select a named result. Choice names must be non-blank and no longer than 128 characters. |
score | Array with 2–10 levels | Score against an ordered set of levels. |
noul | Omitted, null, or an object | Return the probability of yes or true, from 0 to 1. |
box | Not used | Return normalized image bounds and confidence. Requires an image asset and an upstream model supporting Jev 1.14 or later. instructions may be omitted or null. |
Image input and localization
Images and box are experimental TypeSafe features. Each request using them must include TypeSafe-Danger-Zone-Images: true. Jev 1.13 and 1.14 both accept images; box requires Jev 1.14. Keep using a public model code from the platform catalog in model.
Multipart upload
Uploading the file directly is recommended. The first part must be named request and contain the JSON body. Each asset's part names an image file part. Part names must be non-empty and unique, and every image part must belong to exactly one asset.
curl https://51kik.com/decision/v1/systemone \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'TypeSafe-Danger-Zone-Images: true' \
-F 'request={"model":"jev","state":{"photo":"photo-ref-001"},"assets":{"photo-ref-001":{"type":"image","part":"photo"}},"questions":{"package":{"type":"box","instructions":"Locate the package in `photo`."}}};type=application/json' \
-F 'photo=@photo.jpg;type=image/jpeg'
JSON base64
For JSON requests, use Content-Type: application/json and put the format and raw base64 in the asset:
{
"model": "jev",
"state": { "photo": "photo-ref-001" },
"assets": {
"photo-ref-001": {
"type": "image",
"format": "jpg",
"data_base64": "<padded base64 of photo.jpg>"
}
},
"questions": {
"package_visible": { "type": "noul", "instructions": "Is a package visible in `photo`?" }
}
}
type is optional. format must be png, jpg, or jpeg. Use standard base64 with the required = padding, no whitespace or line breaks, and no data: prefix. If a multipart asset supplies both part and data_base64, part takes precedence.
- Only still PNG/JPEG images are accepted. Each side must be 280–1568 px, and each file may be at most 16 MiB, measured after decoding base64.
- The request body, all images after upstream processing, and the request after expanding every reference each have a 32 MiB limit. Exceeding a limit rejects the entire request.
- Every asset must be referenced in a string value in
state,instructions, orcriteria. Use a distinct UUID per image to avoid accidental matches in other text. Repeated references add the image again toward the expanded limit. boxreturnstop,bottom,left, andright(all from 0 to 1), plusconfidence, which isnullwhen the upstream model does not provide it. Pair it with a visibilitynoulwhen the target might be absent.- Image tokens are included in
usage.input_tokensand billed at the catalog's input price. Request logs retain image references and metadata, with base64 content omitted.
See the official TypeSafe image documentation and Box documentation for the full rules.
Successful response
The gateway preserves the upstream System One response. A successful response contains at least:
{
"model": "<resolved-upstream-model>",
"answers": {
"review": { "...": "System One answer fields" }
},
"usage": {
"input_tokens": 123,
"output_tokens": 18
}
}
The fields inside each answers entry are native to the selected System One model; clients should not assume a fixed nested shape. usage is used for billing. Input and output token prices are shown in the decision model catalog.
Optional headers
| Header | Description |
|---|---|
TypeSafe-Danger-Zone-Images | Required with value true for images or box. Forwarded upstream. |
Idempotency-Key | Up to 255 characters. Reuse a stable value when retrying the same business request. The gateway derives an upstream idempotency key but does not cache or replay responses. |
x-session-id | Cache-affinity session ID, used only when the request body does not contain session_id. |
x-trace-id | Business trace ID recorded with request and usage data. |
x-user-id | End-user ID from your application. |
x-agent-name | Calling agent or service name. |
Error response
Errors use the OpenAI-style envelope:
{
"error": {
"message": "model is required and must not exceed 128 characters",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
| HTTP status | Meaning |
|---|---|
400 | Invalid JSON/multipart or compressed body, image assets or opt-in header, or an image rejected upstream. |
401 | Missing, malformed, or invalid API key. |
413 | Request body, image, or asset reference exceeds a size limit. |
415 | Unsupported request Content-Type or Content-Encoding. |
422 | Invalid state, model, questions, question type, idempotency key, or session identifier. |
502 | All eligible upstream routes failed, or the upstream response was invalid. |