tencent cloud

Classification Decision Model

Download
Focus Mode
Font Size
Last updated: 2026-11-17 14:27:53
AI-Translated & Reviewed

Overview

CMR is an AI gateway. CMR Decisions API provides gateway capabilities such as model access, request forwarding, protocol adaptation, and routing for decision models through a unified interface and authentication method. The business party submits the state to be evaluated and a set of questions, and the upstream model returns structured results such as classification, scoring, or proposition confidence. CMR itself does not perform model inference. The specific judgment results, probability semantics, input limits, and performance depend on the selected upstream model. This document is organized based on the current LiteLLM/CMR implementation in the repository, with the built-in decision protocol baseline being TypeSafe Jev (System One). The call entry point is:
POST /v1/decisions
Question Type
Fill Method
Description
Category selection
type=choice
Select a category from the given candidates and return information such as candidate probabilities.
Ordered scoring
type=score
Evaluate the status based on the given ordered levels and return information such as scores.
Proposition judgment
type=noul
Evaluate the validity of a proposition and typically return a value between 0 - 1.
In a single request, you can submit multiple questions for the same state and mix the three question types. The keys of questions are defined by the business party to map returned answers to the original questions.

Use Cases

Scenario
Recommended Question Type
Access Mode
Customer Service Ticket Routing
choice
Use the ticket as the state, use team identifiers as candidates, and assign the ticket to the processing team based on choice.
User Intent Classification
choice
Provide clear intent candidates. When unhandled intents need to be covered, explicitly define other categories in criteria.
Ticket Urgency Assessment
noul
Define the meaning of "requires priority handling", and set the noul threshold based on business evaluation.
Emotion, Satisfaction, or Priority Assessment
score
Use ordered criteria levels, and process results by combining score, legend, and probability distribution.
Conditional Judgment in Agent Workflow
choice / noul
Evaluate the task status, and determine the subsequent processing branch or whether manual intervention is required.
Multidimensional Assessment of the Same Business Status
Mixed type
Submit multiple questions with independent identifiers at a time, for example, identify the team, dissatisfaction level, and urgency level simultaneously.
During business integration, you should clarify the candidate options and level definitions, and use your own samples to validate the results and thresholds. The probabilities and confidence scores returned by the model do not equate to business rule guarantees. The logic for executing subsequent business actions is implemented by the caller.

Prerequisites

1. It is recommended to read Usage Constraints and Supported Model Providers in advance for relevant information.
2. A CMR instance has been created. For detailed instructions, see Creating a CMR Instance.
3. A BYOK instance has been created and upstream decision model credentials have been configured. For detailed instructions, see Creating a BYOK Instance.
4. A CMR API key with access to the target model has been created. For detailed instructions, see Creating a CMR API Key.
5. Decision model association and CMR policy configuration have been completed. For detailed instructions, see Configuring Model Scheduling Management.
6. The server must deploy a version that supports Decisions and configure the protocol translation runtime environment required by the decision model. If this runtime environment is unavailable, the API returns 503. The console operation links mentioned above follow the public access guide in the reference documentation.
7. This document uses cmr-decisions as an example logical model name. Replace it with the name actually configured in the console before making calls. Upstream access credentials are configured on the server side, and clients use a CMR API Key for calls.

API Endpoint and Authentication

Request URL

POST {CMR_BASE_URL}/v1/decisions
CMR_BASE_URL is the access address of the CMR instance. Use the value displayed in the console. The path registered for the current handler is /v1/decisions, and all examples in this document use this path.

Request Header

Header
Required
Description
Authorization
Yes
Bearer <CMR_API_KEY>
Content-Type
Yes
Fixed as application/json

Quick Start

The following example determines whether a customer service ticket is urgent.

cURL

curl --request POST "${CMR_BASE_URL}/v1/decisions" \\
--header "Authorization: Bearer ${CMR_API_KEY}" \\
--header "Content-Type: application/json" \\
--data '{
"model": "cmr-decisions",
"state": "My withdrawal has failed for three consecutive days. I must pay my supplier today. Please process it as soon as possible.",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this ticket need to be handled with priority?"
}
}
}'

