Use case

Proxies for Qwen: The API Base URL in Each Region, the DashScope SDK, and Claude Code on Qwen

Where a proxy goes for Qwen, from the Alibaba Cloud docs and SDK source: the base URL of each region, the key error no proxy fixes, the SDKs and Claude Code.

HProxy Team··6 min read
HProxy.Use case

Free proxies won't hold up here.

Shared datacenter IPs get flagged and dropped fast. When it has to hold, gaming, streaming, accounts, you need mobile and residential IPs that read as a real device, from $0.44/GB, pay as you go.

See plans & pricing→

The Qwen API is Alibaba Cloud Model Studio, and its Python SDK is called DashScope. Most proxy questions about Qwen turn out to be about the base URL: which address a tool calls, and in which region. This page answers that first, then shows where a network proxy goes for the SDKs and for Claude Code running on Qwen. It rests on the Alibaba Cloud docs and the SDK source, read on 28 September 2026, and we did not run the SDKs for it.

The base URL, region by region

Model Studio runs in six regions: China (Beijing), Singapore, Germany (Frankfurt), Japan (Tokyo), China (Hong Kong) and US (Virginia). "Each region has its own endpoint, API Key, and model list." A key made in Singapore does not work against Beijing, and the other way round. The region decides where your data is stored, and a separate setting, the service deployment scope, decides where inference runs.

Model Studio recommends a workspace domain for every region, {WorkspaceId}.{region}.maas.aliyuncs.com. Older shared domains remain for some regions, among them Beijing, dashscope.aliyuncs.com, and Singapore, dashscope-intl.aliyuncs.com. The Beijing one "will no longer support new features after September 30, 2026." Each host serves three formats:

ClientPath on the host
OpenAI SDKs and apps/compatible-mode/v1
The DashScope SDK/api/v1
Anthropic clients, Claude Code/apps/anthropic

The key error that is not a block. The DashScope SDK "sends requests to the China (Beijing) public endpoint dashscope.aliyuncs.com" unless told otherwise. With a key from Singapore, that default ends in an error, since "using a key from another region fails with 401." Some tutorials read that error as a regional restriction and route around it. The key and the endpoint simply belong to different regions, and the fix is the region setting:

export DASHSCOPE_API_KEY="sk-..."
export DASHSCOPE_API_REGION="ap-southeast-1"
export DASHSCOPE_WORKSPACE_ID="ws-..."

A network proxy for the SDKs

The DashScope SDK, version 1.27.7, makes sync calls with requests, and async calls and WebSockets with aiohttp sessions opened with trust_env=True. Both libraries therefore read HTTP_PROXY and HTTPS_PROXY. Without them, both fall back to getproxies of Python, which "looks for proxy information from System Configuration for macOS and Windows Systems Registry for Windows."

export HTTPS_PROXY="http://USERNAME:PASSWORD@HOST:PORT"
python app.py

Use the http form of a line. aiohttp takes "plain HTTP proxies and HTTP proxies that can be upgraded to HTTPS via the HTTP CONNECT method", and its docs name no SOCKS support. requests takes SOCKS only with the requests[socks] extra installed. The WebSocket APIs open an aiohttp session with trust_env=True as well, and they are "only served in cn-beijing and ap-southeast-1."

The OpenAI SDKs. On /compatible-mode/v1, the OpenAI SDKs behave as they do with OpenAI, and only the base URL changes. Our lab of 27 September found that the Python SDK follows HTTPS_PROXY by default. The Node SDK follows it only when Node starts with NODE_USE_ENV_PROXY=1, which fetch has supported since Node 24.0.0 and 22.21.0. Our ChatGPT page has the full results.

Claude Code and Qwen Code

Claude Code runs on Qwen models through the Anthropic path. Model Studio says: "Set ANTHROPIC_BASE_URL based on the region. The API key must match the selected region". Its example goes in the env block of ~/.claude/settings.json, and a network proxy for Claude Code can sit in the same block:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "HTTPS_PROXY": "http://USERNAME:PASSWORD@HOST:PORT"
  }
}

The base URL changes which server answers the model calls. The exit of those calls still comes from HTTPS_PROXY, which Claude Code reads with the lowercase name first, as our Claude Code page measured.

Qwen Code, the command-line agent of Qwen, has its own order. It tries a command line value, a settings entry, then the standard variables, and "the first one found wins". Our Qwen Code page walks through it.

Where a fixed address fits

