> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwencloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Decision Model API Reference

> Call POST /compatible-mode/v1/systemone to use the QwenCloud 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.

## Prerequisites

You have created an API key and configured it as the environment variable `DASHSCOPE_API_KEY`. See [Configure an API key as an environment variable](/api-reference/preparation/export-api-key-env).

**Supported regions**: Singapore and China North 2 (Beijing). Use an API key and endpoint from the region you call; see [Regions and endpoints](/developer-guides/getting-started/regions).

## Request

<strong>Protocol</strong>: TypeSafe System One (`POST /compatible-mode/v1/systemone`)

A single request carries a business `state` and several typed questions (`choice` / `noul` / `score`). The model returns the decision result and probability distribution for each question in a single forward pass, with `choice` and `score` additionally returning confidence, **without generating text**, so latency and cost are independent of output length.

<Note>
  `decision-model-preview` does not support streaming, Function Calling, web search, or structured output. The model output is a structured decision result (probability distributions and confidence), not generated text.
</Note>

The DashScope SDKs support the decision model: Python SDK 2.0.1 or later provides the `client.decision.create` interface, and Java SDK 2.23.3 or later provides the `com.alibaba.dashscope.decision` package. You can also call it with the generic TypeSafe SDK (`typesafe-sdk`). On failure, the Python SDK raises a `DashScopeError` exception and the Java SDK raises an `ApiException`.

## OpenAPI

````yaml post /compatible-mode/v1/systemone
openapi: 3.1.0
info:
  title: Decision Model API
  description: Call POST /compatible-mode/v1/systemone to use the QwenCloud 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.
  version: 1.0.0
servers:
  - url: https://{region}.maas.qwencloudapi.com
    description: Region. Use an API key from the same region.
    variables:
      region:
        default: ap-southeast-1
        enum:
          - ap-southeast-1
          - cn-beijing
security:
  - BearerAuth: []