Python

import os
import requests

response = requests.post(
f"{os.environ['CMR_BASE_URL'].rstrip('/')}/v1/decisions",
headers={
"Authorization": f"Bearer {os.environ['CMR_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "cmr-decisions",
"state": "My withdrawal has failed for three consecutive days. I must pay my supplier today. Please process it as soon as possible.",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this ticket need to be handled with priority?",
}
},
},
timeout=30,
)
response.raise_for_status()
result = response.json()
print(result["answers"]["is_urgent"]["noul"])

Request Parameters

Basic Parameter

Parameter
Type
Required
Description
model
string
Yes
CMR logical model name or model alias. Available values are subject to the current instance configuration.
state
string | object | array
Yes
Text, structured business data, or context list to be evaluated. null, numbers, or boolean values are not accepted as the top-level state.
questions
object
Yes
A collection of questions. Keys are business-defined question identifiers, and values are question objects.
The request body must be a JSON object. When default admission rules are used, authentication succeeds, and the protocol translation runtime environment is available, 400 is returned if the required fields are missing, null is explicitly passed, or a standard field has an incorrect type. Validation occurs after request protocol rules are processed. Field transformations or custom replacement rules configured by the administrator may change the content that actually enters standard validation. Limits on the internal structure of questions, question types, the number of candidates, and state length are validated by the upstream model. The gateway accepting the top-level types does not mean that the upstream will accept the entire request. The gateway top-level validation itself does not reject an empty string state, an empty array/object state, or empty questions. Whether these inputs are usable is determined by the upstream. For normal calls, it is recommended to submit a state and questions with actual business meaning.

Problem Object

The following table lists common TypeSafe baseline protocol patterns. "Required" describes the filling requirements of the question protocol and does not mean that the gateway checks these fields one by one. The gateway only requires the top-level questions to be an object. It does not validate the internal values for question object types, type enums, or required fields. Values that do not conform to the upstream protocol may still be rejected by the upstream. Nested JSON structures are processed according to the configured protocol rules. Whether a complex structure is valid depends on the selected upstream model.
Parameter
Type
Required
Description
questions.&lt;question_id&gt;
object
Yes
A question. question_id is a custom identifier, such as department or is_urgent.
questions.&lt;question_id&gt;.type
string
Yes
Question type. Common values are choice, score, or noul.
questions.&lt;question_id&gt;.instructions
string; object / array supported by the upstream can also be used.
Yes
Question description, judgment objectives, and rules; plain text is the easiest to integrate.
questions.&lt;question_id&gt;.criteria
Depends on the question type
Fill in by type.
For choice, it is typically an object mapping candidate identifiers to descriptions; for score, it is typically an array of grades arranged in order; for noul, it can be omitted.

Category Selection (choice)

It is suitable for scenarios such as customer service routing, intent recognition, and content categorization. In criteria, each key is a candidate identifier, and each value describes the meaning of that candidate. The returned choice is usually one of these keys.
{
"model": "cmr-decisions",
"state": "My withdrawal has failed for three consecutive days. Please help me check the payment account.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this ticket?",
"criteria": {
"billing": "Payment, billing, refund, and withdrawal issues",
"technical": "Program defects, service failures, and system integration issues",
"sales": "Product inquiries, purchasing, and contract issues"
}
}
}
}

Ordered Scoring (score)

It is suitable for ordered evaluations such as satisfaction, sentiment intensity, and business priority. In criteria, use an array of levels arranged from low to high, with the meaning of each level clearly defined. The number of levels and scoring rules are determined by the selected upstream model.
{
"model": "cmr-decisions",
"state": "I have reported this three times, but the issue remains unresolved, which is very disappointing.",
"questions": {
"frustration": {
"type": "score",
"instructions": "Assess the customer's dissatisfaction level and rate it from low to high according to the criteria.",
"criteria": ["Calm", "Somewhat dissatisfied", "Very dissatisfied"]
}
}
}

