When your AI applications serve global users, cross-border access to Alibaba Cloud Model Studio can introduce significant latency and instability. Edge Security Acceleration (ESA) reduces network latency and improves API request success rates through its global acceleration network. This guide shows you how to configure ESA to accelerate your Coding Plan or Model Studio API endpoints.
Before you begin
You will need:
Prepare the domain registration you want to integrate with ESA.
An active Coding Plan subscription or Model Studio account.
ESA Pro plan or higher.
NoteFor the Chinese mainland deployments, your domain must have active ICP filing before you can use it with ESA.
How it works
ESA accelerates your API requests through three layers:
User → ESA Edge Node → Smart Routing → Origin (Model Studio API)
↓ ↓ ↓ ↓
Global Reduces Optimal Your API
Users Latency Path EndpointBenefits:
30-50% latency reduction for global users.
Higher success rates through intelligent routing around network issues.
Simplified configuration - just replace your base URL.
Step 1: Get your Coding Plan API domain
Your API domain depends on which service you're using and the protocol your application requires.
If you already have Coding Plan
Find your API domain in the Coding Plan console:
Open the Coding Plan console.
Choose API Key Management.
Copy your Base URL - this is your API domain.
Your domain will be one of these:
OpenAI-compatible API: https://coding-intl.dashscope.aliyuncs.com/v1
Anthropic-compatible API: https://coding-intl.dashscope.aliyuncs.com/apps/anthropic
Step 2: Configure ESA acceleration
Add your domain to ESA
In the ESA console, go to Websites and click Add Website.
In the wizard, configure the following settings:
Accelerated Region: Choose Global (recommended for worldwide users).
Plan: Choose Pro or higher.
Complete the payment.
ESA creates your site and displays it in the site list. This process typically takes 1-2 minutes.
Configure a DNS record for API acceleration
Configure the DNS record with the following settings:
In the ESA console, select your site.
Go to and click Add Record.
Configure the record:
Record Type: Select CNAME.
Hostname: Enter a prefix for a custom subdomain, such as
ali-dashscope.Proxy Status: Turn on the switch to enable proxy acceleration.
Record Value: Select Domain Name.
Domain Name: Enter
coding-intl.dashscope.aliyuncs.com.Origin Host: Set to Match Origin's Domain Name.
After the record is saved, the console
the console displays your acceleration domain. For example, api.example.com.
For CNAME records, ESA automatically recognizes the origin as a domain. For A/AAAA records, enter IP addresses directly.
Configure origin fetch settings
Configure how ESA connects to your origin. This setting is separate from your DNS configuration.
In the ESA console, select Websites, and then click the target site in the Website column.
In the navigation pane on the left, choose .
Configure the rule with these settings:
Rule Name: Enter a custom name, such as
CodingPlan.If requests match...: Set the condition to
Hostname equalsand enter the domain name that uses theali-dashscopeprefix.Origin Protocol and Port: Set Origin Protocol to HTTPS and HTTPS Port to
443.
After the rule is saved, it appears in the Origin Rules list with status Active.
Enable smart routing (recommended)
Smart routing automatically selects the fastest path to your origin, improving success rates:
In the ESA console, select Websites, and then click the target site in the Website column.
In the left navigation pane, choose .
Configure the origin rule with the following settings:
Rule Name: Enter a custom name, such as
smart-routing.If requests match...: Set the condition to
Hostname equalsand enter the domain name that uses theali-dashscopeprefix.Smart Routing: Turn on the switch.
After the rule is saved, it appears in the Network Optimization list with status Active.
DNS changes take 5-10 minutes to propagate globally. You can verify propagation with dig api.example.com or nslookup api.example.com.
Step 3: Test before production (recommended)
Before updating your application, verify that ESA acceleration works:
# Test your accelerated domain
curl -I http://ali-dashscope.example.com/v1/modelsExpected output:
HTTP/2 200
x-ali-esa-id: 2c8f7b9a-1234-5678-abcd-ef0123456789
content-type: application/json
...The x-ali-esa-id header confirms that ESA is processing the request.
Compare latency (optional):
# Direct access to origin
time curl -s https://coding-intl.dashscope.aliyuncs.com/v1/models > /dev/null
# Access through ESA
time curl -s http://ali-dashscope.example.com/v1/models > /dev/nullYou should see reduced latency through ESA, especially from international locations.
Step 4: Update your AI application
Replace your API base URL in your application configuration. The key change is:
Before: https://coding-intl.dashscope.aliyuncs.com
After: http://ali-dashscope.example.com
You can apply for a free edge certificate to enable HTTPS access.
OpenClaw configuration
This example shows how to configure OpenClaw to use your accelerated domain.
Update the baseUrl field in your OpenClaw configuration:
{
"models": {
"mode": "merge",
"providers": {
"bailian": {
# Replace the baseUrl field with your custom domain name.
"baseUrl": "http://ali-dashscope.example.com/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models":[
# Your custom model information
]
}
}
}
# Other configurations
} Claude Code
macOS/Linux
File location: ~/.claude/settings.json
If the .claude directory doesn't exist, create it first:
mkdir -p ~/.claudeEdit the configuration file:
nano ~/.claude/settings.jsonAdd this configuration:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "{{YOUR_API_KEY}}",
# Replace the baseUrl field with your custom domain name.
"ANTHROPIC_BASE_URL": "http://ali-dashscope.example.com/apps/anthropic",
"ANTHROPIC_MODEL": "{{MODEL}}"
}
}Save the file, then restart your terminal for changes to take effect.
Windows
File location: C:\Users\\.claude\settings.json
Using Command Prompt:
# Create the directory
if not exist "%USERPROFILE%\.claude" mkdir "%USERPROFILE%\.claude"
# Open the file in Notepad
notepad "%USERPROFILE%\.claude\settings.json"Using PowerShell:
# Create the directory
mkdir -Force $HOME\.claude
# Open the file in Notepad
notepad $HOME\.claude\settings.jsonAdd this configuration:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "{{YOUR_API_KEY}}",
# Replace the baseUrl field with your custom domain name.
"ANTHROPIC_BASE_URL": "http://ali-dashscope.example.com/apps/anthropic",
"ANTHROPIC_MODEL": "{{MODEL}}"
}
}Save the file, then restart your terminal for changes to take effect.
Verify the configuration
After updating your application, verify that ESA acceleration is working:
Run your application and make an API request.
Check the response headers for the
x-ali-esa-idheader.Monitor latency in your application logs.
You should see:
Response headers include
x-ali-esa-id(confirms ESA is processing requests).Reduced response times compared to direct origin access.
Troubleshooting
Connection refused or timeout errors
Cause: DNS records not propagated yet.
Solution: Wait 5-10 minutes and try again. Verify propagation with nslookup api.example.com.
HTTP 502 Bad Gateway
Cause: ESA cannot reach your origin.
Solution:
Verify your origin address is correct in the ESA console.
Confirm origin port is set to HTTPS 443 in your origin rule.
Check that your origin is accessible from the internet.
Certificate errors in applications
Cause: Your application requires HTTPS but the acceleration domain uses HTTP.
Solution: Apply for a free edge certificate in the ESA console. Choose SSL/TLS, then Edge Certificates.
Next steps
Monitor performance: Use the ESA analytics dashboard to track latency improvements and request success rates.
Enable security features: Configure WAF rules and DDoS protection in the ESA console.