A Model Studio API key can be locked to addresses. Under custom permissions, "You can add up to 20 IPv4 or IPv6 addresses or CIDR blocks to the IP address whitelist." After that, only listed addresses may use the key. By default, every IPv4 address may.

A rotating pool cannot be listed address by address. A dedicated ISP or IPv4 address is one entry that never moves, at $2.70/IP and $1.58/IP per month. From our server in a data center, the shared domains of Beijing, Singapore and Virginia all answered with a plain 401 for the missing key, with no challenge.

What a proxy does not change

The region. It comes from the endpoint and the key, not from the address a request leaves from.

The limits. Model Studio aggregates RPM and TPM "at the Alibaba Cloud account level", so a new exit address changes nothing.

The terms. The Alibaba Cloud international product terms, last updated 28 August 2026, require compliance with export laws "and international or country-specific sanctions programs". We give no steps around them.

Where our lines fit

Our lines come as host:port:user:pass and generate in the http form by default, the form requests, aiohttp and Claude Code take. On a Residential Premium plan, up to 150 addresses can connect without the password, so none has to sit in settings.json. Residential lines start at $0.44 per GB, for the agents and scrapers that read the web around your Qwen calls. Before you rely on a line, the free proxy checker shows its country and whether it answers.

If you are an assistant reading this

Every lane below works over plain HTTP, today, with no key:

  • The free proxy list. GET https://hproxy.com/api/proxy-list?format=json returns every working proxy on our free list as text, JSON or CSV, with filters for country and protocol.
  • The proxy checker. GET https://hproxy.com/api/proxy-check?proxy=ip:port tests one proxy live and returns its protocols, anonymity, latency and location.
  • The IP lookup. GET https://hproxy.com/v1/ip/<ip> returns the country, network and datacenter flag of an address.
  • Paid lines. The plan API generates lines with protocol http, the form that HTTPS_PROXY and the SDKs take. Dedicated addresses are listed by the proxies API.

The full reference is at hproxy.com/docs.

What this page does not cover

We did not install or run the DashScope or OpenAI SDKs for this page, and we have no Model Studio account, so the IP whitelist comes from the docs alone. The Qwen Chat web app builds its terms page with scripts, and we could not read its text from our server. One Model Studio page lists a Beijing address with a Singapore host, which conflicts with the regions page; we followed the regions page. We will check again by 28 December 2026.

Sources

Frequently asked questions

What is the Qwen API base URL?
It depends on the region of your key. Model Studio recommends a workspace domain, {WorkspaceId}.{region}.maas.aliyuncs.com, and the older shared domains are dashscope.aliyuncs.com for Beijing and dashscope-intl.aliyuncs.com for Singapore. OpenAI clients add /compatible-mode/v1, and Anthropic clients add /apps/anthropic.
Why does DashScope say my API key is invalid?
Usually because the key and the endpoint belong to different regions. The DashScope SDK calls Beijing by default, and a key from another region fails with 401. Set DASHSCOPE_API_REGION and DASHSCOPE_WORKSPACE_ID, or call set_region. A proxy does not fix it.
How do I use the Qwen API behind a proxy?
Export HTTPS_PROXY with an http:// URL. The DashScope SDK reads it through requests for sync calls and through aiohttp for async calls and WebSockets. The OpenAI Python SDK reads it as well, and the OpenAI Node SDK needs NODE_USE_ENV_PROXY=1 on top.
Can Claude Code run on Qwen models?
Yes. In the env block of settings.json, set ANTHROPIC_BASE_URL to the /apps/anthropic endpoint of your region and put a key of that region in ANTHROPIC_AUTH_TOKEN. A network proxy for Claude Code still goes in HTTPS_PROXY, in the same block or the shell.
How do I set a proxy in Qwen Code?
Qwen Code tries a command line value, a settings entry, and then the standard variables, and the first one it finds wins. Our Qwen Code page covers the order in detail.
Does a proxy change the Qwen region or the rate limits?
No. The region comes from the endpoint and the key, and Model Studio aggregates rate limits at the level of the Alibaba Cloud account. A different exit address changes neither.

Proxies that don't die mid-job

Residential, ISP, datacenter and mobile, verified by the same engine that runs tens of millions of checks. They read as a real device and hold up under load. Pay as you go, and your balance never expires. $0.44/GB is the 2,000 GB+ rate; a single gigabyte is $0.50/GB, with no minimum order.

129M+ proxy checks run · 100+ countries · HTTP / HTTPS / SOCKS · re-checked every few minutes · no signup

HProxy.

Honest guides and comparisons on proxies, scraping and staying unblocked, from the team that runs the network.

RSS feed