Proposition Judgment (noul)

It is suitable for determining whether a ticket is urgent, whether a text expresses a complaint intent, and whether manual intervention is required. noul is usually a value from 0 to 1 indicating the degree to which a proposition holds, rather than a boolean value. Business teams can set processing thresholds based on actual evaluations.
{
"model": "cmr-decisions",
"state": "Please process it immediately. The payment must be completed today.",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does the text express an urgent request that needs to be handled immediately?"
}
}
}

Structured Status and Multiple Problems

state can be passed directly as a JSON object or array without converting it to a string first. An object or array here represents a single state to be evaluated, not multiple independent requests in batches. Multiple questions share the same state, and answers are mapped through question identifiers.
{
"model": "cmr-decisions",
"state": {
"ticket": {
"subject": "Withdrawal failed",
"message": "It has been failing for three days, and I must make the payment today. I am very dissatisfied."
},
"history": [
{"role": "customer", "text": "I also reported this yesterday, but it is still unresolved."}
]
},
"questions": {
"department": {
"type": "choice",
"instructions": "Select the team responsible for handling this ticket.",
"criteria": {
"billing": "Payment, billing, and withdrawal issues",
"technical": "Program defects and system failures",
"sales": "Purchasing and contract inquiries"
}
},
"frustration": {
"type": "score",
"instructions": "Assess the customer's dissatisfaction level from low to high.",
"criteria": ["Calm", "Somewhat dissatisfied", "Very dissatisfied"]
},
"is_urgent": {
"type": "noul",
"instructions": "Does it need to be handled with priority?"
}
}
}
Example of state in array form:
{
"model": "cmr-decisions",
"state": [
{"role": "customer", "text": "The withdrawal failed."},
{"role": "customer", "text": "It has been three days, and the payment must be made today."}
],
"questions": {
"is_urgent": {"type": "noul", "instructions": "Based on the context, does it need to be handled with priority?"}
}
}

Provider Custom Request Parameters

The CMR Decisions Standard fields are model, state, and questions. The default admission rules keep only these three fields. Extra top-level fields that do not match any rule are discarded by default and are not automatically passed to the upstream. To pass additional Provider parameters, an administrator must configure corresponding custom field admission/pass-through rules or enable an applicable team custom pass-through policy. Parameter names, types, and meanings are subject to the actual Provider. After configuration, verify the request that the upstream actually receives. The server also strips credentials, internal metadata, and routing control fields based on the configuration. Enabling custom pass-through does not mean that these restricted fields can be passed as business parameters. The current standard API returns a one-time JSON result and does not define streaming response parameters. Chat generation parameters such as temperature and max_tokens are not Decisions Standard fields. The current Decisions endpoint has response caching disabled, so you should not rely on identical requests hitting the cache.

Response Parameters

Basic Response Fields

The following table describes the top-level response when inference completes successfully.
Parameter
Type
Returned or Not
Description
id
string
Yes
Request tracing ID generated by the gateway, in the format of "dec-" plus a random identifier; the field with the same name from the upstream is not reused.
model
string
Yes
Upstream model name retained after protocol translation, which may be a versioned name; when no valid name is returned, it falls back to the logical model name, which may differ from the model in the request.
answers
object
Yes
Answer objects organized by question identifier; correspond to the questions in the request through answers.<question_id>.
usage
object
No
Normalized Token usage. If not provided by the upstream or if usage is absent from the translation result, this field is not returned.
The current normal response does not define the object, created, choices, or data fields. When guardrail interception or similar situations occur, handle them according to the rejection response convention for that instance.

Category Selection Results

Parameter
Type
Returned or Not
Description
answers.&lt;question_id&gt;.type
string
Returned based on the upstream response.
Typically choice.
answers.&lt;question_id&gt;.choice
string
Returned based on the upstream response.
Identifier of the selected option, typically corresponding to a key in the criteria of the request.
answers.&lt;question_id&gt;.probabilities
object
Returned based on the upstream response.
Mapping of option identifiers to probabilities, typically between 0 - 1.
answers.&lt;question_id&gt;.confidence
number
Returned based on the upstream response.
Confidence returned by the model. The specific meaning is subject to the model protocol.

