Skip to main content

Intelligent Routing

Intelligent Routing dynamically analyzes user request content and automatically matches the most suitable model from the candidate model set to process each request, helping enterprises achieve optimal AI resource allocation in complex scenarios.

Overview

The model-code of Intelligent Routing is fixed with the auto-model prefix followed by 8 random characters (for example, auto-model-abcd1234). The client sends a request via this model-code → the routing service dynamically analyzes the request content and automatically matches the most suitable model from the candidate set → actual model inference → the response is returned (the response body indicates the model that actually executed the request and retains the real token usage). Applicable scope:
DimensionDescription
RegionBeijing (cn-beijing) + Singapore (ap-southeast-1)
Model typeText input only
ProtocolSupports OpenAI-compatible interfaces (Chat Completions, Responses) and the Anthropic protocol (Messages); the DashScope native protocol is not supported
Access domainOnly maas.aliyuncs.com is supported (OpenAI-compatible and Responses protocol: https://{WorkspaceId}.{region}.maas.aliyuncs.com/compatible-mode/v1; Anthropic protocol: https://{WorkspaceId}.{region}.maas.aliyuncs.com/apps/anthropic; region is cn-beijing or ap-southeast-1); dashscope.aliyuncs.com (including compatible-mode) is not supported
BillingPay-as-you-go billing method
Rate limitRate limits are applied based on the actual routed model, at both the account and workspace level
Key advantages:
  • Maximized model performance: Automatically matches the optimal model for each task, particularly suited to users with the most demanding performance requirements.
  • Precise cost reduction: Automatically routes simple tasks to lightweight models and matches complex tasks with advanced models, avoiding the resource waste of assigning an oversized model to a small task and achieving precise alignment between cost and needs.
  • Eliminates model selection difficulties: No need for users to manually conduct complex model evaluation and comparison; the platform automatically selects the optimal solution throughout, greatly lowering the barrier to model selection.
  • Effortless usage experience: Fully consistent with the standard model integration process; simply invoke via model-code, with no code changes required.

Create an Intelligent Routing

Under "Model Inference > Intelligent Routing" in the Bailian Console, click "Create Intelligent Routing" to enter the creation page.

Prerequisites

  • A Bailian workspace has been activated.
  • The target routing model version has been released, and the current account has been granted permission to call that version and the candidate models.

Procedure

  1. Enter the service name (required, up to 50 characters).
  2. Select a released version from the routing model version dropdown (maintained by the platform).
  3. Select "Performance first" or "Cost first" as the routing strategy.
  4. In the candidate model set, select the candidate models (at least 2).
  5. Click Confirm Deployment to complete the creation.
After a successful deployment, the system generates a globally unique model-code (in the format of auto-model-XXXXXXXX), and clients use this model-code to make calls. A deleted model-code is not reused. In addition to the console, you can also create intelligent routing through OpenAPI. For interface details, see the Intelligent Routing API reference.

Routing strategy

The routing strategy determines which model in the candidate model set processes each request. Both strategies dynamically match models based on request content (not fixed routing) and are selected at creation time.

Strategy

Model selection mechanism

Applicable scenarios

Performance first (EFFECT_FIRST)

Selects the highest-performing model in the candidate set for each request

Scenarios with stringent quality requirements, such as mission-critical business, complex reasoning, and high-quality content generation

Cost first (COST_FIRST)

Intelligently schedules lightweight models while meeting the minimum performance threshold

Cost-sensitive, high-concurrency scenarios where latency and unit cost are primary concerns

Candidate model configuration

The candidate model set is the range of models the routing service can choose from when selecting a model. When creating an Intelligent Routing, select the models to participate in routing from the candidate list in the "candidate model set" area. Select at least 2 candidate models; otherwise the deployment cannot proceed.
RAM users can only select candidate models for which they have been granted model call permissions — if fewer than 2 models are selectable, you must first grant the RAM user additional model call permissions in the workspace.
Routing model versions are the standardized release form of the Intelligent Routing capability. Each version specifies the model range and core capabilities supported by the routing system in the corresponding phase. The candidate model list is determined by the selected routing model version—each version corresponds to one candidate set, and sets cannot be combined across versions. The currently released routing model versions and their candidate models are as follows:
  • model-router-20260908

Candidate models

Input

Cached input

Output

qwen3.8-flash

$0.15

$0.016

$0.47

kimi-k3

$3

$0.3

$15

qwen3.7-plus

0-256K:$0.4

256k-1M:$1.2

0-256K:$0.08

256k-1M:$0.24

0-256K:$1.6

256k-1M:$4.8

deepseek-v4-flash-0731 (Peak)

$0.44

$0.044

$1.32

deepseek-v4-flash-0731 (Off-peak)

$0.22

$0.022

$0.66

qwen3.7-max

$2.5

$0.5

$7.5

glm-5.2

$1.4

$0.28

$4.4

deepseek-v4-pro-0813 (Peak)

$1.32

$0.132

$3.96

deepseek-v4-pro-0813 (Off-peak)

$0.66

$0.066

$1.98

qwen3.8-max

$2

$0.25

$6

qwen3.7-flash

0-32K:$0.03

256k-1M:$0.2

32k-256K:$0.1

0-32K:$0.006

256k-1M:$0.04

32k-256K:$0.02

0-32K:$0.13

256k-1M:$0.8

32k-256K:$0.4

The table above shows the invocation prices of each candidate model (CNY per million tokens). The deepseek-v4 series adopts peak/off-peak time-based billing. All candidate models support the thinking mode, and thinking tokens are billed at the output price.
When selecting candidate models, note the quota limits of each candidate model to avoid being throttled after routing to a candidate model due to insufficient quota. We recommend selecting models with sufficient quota as candidates, or raising the RPM/TPM quota of the corresponding models for your account before creation.

Invoke Intelligent Routing

After an Intelligent Routing is created, it is invoked in the same way as a regular model—simply replace the model parameter in the request with the Intelligent Routing model-code (such as auto-model-abcd1234), enabling zero-code-change integration on the client side. Three invocation methods are supported: the OpenAI-compatible API (Chat Completions, Responses) and the Anthropic protocol. Invocation examples are shown in tabs by calling protocol.
  • OpenAI-compatible (Chat Completions)
  • OpenAI-compatible (Responses)
  • Anthropic protocol
curl
curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto-model-abcd1234",
    "messages": [{"role": "user", "content": "你好"}]
  }'
