Manage logical models
A logical model provides a client-facing invocation name and lets you configure target models, routing strategies, and failover on the gateway. This topic describes mapping, weighted traffic splitting, intelligent routing, and the capability and authorization boundaries of logical models.
Choose a routing strategy
|
Strategy |
How it works |
Use cases |
|---|---|---|
|
Map to One Model |
Maps a logical invocation name to one target model. |
Expose a stable name while upgrading or replacing the model on the gateway. |
|
Split Traffic by Weight |
Distributes requests among multiple targets based on relative weights. |
Gradual validation or traffic distribution across multiple accounts or sources. |
|
Intelligent Routing |
Assesses task difficulty, then selects a target from configured task slots according to the invocation policy. |
Use suitable candidate models for requests of different complexity. |
Targets can be provider models available in the current instance or activated preset models. Neither a target nor a fallback can be another logical model.
Create a mapping or weighted routing model
-
Log on to the new console, select the region of your instance, and select the target dedicated instance.
-
Click Logical Models, then click Create Logical Model.
-
Enter the Invocation Name, such as
model-a. The invocation name must be unique within the current instance. It cannot contain slashes or whitespace, cannot start withauto, and can contain up to 256 UTF-8 bytes. -
Select Map to One Model and add one target, or select Split Traffic by Weight, add multiple targets, and enter a weight for each.
-
Check Capability Summary for context length, maximum output, and exposed request types. If failover is required, add fallback models in order.
-
Set the model name returned in responses if needed, then click Save. If the logical model is already used by an API, review the configuration impact before confirming the save, then check the configuration delivery status.
How relative weights are calculated
A target's share is its weight divided by the sum of all target weights. For example, weights of 7 and 3 produce relative shares of 70% and 30%. Weights of 70 and 30 are equivalent; weights do not have to sum to 100.
Each weight must be an integer from 0 to 10000, and at least one target must have a weight greater than 0. A weight of 0 excludes the target from primary traffic splitting while retaining its configuration. Actual request counts over a short period do not have to match the weight ratio exactly.
Configure intelligent routing
Intelligent routing depends on a decision model provided by Platform Presets. Before use, activate Platform Presets. Clients still use a single invocation name for the logical model, such as model-route; the invocation policy is configured in the console.
-
Create a logical model and select Intelligent Routing. Confirm that Platform Presets is activated.
-
Select 1 to 3 models for each of the simple, regular, and complex task slots. You can use provider models and preset models from the instance. The same model cannot appear in multiple slots.
-
All candidates must support Chat Completions and share at least one usable request path. Assign models to slots based on their capabilities and your business examples. The platform does not assess whether your models are suitable for the difficulty level you assign.
-
Select an invocation policy: Balanced, Cost First, Speed First, or Quality First.
-
For failover, add explicit fallbacks. Smart routing accepts only provider models from this instance as explicit fallbacks. Verify that the logical invocation name is open, then grant access on the Authorization page. In multi-API mode, first select and publish the logical model in the target API.
|
Invocation policy |
Priority |
|---|---|
|
Balanced |
Considers quality, cost, and speed together. |
|
Cost First |
Gives more weight to price among candidates capable of handling the task. |
|
Speed First |
Gives more weight to response speed among capable candidates. |
|
Quality First |
Gives more weight to capability headroom among capable candidates. |
Task difficulty determines which slots are eligible. For example, if a request is classified as a regular task, the regular and complex task slots are eligible, while the simple task slot is excluded. The invocation policy then affects candidate scores. It does not guarantee selection of the cheapest, fastest, or highest-quality model on every request. Models in the same slot do not use round-robin selection and do not automatically serve as fallbacks for each other.
Intelligent routing requires consumer authentication. Authorizing the logical invocation name allows access to this route without granting direct access to models in its slots. The same task may retain a previous selection to preserve context. If a model required to continue the task is unavailable, the request may fail directly.
The decision model is billed based on actual usage. A preset target also incurs preset model invocation charges; a provider target is billed to your provider account. Refer to the official activation page, provider terms, and bill for prices and settlement rules.
Configure failover
In the Failover (Fallback) section, add up to 5 fallback models in order. Mapping and weighted routing support provider models and preset models. Explicit fallbacks for intelligent routing support only provider models. Fallbacks must cover every request path exposed by the logical model.
After an eligible upstream failure on the target, the gateway tries fallbacks in order and skips a model that has already been attempted. Upstream 404, 429, and 5xx responses, connection failures, and first-byte timeouts can trigger failover. Other 4xx responses, gateway-generated 404 responses, and authentication, authorization, quota, or security rejections do not trigger it.
Multiple weighted targets or candidates in one slot do not automatically form a fallback chain. Configure fallbacks explicitly when you need failover. A fallback does not need separate authorization as a client-callable model.
After explicit fallbacks are exhausted, if AutoFallback is enabled for the Model API, the gateway may continue by trying the platform preset aigw/pro. This invocation is billed by usage, does not count toward the 5 explicit fallbacks, and still requires support for the current path.
Capabilities and the model name in responses
A logical model exposes only the request paths and capabilities shared by all its targets. Known maximum input, maximum output, and total token limits use the lowest corresponding value among the targets. A capability supported by only one target must not be treated as a capability of the entire logical model.
In Advanced Settings, choose whether responses return the actual executing model name or the logical model name. This affects only the model name in client responses, including streamed chunks. Logs, monitoring, and billing still record the actual executing model.
If you change targets while keeping the logical invocation name, clients can continue using the same name. If you change the logical invocation name, requests using the old name fail; update application configuration accordingly.
Open, update, or delete a logical model
-
Simple mode attempts to open a newly created logical model automatically. Check it under Instance Settings → Model Calls → Callable Models. Resolve any path conflict. For an existing anonymous endpoint, enable authentication first. In multi-API mode, select the model under Models and Routing in the target API and publish.
-
Grant the logical invocation name to a consumer or consumer group under Model Calls → Authorization. In multi-API mode, use the target API's Authorization tab. After the grant takes effect, test the logical name.
-
For later changes to targets, weights, or fallbacks, check the affected APIs and path compatibility before saving. Shared logical configuration is delivered independently; you do not need to republish each API.
-
After saving and returning to the logical model list, if a delivery task exists, check Current Shared Configuration Delivery below the saved item. For failure or partial failure, review the error and use Retry Configuration Delivery. When you reopen the edit page, this area appears only after a delivery failure or retry. Query again if the status is unknown.
If no API references the logical model, saving only creates its configuration. Having no delivery targets or a successful delivery record does not mean that clients have an invocation endpoint. If an API's publication status is unstable, wait for or resolve that API before changing shared configuration.
A logical model cannot be deleted while it is used by a Model API. Remove the references first. Deletion makes the logical invocation name unavailable and revokes authorizations obtained through it.