Ordered Scoring Results

Parameter
Type
Returned or Not
Description
answers.&lt;question_id&gt;.type
string
Returned based on the upstream response.
Usually score.
answers.&lt;question_id&gt;.score
number
Returned based on the upstream response.
Scoring result, which may be a decimal. The value range and calculation method are subject to the selected model.
answers.&lt;question_id&gt;.legend
object
No
Mapping from level numbers to level descriptions, typically using string values such as 0, 1, and 2 as keys.
answers.&lt;question_id&gt;.probabilities
object
No
Mapping from level numbers to probabilities.
answers.&lt;question_id&gt;.confidence
number
No
Confidence returned by the model.

Proposition Judgment Results

Parameter
Type
Returned or Not
Description
answers.&lt;question_id&gt;.type
string
Returned based on the upstream response.
Usually noul.
answers.&lt;question_id&gt;.noul
number
Returned based on the upstream response.
Usually a proposition validity degree between 0 - 1; a larger value indicates that the model is more inclined to consider the proposition true.
The noul result in the TypeSafe baseline does not require the confidence field, and a missing confidence field should not be treated as a response error. The gateway requires the top-level answers to be an object, but it does not validate, complete, or normalize the internal fields of each answer. The above are common structures and do not mean that the gateway guarantees every answer has all fields, nor that the gateway has verified probability ranges, probability sums, or a complete one-to-one correspondence between questions and answers. Integrators should parse results according to the protocol of the selected model.

Usage Information

Parameter
Type
Returned or Not
Description
usage.prompt_tokens
integer
Returned when usage exists.
Number of input tokens. The TypeSafe built-in rule maps input_tokens to this field.
usage.completion_tokens
integer
Returned when usage exists.
Number of output tokens. The TypeSafe built-in rule maps output_tokens to this field.
usage.total_tokens
integer
Returned when usage exists.
Total number of tokens. If not provided in the translation result, this value is calculated by adding the input and output Token counts.
Usage is derived from the protocol translation result. The current implementation uses 0 for missing input/output counts and also treats invalid counts such as negative numbers, boolean values, and non-integers as 0. Therefore, a value of 0 does not necessarily mean that the upstream did not actually consume tokens. The client response does not include usage.cost. The billing basis is subject to the platform metering records.

Provider Custom Response Parameters

Extra fields inside answers can be retained along with the upstream result. The top-level response is organized into the standard fields described above. Extra fields returned by the upstream, such as id and provider, are not automatically passed through, and extra fields in usage are not treated as a general pass-through contract. After changing the model or Provider, reconfirm the internal structure of the answers.

Response Example

The following are examples of field formats only, and the values do not represent actual inference results. The model version name, usage, and specific answers are subject to the actual response.

Proposition Judgment

{
"id": "dec-7f3a2c1059814a62acb350be36a4d119",
"model": "typesafe/jev-1.13",
"answers": {
"is_urgent": {"type": "noul", "noul": 0.96}
},
"usage": {
"prompt_tokens": 120,
"completion_tokens": 18,
"total_tokens": 138
}
}

Combination of Category Selection, Scoring, and Proposition Judgment

This corresponds to the question identifier described in "Structured State and Multiple Questions" above. The scoring example numbers the three levels as 0, 1, and 2, and obtains 1.8 after probability weighting. This is only the result convention of the example model, and the gateway does not calculate the score on its own.
{
"id": "dec-a1b2c3d456784abca9c81234567890de",
"model": "typesafe/jev-1.13",
"answers": {
"department": {
"type": "choice",
"choice": "billing",
"probabilities": {"billing": 0.89, "technical": 0.10, "sales": 0.01},
"confidence": 0.83
},
"frustration": {
"type": "score",
"score": 1.8,
"legend": {"0": "Calm", "1": "Somewhat dissatisfied", "2": "Very dissatisfied"},
"probabilities": {"0": 0.05, "1": 0.10, "2": 0.85},
"confidence": 0.86
},
"is_urgent": {"type": "noul", "noul": 0.96}
},
"usage": {
"prompt_tokens": 427,
"completion_tokens": 73,
"total_tokens": 500
}
}

