Skip to main content

Intelligent Routing

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

Overview

The model-code of Intelligent Routing is fixed to the auto-model prefix followed by 8 random characters (e.g., auto-model-abcd1234). The client sends a request with 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, preserving the real token usage). Applicable scope:
DimensionDescription
RegionBeijing (cn-beijing) + Singapore (ap-southeast-1)
Model typeText input only
Calling 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 protocols: 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 limitingRate limits are applied at the account and workspace levels based on the actually routed model
Key advantages:
  • Maximize model performance: Automatically matches the optimal model for different tasks, especially suited to users with extreme performance requirements.
  • Precisely reduce costs: Automatically routes simple tasks to lightweight models and matches complex tasks with advanced models, avoiding the resource waste of using overly powerful models for simple tasks, and achieving a precise match between cost and requirements.
  • Eliminate model selection difficulty: 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.
  • Minimal learning curve: Identical to the regular model onboarding process; invoke via model-code without any extra code changes.

Create Intelligent Routing

In the Bailian console, under "Model Inference > Intelligent Routing", 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 invocation permissions for that version and the candidate models.

Procedure

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

Routing strategy

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

Strategy

Model selection mechanism

Applicable Scenario

Performance first (EFFECT_FIRST)

Selects the most capable model in the candidate set for each request

Scenarios with strict 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 performance baseline

Cost-sensitive, high-concurrency scenarios that focus more on latency and unit cost

Candidate model configuration

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

Candidate models

Input

Cache input

Output

qwen3.8-flash

CNY 0.8

CNY 0.1

CNY 2.7

kimi-k3

CNY 20

CNY 2

CNY 100

qwen3.7-plus

0-256K: CNY 2

256k-1M: CNY 6

0-256K: CNY 0.4

256k-1M: CNY 1.2

0-256K: CNY 8

256k-1M: CNY 24

deepseek-v4-flash-0731 (Peak)

CNY 3

CNY 0.3

CNY 9

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

CNY 1.5

CNY 0.15

CNY 4.5

qwen3.7-max

CNY 12

CNY 2.4

CNY 36

glm-5.2

CNY 8

CNY 2

CNY 28

deepseek-v4-pro-0813 (Peak)

CNY 9

CNY 0.9

CNY 27

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

CNY 4.5

CNY 0.45

CNY 13.5

qwen3.8-max

CNY 12

CNY 1.5

CNY 36

qwen3.7-flash

0-32K: CNY 0.2

256k-1M: CNY 1.2

32k-256K: CNY 0.6

0-32K: CNY 0.04

256k-1M: CNY 0.24

32k-256K: CNY 0.12

0-32K: CNY 0.8

256k-1M: CNY 4.8

32k-256K: CNY 2.4

The table above shows the invocation prices of each candidate model (CNY per million tokens). The deepseek-v4 series uses 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, pay attention to the quota limits of each candidate model to avoid being throttled after being routed to a candidate model due to insufficient quota. We recommend selecting models with sufficient quotas as candidates, or increasing the RPM/TPM quota of the corresponding models for your account before creation.

Invoke Intelligent Routing

After an Intelligent Routing is created, invoking it works the same way as invoking a regular model—simply replace the model parameter in the request with the model-code of the Intelligent Routing (such as auto-model-abcd1234), enabling zero-code-change integration on the client side. Three invocation methods are supported: the OpenAI-compatible interface (Chat Completions and Responses) and the Anthropic protocol. Invocation examples are displayed 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 processed the request, which you can use to verify whether routing took effect; the response body retains the real token usage, and billing follows 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, enabled by default with no configuration required. When the target model is unavailable, the routing service re-initiates the entire request with another model in the candidate set instead of switching mid-inference. Automatic failover is not triggered in the following cases, and the error directly surfaces 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)
  • Timeouts or network exceptions
  • Errors occurring after streaming has started returning content
Automatic failover does not bill twice: model A → automatic failover → model B succeeds, only the fee of 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 invoke.
  • Filters out models that have been taken offline.
  • Filters out models incompatible with the current request parameters (for example, if the request carries response_format, it only routes 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 (available via all three interfaces: Chat Completions, Responses, and Messages); image or video input, image generation (text-to-image), Batch batch inference, and non-generative interfaces such as Embedding/Rerank are not supported
Context lengthThe upper limit equals the minimum context window among the models in the candidate set; requests that exceed it fail immediately with an error, without triggering automatic failover
Rate limitingRPM/TPM limits are enforced at the account and workspace level based on the model actually routed to; during automatic failover, only the consumption of the model that ultimately succeeded is counted

Metric description

Intelligent Routing filters the candidate set in real time based on request parameters and rejects unsupported parameters (returning a 400 error in the form of does not support parameter(s): <parameter name>). The three calling protocols differ in parameter support, as described 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 none, minimal, low, medium, high, xhigh, max enumeration values.
  • enable_thinking: Set to false to disable thinking, which favors non-thinking models; set to true to automatically exclude non-thinking models and automatically enable thinking.
  • max_tokens: When set, it is automatically converted to the max_completion_tokens parameter before being passed to the candidate models; routing selects only candidate models that support the max_completion_tokens parameter.
In Intelligent Routing mode, the following parameters are not supported; setting them causes a runtime error:
ParameterDescription
top_logprobsLimits the number of logprobs returned
logit_biasToken bias
stopStop sequence
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 a request is configured with explicit cache flags, the system ignores the explicit cache-related parameters.
  • Explicit caching is not involved in billing.
Only the implicit caching 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. Because different requests may be routed to different models, Intelligent Routing does not guarantee a cache hit rate. For details about how caching works and which models support it, see Context cache.

Manage route service

View detail

After the deployment succeeds, 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

Click "Edit" in the Route Configuration area to modify route version, strategy, and candidate models. Switching version changes the candidate set, taking effect within a few minutes without affecting live requests. You can also edit it through the Update a Model Deployment Task API (PUT /api/v1/deployments/{deployed_model}/update); the semantics is full replacement: all three routing_config fields 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 the 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. After deletion, the model-code cannot be reused; you must create it again.

Manage via API

Besides the console, creating, querying details, listing, editing the routing configuration, and deleting intelligent routing services are all supported through OpenAPI (pay-as-you-go billing only). For the complete API details, see Intelligent Routing API Reference. Supported APIs:
FunctionAPI
Get a list of 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 the routing configurationPUT /api/v1/deployments/{deployed_model}/update
Delete an intelligent routing serviceDELETE /api/v1/deployments/{deployed_model}
Before creating or editing, call the Get a List of Model Routing Versions API to query the available route model versions, strategies, and candidate models. Intelligent routing does not support compute-related operations such as scaling, start/stop, 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

Successfully 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.