All Products
Search
Document Center

Edge Security Acceleration:Accelerate AI API Access with ESA

Last Updated:Apr 01, 2026

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.

    Note

    For 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           Endpoint

Benefits:

  • 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:

  1. Open the Coding Plan console.

  2. Choose API Key Management.

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

  1. In the ESA console, go to Websites and click Add Website.

  2. In the wizard, configure the following settings:

    • Accelerated Region: Choose Global (recommended for worldwide users).

    • Plan: Choose Pro or higher.

  3. 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:

  1. In the ESA console, select your site.

  2. Go to DNS > Records and click Add Record.

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

Note

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.

  1. In the ESA console, select Websites, and then click the target site in the Website column.

  2. In the navigation pane on the left, choose Rules > Origin Rules.

  3. Configure the rule with these settings:

    • Rule Name: Enter a custom name, such as CodingPlan.

    • If requests match...: Set the condition to Hostname equals and enter the domain name that uses the ali-dashscope prefix.

    • 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:

  1. In the ESA console, select Websites, and then click the target site in the Website column.

  2. In the left navigation pane, choose Rules > Network Optimization.

  3. 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 equals and enter the domain name that uses the ali-dashscope prefix.

    • Smart Routing: Turn on the switch.

After the rule is saved, it appears in the Network Optimization list with status Active.

Note

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/models

Expected 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/null

You 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

Note

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 ~/.claude

Edit the configuration file:

nano ~/.claude/settings.json

Add 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.json

Add 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:

  1. Run your application and make an API request.

  2. Check the response headers for the x-ali-esa-id header.

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