Usage Not Provided

{
"id": "dec-9e8d7c6b54324d01aabbccddeeff0011",
"model": "typesafe/jev-1.13",
"answers": {
"is_urgent": {"type": "noul", "noul": 0.78}
}
}

Error Response

The current API returns different response formats at different error stages. The client should first determine the failure based on the HTTP status code, and then parse detail and error for compatibility. Example of a standard field validation failure: state is missing, HTTP 400.
{
"detail": {
"code": "invalid_decisions_request",
"message": "Request does not match the CMR Decisions Standard",
"issues": [{"path": "/state", "reason": "missing"}]
}
}
Parameter
Description
detail.code
Validation error identifier. For a standard request shape error, the value is invalid_decisions_request.
detail.message
Error summary
detail.issues[].path
JSON Pointer path of the issue field. For the request root object, use /.
detail.issues[].reason
Reason, such as missing, object_required, or a type validation reason.
Errors that enter the shared proxy are typically wrapped as follows. The following example shows the proxy error structure when the upstream returns HTTP 529 and {"error":"Upstream service is overloaded"}. The specific message, type, param, and code are subject to the actual response:

{
"error": {
"message": "InternalServerError: {\\"error\\":\\"Upstream service is overloaded\\"}",
"type": null,
"param": null,
"code": "529"
}
}
Parameter
Description
error.message
Error description, which may contain processed upstream diagnostic information.
error.type
Error type, which can be a string or null and varies depending on the error source. Do not assume it is always a fixed string.
error.param
Related parameter. It may be null or another placeholder value when no specific parameter is identified.
error.code
Error code. It is currently common as an HTTP status code in string format.
Errors from dependent stages such as authentication and protocol configuration may also use other detail structures. Request echo fields in upstream errors, such as input, ctx, and value, are set to null before being written into the error description. The error description may also carry an exception name prefix. Do not rely on the original upstream error JSON being returned in full, and do not assume that error.message is always a directly parseable JSON. When additional diagnostic fields are present, the actual response prevails.
Common HTTP status codes:
HTTP Status Code
Common Scenes
Recommendation
400
Invalid JSON format, request body is not an object, required field missing, standard field type error, invalid logical model name, or the upstream rejects the current parameter.
Correct the request instead of retrying blindly.
401
Gateway or upstream authentication failed, or the access credential is invalid or expired.
Check the CMR API Key and upstream credentials.
403
Missing required authentication information, invalid authentication header format, or no permission to access the target model or API. The specific status depends on the authentication configuration.
Check Authorization and model access permissions.
404
The upstream model, resource, or request path does not exist.
Check the upstream model and API path configuration.
408
Request or upstream call timeout.
Decide whether to retry based on the business time limit.
422
The upstream rejects the internal structure of questions, input length, or other model constraints.
Correct the parameters based on upstream diagnostics; the current implementation retains the 422 status code.
429
Gateway rate limiting, upstream quota exceeded, or no deployment currently available.
Use a backoff policy based on Retry-After (if present).
500
Internal error in the gateway or upstream, or failed to connect to the upstream.
Record the request ID and troubleshoot; retry with backoff based on the business policy.
502
The upstream response is not a valid expected protocol result, or the protocol translation result does not satisfy the response contract.
Check the upstream and translation configurations, and contact support personnel if the issue persists.
503
The protocol translation runtime environment/configuration is unavailable, or the upstream service is unavailable.
Check the service and configuration status, and retry after recovery.
504
Upstream gateway timeout.
Decide whether to retry based on the business time limit.
529
The TypeSafe upstream is overloaded.
The current implementation retains 529 and does not uniformly rewrite it to 500; retry with fault fallback for temporary failures.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback