Application Load Balancer (ALB) Extensible Edition allows you to integrate multiple large language model (LLM) services through a unified endpoint. By configuring AI Service server groups and forwarding rules based on model names in request bodies, ALB automatically routes requests to the corresponding backend AI services, providing a unified entry point and simplifying client integration.
Scenario
A company building AI applications needs to call the qwen-turbo model from Alibaba Cloud Model Studio and the deepseek-chat model from DeepSeek. ALB Extensible Edition provides AI Service server groups that allow clients to send OpenAI-compatible requests to ALB. By specifying the model name in the request body, ALB forwarding rules route requests to the corresponding backend LLM service, creating a unified endpoint that reduces business complexity and maintenance costs.
Prerequisites
You have got ALB Extensible Edition public preview access.
You have created a virtual private cloud (VPC) in the China (Ulanqab) region with a vSwitch in Zone A and Zone B, and the vSwitches have public SNAT configured (required for AI Service server groups to call public LLM services).
You have activated Alibaba Cloud Model Studio and DeepSeek, and got API keys for both.
You have registered a custom domain name. Since this tutorial deploys the ALB instance in the China (Ulanqab) region, the domain must have completed ICP filing.
You have prepared a server certificate that matches your custom domain name. Certificates purchased outside of Alibaba Cloud must be uploaded to Alibaba Cloud SSL Certificate.
Procedure
1. Create an ALB Extensible Edition instance
Log on to the ALB console, select the China (Ulanqab) region, and click Create ALB.
On the buy page, complete the following configurations and click Create Now.
Region: China (Ulanqab) is selected by default.
Network Type: Select Internet.
VPC and Zone: Select the target VPC, select Ulanqab Zone A and Ulanqab Zone B, select available vSwitches, and select Automatically assign EIP.
IP Version: Select IPv4.
Edition: Select Extensible.
On the Confirm Order page, check the instance configuration and click Activate Now.
2. Create AI Service server groups
Create two AI Service server groups to connect to Alibaba Cloud Model Studio and DeepSeek respectively.
Create the Alibaba Cloud Model Studio server group
On the ALB console - Server Groups page, click Create Server Group. Set Server Group Type to AI Service. Specify an easy-to-recognize name. This tutorial uses
sgp-ai-qwen.Click Create. In the The server group is created dialog box, click Add Backend Server.
In the Add AI Service panel, complete the following configurations and click OK.
Model provider: Select Alibaba Cloud Model Studio.
Endpoint: This field is auto-populated after you select the Model provider.
API Key: Enter the API key for Alibaba Cloud Model Studio.
Create the DeepSeek server group
Repeat the preceding steps to create a second AI Service server group named
sgp-ai-deepseek.When you Add Backend Server, set Model provider to DeepSeek, enter the API key for DeepSeek, then click OK.
3. Create a listener
In the ALB console, click the target instance ID to go to the Instance Details page. Click the Listener tab and click Create Listener.
In the Configure Listener step, set Listener Protocol to HTTPS and Listener Port to
443. Then, click Next.In the Configure SSL Certificate step, select the server certificate that matches your custom domain name and click Next.
In the Select Server Group step, select the AI Service type and the Alibaba Cloud Model Studio server group
sgp-ai-qwen. Then, click Next.The server group you select here is used for the default rule of the listener. This rule processes requests that do not match any other forwarding rules. Adjust the settings based on your needs.
In the Configuration Review step, check the configuration and click Submit.
4. Configure forwarding rules
Requests are matched against forwarding rules in ascending order of priority. When a request matches a rule, the corresponding action is executed, and no subsequent rules are matched. Create forwarding rules with the AI Model condition to route requests to the appropriate backend AI service based on the model name in the request body.
Configure the Alibaba Cloud Model Studio forwarding rule
On the Listener tab on the instance details page, click the target listener ID. On the Listener Details page, click the Forwarding Rules tab.
Click Add New Rule, complete the following configurations, then click OK.
For Add Condition, select AI Model.
Model Name: Enter
qwen-turbo.Action: Forward To the
sgp-ai-qwenserver group.
Configure the DeepSeek forwarding rule
Repeat the preceding steps to add a second forwarding rule.
Set Model Name to
deepseek-chatand select Forward To thesgp-ai-deepseekserver group.
Model Name is an optional parameter. The AI Model forwarding condition matches all requests with paths/v1/completions,/v1/chat/completions, or/v1/embeddings, and request content that conforms to the OpenAI-compatible protocol. If you specify a Model Name, themodelfield in the request body must also match the specified model name.
5. Configure DNS resolution
Point your custom domain name to the DNS name of the ALB instance using a canonical name (CNAME) record. Clients access ALB through your custom domain name.
This tutorial uses Alibaba Cloud DNS as an example. For domain names not registered with Alibaba Cloud, you must first add the domain name to the Alibaba Cloud DNS console.
In the ALB console, copy the Domain Name of the target instance.
Log on to the Alibaba Cloud DNS console. In the Actions column of the target domain name, click Settings. On the Settings page, click Add Record.
Add a CNAME record with the following information and click OK.
Record Type: Select CNAME.
Hostname: Enter a domain prefix such as
ai. If your root domain isexample.com, the domain for accessing ALB isai.example.com.Query Source and TTL: Keep the default values.
Record Value: Enter the DNS name of the ALB instance.
In the Change Resource Record Confirmation dialog box, check the DNS information and click OK.
6. Verify the configuration
Use curl commands to verify that requests are correctly routed to the corresponding LLM services. Replace
ai.example.comwith your actual configured domain name. Make sure DNS resolution has taken effect.Client requests must conform to the OpenAI-compatible protocol. The request path must be
/v1/completions,/v1/chat/completions, or/v1/embeddings, and the request body must contain amodelfield. Forwarding rules route requests based on the value of themodelfield.
Test Alibaba Cloud Model Studio (qwen-turbo model)
curl -v \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-turbo",
"messages": [
{
"role": "user",
"content": "Who are you"
}
]
}' \
https://ai.example.com/v1/chat/completionsA successful request returns a response like the following. The model field is qwen-turbo, and the content field contains a self-introduction from Qwen, indicating that the request was correctly routed to Alibaba Cloud Model Studio.
{
"choices": [
{
"message": {
"role": "assistant",
"content": "I am Qwen, a large-scale language model developed by the Tongyi Lab of Alibaba Group. My Chinese name is Tongyi Qianwen, and my English name is Qwen. I can perform various tasks such as answering questions, creating text, logical reasoning, and programming. You can call me Qwen or Tongyi Qianwen. How can I help you?"
},
"finish_reason": "stop",
"index": 0
}
],
"object": "chat.completion",
"model": "qwen-turbo"
}Test DeepSeek (deepseek-chat model)
curl -v \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "Who are you"
}
]
}' \
https://ai.example.com/v1/chat/completionsA successful request returns a response like the following. The model field is deepseek-chat, and the content field contains a self-introduction from DeepSeek, indicating that the request was correctly routed to DeepSeek.
{
"object": "chat.completion",
"model": "deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I am DeepSeek, an AI assistant created by DeepSeek company!\n\nI am a plain text model. Although I do not support multi-modal recognition, I have a file upload feature that can help you process images, txt, pdf, ppt, word, excel and other files, and read text information from them for analysis and processing.\n\nSome of my features:\n- Completely free to use, with no paid plans\n- Context length of up to 128K, allowing for very long conversations\n- Supports web search (needs to be enabled manually)\n- Can be used by downloading the app from the official app store\n- Knowledge cutoff is July 2024\n\nI am happy to help you answer questions, assist with thinking, process documents, or engage in various conversations! Is there anything I can help you with? ✨"
},
"logprobs": null,
"finish_reason": "stop"
}
]
}Resource cleanup
After testing, if you no longer need the resources, follow these steps to release them and avoid unnecessary charges.
In the Alibaba Cloud DNS console, delete the CNAME record you added.
Clean up ALB resources
In the ALB console, find the target instance and click Release in the Actions column.
In the Server Group console, find the target server group and click Delete in the Actions column.
Clean up VPC resources (optional)
If the VPC and vSwitches were created specifically for this tutorial, you can delete them in the VPC console.
Additional information
Billing
ALB Extensible Edition: Currently in public preview and free to use.
Public network access fees: Internet NAT Gateway charges instance fees and Capacity Unit (CU) fees. The EIPs bound to the NAT gateway and the ALB Extensible Edition instance have their own billing rules, and fees are charged by EIP.
Domain name and DNS resolution fees: In addition to domain registration fees charged by your domain provider, configuring DNS resolution on Alibaba Cloud requires paying public authoritative DNS resolution fees.
Certificate fees: Purchasing certificates from Alibaba Cloud or uploading certificates to Alibaba Cloud requires paying server certificate fees.
Model fees: Calling the LLM APIs of Alibaba Cloud Model Studio and DeepSeek incurs charges.
Regions where ALB Extensible Edition is available
Area | Region | Zone |
China | China (Ulanqab) | Zone A, Zone B, and Zone C |
China (Hangzhou) | Zone J and Zone K | |
China (Beijing) | Zone I, Zone K, and Zone L | |
China (Shanghai) | Zone B and Zone F | |
China (Hong Kong) | Zone B, Zone C, and Zone D | |
Asia-Pacific | Singapore | Zone A, Zone B, and Zone C |
Japan (Tokyo) | Zone B, Zone C, and Zone E | |
Europe and Americas | Germany (Frankfurt) | Zone A and Zone B |
US (Silicon Valley) | Zone A and Zone B | |
Middle East | UAE (Dubai) | Zone A and Zone B |