paths:
  /compatible-mode/v1/systemone:
    post:
      summary: Decision model inference
      description: |-
        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.

        **Limits and recommendations**

        - Maximum 16 questions (latency grows near-linearly with the number of questions).
        - `choice` options: ≤ 255.
        - `score` levels: 2–255 (3–7 recommended).
        - Context: maximum 65536 tokens; overlong `state` is rejected.
      operationId: decisionModelSystemOne
      tags:
        - Decision Model
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DecisionModelRequest"
      responses:
        "200":
          description: Decision result returned successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DecisionModelResponse"
              examples:
                Ticket routing:
                  value:
                    model: decision-model-preview
                    request_id: 7b986c65-b223-9341-b5f0-b988e27ecaac
                    answers:
                      department:
                        type: choice
                        choice: billing
                        confidence: 0.88
                        probabilities:
                          billing: 0.94
                          technical: 0.06
                      escalate:
                        type: noul
                        noul: 0.99
                      severity:
                        type: score
                        score: 2.25
                        confidence: 0.91
                        legend:
                          "0": Minor issue, no functional impact
                          "1": Some features affected, workaround available
                          "2": Core feature unavailable, no workaround
                          "3": Severe business or security impact
                        probabilities:
                          "0": 0
                          "1": 0.01
                          "2": 0.73
                          "3": 0.26
                    usage:
                      input_tokens: 125
                    latency_ms: 52.9
        "400":
          description: Invalid request parameters
      x-codeSamples:
        - lang: curl
          source: |-
            # Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
            # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
            curl -sS -X POST https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1/systemone \
              -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
              -H 'Content-Type: application/json' \
              -d '{
                "model": "decision-model-preview",
                "state": {"ticket_id": "T-1001", "content": "Payment not received 24 hours after order, user unable to use core service."},
                "questions": {
                  "department": {"type": "choice", "instructions": "Which team should handle this?",
                                 "criteria": {"billing": "Payment, refund and billing issues", "technical": "Product faults and integration issues"}},
                  "escalate":   {"type": "noul",  "instructions": "Should on-call staff be notified immediately?"},
                  "severity":   {"type": "score", "instructions": "How severe is this issue?",
                                 "criteria": ["Minor issue, no functional impact", "Some features affected, workaround available",
                                              "Core feature unavailable, no workaround", "Severe business or security impact"]}
                }
              }'
        - lang: Python
          source: |-
            import os
            from typesafe_sdk import TypeSafeClient

            client = TypeSafeClient(
                api_key=os.environ["DASHSCOPE_API_KEY"],
                # Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
                # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
                base_url="https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode",
            )

            result = client.system_one(
                model="decision-model-preview",
                state={"ticket_id": "T-1001", "content": "More than 24 hours after payment, the order has not been credited."},
                questions={
                    "department": {"type": "choice", "instructions": "Which team should handle this?",
                                   "criteria": {"billing": "Payment, refund, and billing issues", "technical": "Product failure and integration issues"}},
                    "escalate": {"type": "noul", "instructions": "Should on-call staff be notified immediately?"},
                    "severity": {"type": "score", "instructions": "How severe is this issue?",
                                 "criteria": ["Minor issue, no impact on functionality", "Some functionality affected, but a workaround exists",
                                              "Core functionality unavailable, no workaround", "Severe business or security impact"]},
                },
            )

            print(result.answers["department"])   # choice, confidence, probabilities
            print(result.answers["escalate"])     # noul P(yes)
            print(result.answers["severity"])     # score, legend, probabilities
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: QwenCloud API key, in the format `Bearer $DASHSCOPE_API_KEY`. See [Get an API key](/api-reference/preparation/api-key).
  schemas:
    DecisionModelRequest:
      type: object
      required:
        - model
        - state
        - questions
      properties:
        model:
          type: string
          description: "Model name: `decision-model-preview`."
          enum:
            - decision-model-preview
        state:
          oneOf:
            - title: Text
              type: string
              description: Business text passed directly, such as a ticket, comment, or conversation snippet.
            - title: Structured object
              type: object
              description: A structured business object; serialized before being sent to the model.
            - title: Array
              type: array
              description: An array (e.g. a multi-turn message list); serialized before being sent to the model.
          description: "The business state to make decisions on: ticket text, a conversation, or a structured object (objects are serialized before being sent to the model)."
        questions:
          type: object
          description: A map of questions. The key is a caller-defined question id; the value is a question object with the following fields.
          properties:
            type:
              type: string
              description: |-
                Question type:
                - `choice`: single choice
                - `noul`: yes/no
                - `score`: ordinal scale
              enum:
                - choice
                - noul
                - score
            instructions:
              type: string
              description: Question description or judgment criteria.
            criteria:
              description: |-
                - `choice`: a map of option name → option description (1–255 items; providing all options and an `other` fallback is recommended).
                - `noul`: optional `{"true":…, "false":…}` descriptions.
                - `score`: an array of level descriptions from low to high (2–255 levels; 3–7 clearly distinguishable levels recommended).
              oneOf:
                - type: object
                  title: choice option map
                  description: "For `choice`: a map of option name → option description."
                  additionalProperties:
                    type: string
                    description: Option description.
                - type: array
                  title: score level array
                  description: "For `score`: an array of level descriptions from low to high."
                  items:
                    type: string
                    description: Level description, from low to high.
                - type: object
                  title: noul descriptions
                  description: "For `noul`: optional yes / no descriptions."
                  properties:
                    "true":
                      type: string
                      description: Description for the "yes" outcome.
                    "false":
                      type: string
                      description: Description for the "no" outcome.
    DecisionModelResponse:
      type: object
      properties:
        model:
          type: string
          description: Model name echoed back.
        request_id:
          type: string
          description: Request ID, for troubleshooting.
        answers:
          type: object
          description: A map of answers. The key corresponds to the question id in the request; the value is an answer object with the following fields.
          properties:
            type:
              type: string
              description: Matches the question type (`choice` / `noul` / `score`).
              enum:
                - choice
                - noul
                - score
            choice:
              type: string
              description: "For `choice`: the selected option name."
            noul:
              type: number
              description: "For `noul`: P(yes), where 0 = no and 1 = yes."
            score:
              type: number
              description: "For `score`: the probability-weighted expectation of the level index, which can fall between two levels (e.g. `1.43`)."
            probabilities:
              type: object
              description: The probability of each option / level (sums to 1).
              additionalProperties:
                type: number
                description: Probability value.
            confidence:
              type: number
              description: The confidence of the answer (returned for `choice` / `score`).
            legend:
              type: object
              description: "For `score`: a map of level index → level description."
              additionalProperties:
                type: string
                description: Level description.
        usage:
          type: object
          description: Metering information.
          properties:
            input_tokens:
              type: integer
              description: Number of input tokens.
        latency_ms:
          type: number
          description: Server-side latency (milliseconds).
````