Response: The model field in the response body is the identifier of the model that actually executed the request, which you can use to verify whether routing took effect; the response body retains the real token usage, and billing is based on the model actually routed to. Billing: Fees are charged based on the model actually routed to; the Intelligent Routing service itself is currently free of charge.

Automatic failover

Intelligent Routing has built-in automatic failover, which is enabled by default and requires no configuration. When the target model is unavailable, the routing service re-initiates the entire request with another model in the candidate set instead of switching midway through inference. Automatic failover is not triggered in the following cases; errors are passed through directly with the original information from the actual model:
  • 429 (rate limiting)
  • Deterministic errors such as 400/403/404/500 (switching models will most likely fail as well)
  • Timeout or network exceptions
  • Errors occurring after a streaming response has started returning content
Automatic failover does not result in duplicate billing: if Model A → automatic failover → Model B succeeds, only the fee for Model B is charged.

Real-time filtering rules

The routing service applies real-time filtering to the candidate set:
  • Filters out models that the current account has no permission to call.
  • Filters out models that have been taken offline.
  • Filters out models that are incompatible with the current request parameters (for example, if the request carries response_format, it routes only to candidate models that support this parameter).
The subset actually available to a single request changes dynamically based on permissions, model status, and request parameters.

Limits

LimitDescription
Calling protocolOpenAI-compatible interfaces (Chat Completions, Responses) and the Anthropic protocol (Messages); the DashScope native protocol is not supported
Request typeOnly text input is supported (for all three interfaces: Chat Completions, Responses, and Messages); image and video input, image generation (text-to-image), Batch (batch inference), and non-generation interfaces such as Embedding/Rerank are not supported
Context lengthUpper limit = the minimum context window among the models in the candidate set; requests exceeding the limit fail immediately without triggering automatic failover
Rate limitingRPM/TPM rate limiting applies to the actually routed model at the account and workspace level; during automatic failover, only the consumption of the model that finally succeeds is counted

Parameter description

Intelligent Routing filters the candidate set in real time based on request parameters and rejects unsupported parameters (returning a 400 error such as does not support parameter(s): <parameter name>). Parameter support differs across the three calling protocols, described separately below:
  • OpenAI-compatible (Chat Completions)
  • OpenAI-compatible (Responses)
  • Anthropic protocol
  • response_format: routes only to candidate models that support this parameter.
  • enable_search: routes only to candidate models that support this parameter.
  • reasoning_effort: by default routes only to candidate models that support this parameter; this parameter supports only the enumeration values none, minimal, low, medium, high, xhigh, and max.
  • enable_thinking: set to false to disable thinking, with a preference for non-thinking models; set to true to automatically exclude non-thinking models and enable thinking.
  • max_tokens: when set, it is automatically converted to the max_completion_tokens parameter and passed to the candidate model; during routing, only candidate models that support the max_completion_tokens parameter are selected.
In Intelligent Routing mode, the following parameters are not supported; setting them causes a runtime error:
ParameterDescription
top_logprobsLimits the number of returned logprobs
logit_biasToken bias
stopStop sequences
tool_choiceTool selection
parallel_tool_callsParallel tool calls
logprobsWhether to return logprobs
top_pNucleus sampling
temperatureSampling temperature
presence_penaltyPresence penalty
nNumber of generations
thinking_budgetThinking budget length

Cache

Intelligent Routing does not support explicit cache parameters:
  • If the request is configured with an explicit cache flag, the system ignores parameters related to explicit caching.
  • Explicit caching is not involved in billing.
Only the implicit cache provided by the actually invoked model is supported: a cache hit is possible only when the request is routed to the same model and the prompt prefix meets that model's caching conditions. Since different requests may be routed to different models, Intelligent Routing does not guarantee a cache hit rate. For details about how caching works and the models that support it, see Context cache.

Manage route service

View detail

After a successful deployment, click the service name in the Intelligent Routing list to open the details page, where you can view:
  • Basic info: service name, model-code, running status, routing strategy tag.
  • Route configuration: route model version, routing strategy, candidate set and candidate model list.
  • Billing: pay-as-you-go, billed by the actual model's unit price.
  • Deploy config: each candidate model's TPM/RPM throttle quota.

Modify route config

In the "Routing Configuration" area of the details page, click "Modify" to change the routing model version, routing policy, and candidate models. When you switch the routing version, the candidate model set changes accordingly; changes take effect within a few minutes and do not affect live requests. You can also edit via the update model deployment API (PUT /api/v1/deployments/{deployed_model}/update), whose semantics are full replacement — all three fields of routing_config are required. After selecting a specific version, online routing behavior remains long-term stable; please conduct a thorough evaluation before upgrading to avoid business impact. Current version: model-router-2026-0908. Route versions are not auto-updated.

Delete service

Delete an Intelligent Routing service from the Intelligent Routing list, or call the delete Intelligent Routing service API (DELETE /api/v1/deployments/{deployed_model}) to delete it directly. A model-code cannot be reused after deletion; you must create a new one.

Manage via API

In addition to the console, the creation, detail query, listing, routing configuration editing, and deletion of the Intelligent Routing service can all be performed through OpenAPI (pay-as-you-go billing method only). For complete API descriptions, see the Intelligent Routing API reference. Supported APIs:
FeatureAPI
List model routing versionsGET /api/v1/deployments/model-routing/versions
Create an Intelligent Routing servicePOST /api/v1/deployments
List Intelligent Routing servicesGET /api/v1/deployments?plan=mr
Query Intelligent Routing service detailsGET /api/v1/deployments/{deployed_model}
Edit routing configurationPUT /api/v1/deployments/{deployed_model}/update
Delete an Intelligent Routing serviceDELETE /api/v1/deployments/{deployed_model}
Before creating or editing, use the "List model routing versions" API to query the available routing model versions, policies, and candidate models. Intelligent Routing does not support compute-related operations such as scaling, starting/stopping, rate limit configuration, or renaming.

Routing effect

This chapter covers routing effect metrics and monitoring. Effect metrics are viewed on the detail page's "Routing effect" tab; call monitoring is viewed on the Model Monitoring page.

Routing metrics

View the following metrics on the detail page's "Routing effect" tab. The displayed metrics are estimates, for reference only; not for billing settlement; actual billing is based on "Cost and Usage":

Metric

Meaning

Anomaly action

Total routing requests

Total requests received (including failover-succeeded)

Investigate upstream throttling/anomalies on spikes

Routing success rate

Forwarded requests ÷ total requests × 100%

On drop, check candidate model availability

Actual model cost (estimated)

Full cost estimated at actual model list price (tiered billing: lowest tier; peak-valley: peak price; excludes free quota; deviates from actual billing)

On rise, check routing strategy and candidate set

Baseline model cost (estimated)

Hypothetical cost if all handled by the baseline model (same estimation methodology)

—

Savings

Baseline cost − actual cost (positive means routing saved cost)

—

Billed request count

Successful requests that incur charges

—

Spend share

Single-model cost ÷ total cost

On anomaly, check candidate-set distribution

Cost notes

Cost analysis data has approximately a 1-hour delay and is not real-time. The above costs are all estimated by catalog price as full cost, excluding account discounts and free quotas, for reference only to evaluate routing savings. Tiered billing models use the lowest-tier catalog price; peak-valley pricing models use peak prices. Actual billing can be viewed in "Cost and Usage".

Model monitoring

For more granular call monitoring, go to the Model Monitoring page. It shows model monitoring and logs at the auto-model dimension, not individual monitoring of the actually-routed models.