Decision Model API
Call POST /compatible-mode/v1/systemone to use the Bailian decision model (decision-model / decision-model-preview), which returns classification, scoring, and yes/no decisions with full probability distributions and confidence in a single forward pass, without generating text. Suitable for high-frequency structured decisions such as ticket routing, content moderation, agent routing, and result verification.
Prerequisites
You have created an API Key and set it as the environment variable DASHSCOPE_API_KEY. For configuration, see Configure the API key in environment variables.
ImportantTry the preview model online: Before writing code, try the decision model in the Playground. Pick a demo scenario (customer service judgment, agent verification, ticket routing, content moderation, agent task routing, or medical triage), enter your business content, run the model, and review decisions, probability distributions, and token usage. Modify inputs to observe how results change.
Request
Protocol: TypeSafe System One (POST /compatible-mode/v1/systemone)
A single request carries the business state and several typed questions (choice / noul / score). The model returns the decision result and probability distribution for each question in one forward pass, with choice and score additionally returning confidence, and does not generate text, so latency and cost are independent of output length.
Replace {WorkspaceId} with your workspace ID. See Regions and endpoints.
Region | Endpoint |
|---|---|
China (Beijing) |
|
Singapore |
|
US (Virginia) |
|
Germany (Frankfurt) |
|
Japan (Tokyo) |
|
Hong Kong (China) |
|
Request ParametersContent-Type · Request type: Authorization · API key, in the format: model · Model name. Supported values:
state · The business state to make decisions on: ticket text, a conversation, or a structured object (objects are serialized before being sent to the model). The following image input parameters apply to the stable image · A single image visible to all questions; questions do not need to reference it. Mutually exclusive with images · Multiple images as a nonempty array; each element uses the same format as assets · A map from asset IDs to image objects. The key is a caller-defined nonempty string, the asset ID of that image. Mutually exclusive with The key difference from Use HTTP, or DashScope Python SDK 2.1.0 or later with questions · A map of questions. The key is a caller-defined question id; the value is a question object with the following fields. Limits and recommendations
| Request Examples
Image input exampleImage URL(curl)Base64 image(Python)Replace DashScope PythonRequires DashScope Python SDK 2.1.0 or later. Two screenshots (assets)A customer claims delivery is complete and requests payment release. The order screenshot says pending delivery; the tracking screenshot shows out for delivery with no delivery confirmation. Ticket routingA single request handles three decisions at once: team assignment ( DashScope PythonDashScope JavaTypeSafe PythoncurlYes/no decisionA DashScope PythonDashScope JavaTypeSafe Pythoncurl |
Response Parametersmodel · Model name echoed back. request_id · Request ID, for troubleshooting. answers · A map of answers. The key corresponds to the question id in the request; the value is an answer object with the following fields. usage · Metering information:
latency_ms · Server-side latency (milliseconds). | Response ExampleTicket routingThe following is the response for the ticket routing example (abbreviated). Probabilities and confidence depend on the actual result. Two screenshots for an after-sales ticketWith |
Image references and scope
- A string value must exactly equal an asset ID. Substrings, Markdown image syntax, and object keys do not count. For example,
{"screenshot":"order_page"}references an image, but{"screenshot":"See order_page screenshot"}does not. - Images referenced in
stateare shared by all questions. Images referenced in a question'sinstructionsorcriteriadescriptions enter only that question. One question can reference multiple IDs. - Every asset must be referenced at least once; otherwise the entire request fails with
ASSET_UNREFERENCED. Images are never silently dropped. - Images are appended in template-block order:
state, the question'sinstructions, then candidate descriptions. Objects are traversed by lexicographic key order and arrays by element order. Each image follows its referring text with anAsset "<ID>"label. Each ID is appended only once per question. - Use semantic IDs such as
order_pageandtracking_page. IDs enter the model's text input. Avoid collisions with existing business string values, which would become image references.
assets versus image/images
image / images are shortcuts for shared images. The server creates internal IDs such as __image_1 and __image_2, avoiding collisions with business text, and wraps the original state in an object with content and images. assets preserves the original state.
Use image when all questions need one image, or images when all questions need the same set. Use assets when each question needs specific images or images must correspond to business fields, so unrelated images do not enter each question's context. Input token overhead differs between the paths; use actual responses to assess usage and decisions.
Capacity and format limits
- At most 4 images per question and 16 image assets per request, counting URL and Base64 sources together. An asset referenced by multiple questions counts once in each question. Different IDs count separately even when bytes or URLs match; content is not deduplicated. Excess images cause rejection, without dropping or truncating images.
- Only fully decodable, single-frame JPEG, PNG, and WebP images are supported. Actual bytes determine the format, not URL suffixes or
Content-Type. EXIF rotation is applied before conversion to RGB. - The default per-image download budget and whole-request deadline are both 30 seconds. Any image failure fails the entire request, without partial answers. Image bytes, pixels, and request-body size depend on deployment configuration, with no fixed public limits; configured capacities are checked in advance.
Image-related errors
Error responses include error_code, the JSON Pointer details.field, and the failure stage details.stage. Invalid protocol or values use InvalidParameter; capacity violations use ValidationError. The parameter errors below return HTTP 400, except upstream unavailability and request timeout.
Error codes and conditions
MEDIA_FIELDS_CONFLICT· HTTP 400 ·InvalidParameter·schema:More than one media field is present, including null。MEDIA_FIELD_INVALID· HTTP 400 ·InvalidParameter·schema:image is not an object or images is not a nonempty array。ASSET_ID_INVALID· HTTP 400 ·InvalidParameter·schema:Empty or whitespace-only ID。IMAGE_TYPE_INVALID· HTTP 400 ·InvalidParameter·schema:Missing type or value other than image。IMAGE_SOURCE_INVALID· HTTP 400 ·InvalidParameter·schema:Exactly one nonempty source was not supplied。IMAGE_URL_INVALID· HTTP 400 ·InvalidParameter·schema:Invalid URL protocol or Data URL。INVALID_FIELD· HTTP 400 ·InvalidParameter·schema:Undefined image field, except format。ASSET_UNREFERENCED· HTTP 400 ·InvalidParameter·references:No exact full-string reference to the asset。IMAGE_NOT_SUPPORTED· HTTP 400 ·InvalidParameter·limits:Deployment has not enabled images。IMAGE_COUNT_EXCEEDED· HTTP 400 ·ValidationError·limits:More than 4 images in one question。IMAGE_REQUEST_COUNT_EXCEEDED· HTTP 400 ·ValidationError·limits:More than 16 image assets; rejected before download or decoding。IMAGE_BASE64_INVALID· HTTP 400 ·InvalidParameter·decode:Not strict raw Base64。IMAGE_EMPTY_DATA· HTTP 400 ·InvalidParameter·decode:Empty image data。IMAGE_FORMAT_UNSUPPORTED· HTTP 400 ·InvalidParameter·decode:Actual format is not JPEG, PNG, or WebP。IMAGE_MULTIFRAME_UNSUPPORTED· HTTP 400 ·InvalidParameter·decode:Animated or multiframe image。IMAGE_DECODE_FAILED· HTTP 400 ·InvalidParameter·decode:Image cannot be fully decoded。IMAGE_PIXELS_EXCEEDED· HTTP 400 ·ValidationError·decode:Pixel count exceeds deployment limit。IMAGE_URL_UNAVAILABLE· HTTP 400 ·InvalidParameter·download:Image URL returns non-2xx。IMAGE_HOST_NOT_FOUND· HTTP 400 ·InvalidParameter·download:Image host cannot be resolved。IMAGE_BYTES_EXCEEDED· HTTP 400 ·ValidationError·download:Image bytes exceed deployment limit。IMAGE_DOWNLOAD_TIMEOUT· HTTP 400 ·InvalidParameter·download:Per-image download budget exceeded (default 30 seconds); retryable。IMAGE_UPSTREAM_UNAVAILABLE· HTTP 503 ·ServiceUnavailable·download:Image origin unavailable; HTTP 503 / ServiceUnavailable; retryable。REQUEST_TIMEOUT· HTTP 500 ·ResponseTimeout·request:Whole-request deadline exceeded (default 30 seconds); HTTP 500 / ResponseTimeout; retryable。
{
"code": "InvalidParameter",
"error_code": "ASSET_UNREFERENCED",
"message": "<400> InternalError.Algo.InvalidParameter: [ASSET_UNREFERENCED] Asset tracking_page has no matching full-string reference.",
"details": {"stage": "references", "asset_id": "tracking_page", "field": "/assets/tracking_page"},
"request_id": "0cd8d01b-a8c2-4ceb-9f11-f8dbc6a31d6b"
}
Error Codes
If the call fails, an error message is returned. For more error codes and solutions, see Error messages.