Qwen API key: how to get one from Alibaba Cloud or via a gateway
Two ways to a Qwen key: the official one in Model Studio and a single gateway key. Steps, addresses, model ids and a sample request.
5 min · · API keys · models
Qwen is Alibaba's model family, and the question "where do I get a Qwen API" comes down to a choice: set up a key in Alibaba Cloud Model Studio or connect through a gateway with a single key. Below are both paths: how to get a key from Alibaba and where it is easy to trip, and how to call Qwen 3.8 through Zukko in five minutes if registering with Alibaba does not suit you.
Qwen API key: how to get one in Model Studio
This section follows the "Obtain an API key" page of the Alibaba Cloud Model Studio documentation, last updated on 11 October 2026. The console UI changes, so check the current version of the docs.
- Register with Alibaba Cloud and sign in to the Model Studio console. Before activating the service the platform asks you to complete your account information. For the requirements and payment methods, check with Alibaba Cloud itself.
- Open the API Key page and pick a region in the top right corner. Each region has its own keys, its own API address and its own model list.
- Click Create API Key. The dialog asks for a workspace (the docs recommend keeping the default one), a description and permissions. "All" allows any model; "Custom" lets you restrict the model list and the allowed IP addresses.
- Copy the key immediately. The full key is shown once. After you close the window you cannot view it again, and a lost key has to be reset.
The documentation then recommends keeping the key out of your code and putting it in the DASHSCOPE_API_KEY environment variable:
export DASHSCOPE_API_KEY="your_key"The region trap
A key from one region does not work on another region's endpoint. According to the docs, calling the US region endpoint with a key created in a China region returns HTTP 401 with the code invalid_api_key. If you see this error with a key you are sure is correct, first check that the key's region matches the endpoint's region.
Which base_url to use
For the OpenAI-compatible mode Alibaba gives an address of the form https://<WorkspaceId>.<region>.maas.aliyuncs.com/compatible-mode/v1, where <WorkspaceId> is the identifier of your workspace from its settings page. The docs say the address ends with /compatible-mode/v1 and does not include /chat/completions. Alibaba recommends moving from the older shared dashscope domains to the workspace-specific ones, so do not copy addresses from old tutorials: take them from your region's page in the console.
When a gateway key is simpler
The Alibaba route fits if you only need Qwen and are happy to register in their cloud. If you want to try different models without opening an account with every provider, a single gateway key is more convenient. Zukko gives one fetch_... key and one dollar balance for Claude, GPT, Gemini, DeepSeek, Qwen and GLM. Access from Russia goes through the gateway, with payment via SBP, MasterCard or crypto.
| Alibaba Cloud key | Zukko key | |
|---|---|---|
| Where it is created | Model Studio console | Zukko dashboard |
| What the key is tied to | region, workspace | one balance, per-key limits |
| base_url | depends on region and workspace | https://api.zukko.pro/v1 |
| Other models | only what Alibaba offers | Claude, GPT, Gemini, DeepSeek, GLM with the same key |
| Payment | Alibaba Cloud methods | SBP, MasterCard, cryptocurrency |
A Zukko key in three steps
- Sign in to the dashboard and open the keys section. Top up from $1.
- Create a key. The full key is shown once, so store it in a secrets manager. At creation you can set daily and monthly limits in dollars and a list of allowed models: for an experiment, allow only Qwen.
- Call the model. Qwen ids in Zukko as of 18 October 2026 are
qwen3.8-maxandqwen3.8-flash. The current list is atGET https://api.zukko.pro/v1/models.
Example in Python with the official OpenAI SDK:
from openai import OpenAI
client = OpenAI(
base_url="https://api.zukko.pro/v1",
api_key="fetch_your_key",
)
response = client.chat.completions.create(
model="qwen3.8-flash",
messages=[{"role": "user", "content": "Explain the difference between a process and a thread"}],
)
print(response.choices[0].message.content)The same with curl:
curl https://api.zukko.pro/v1/chat/completions \
-H "Authorization: Bearer fetch_your_key" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3.8-flash","messages":[{"role":"user","content":"Hello"}]}'Note that the address ends with /v1 and the model name is written as in the /v1/models list, without prefixes such as openai/ or qwen/. Headers and errors are covered in the authentication reference, and the general start is in the quick start.
What Qwen costs through the gateway
Zukko prices as of 18 October 2026, $ per 1M tokens (input / output), next to the official prices from the same table:
| Model | Zukko | Official |
|---|---|---|
qwen3.8-flash | 0.038 / 0.075 | 0.15 / 0.47 |
qwen3.8-max | 0.088 / 0.238 | 2 / 6 |
Worked example: a workload of 1M input tokens and 200K output tokens on qwen3.8-flash costs 1 × 0.038 + 0.2 × 0.075 = $0.053 at Zukko and 1 × 0.15 + 0.2 × 0.47 = $0.244 at the official price. For qwen3.8-max the same volumes give 0.088 + 0.2 × 0.238 = about $0.136 versus 2 + 0.2 × 6 = $3.2. Prices change; the current list is always in /v1/models and on the Models page in the dashboard. Which of the two models handles your task, test on your own data: compare price, context (1M for both) and the result.
Keeping the key safe
- Do not commit the key to a repository or paste it into chats. Read it from an environment variable.
- Create a separate key for each project with a daily limit, so a leak is capped by the limit. More habits in the article on API key security.
- If a key is exposed, revoke it and issue a new one. This works at Alibaba (there is a reset and delete for keys) and in the Zukko dashboard.
To try Qwen without extra registrations, create a key in the dashboard and repeat the example above. If you specifically need Qwen Code, see the separate guide.
FAQ
Where do I get a Qwen API if I only need one test request?
The shortest path is a gateway key: top up from $1 and call qwen3.8-flash as in the example above. At Alibaba you need a cloud registration and a choice of region.
Why does my Alibaba key return 401 when I copied it correctly?
Most often the key was created in one region while the request goes to another region's address. Create the key in the console of the region whose address you use.
Do I need a prefix before the model name?
Not at Zukko: pass qwen3.8-flash or qwen3.8-max as listed in /v1/models. Prefixes are only needed by some clients with their own naming scheme, for example third-party wrappers, and that is described in their documentation.
Can I restrict a key to Qwen models only?
Yes. In the Zukko dashboard a key has a list of allowed models and limits. A request to another model returns 403 model_not_allowed_for_key.
zukko
Pay 25×
less
for Claude Code & ChatGPT
One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.
Related articles
- xAI Grok API: Connecting Grok 4.7, Price and the 256K ContextHow to call grok-4.7 through an OpenAI-compatible API, what to do about the 256K context limit and what typical requests cost. Plus a comparison with Grok 4.6.
- Grok API from Russia: connecting without a foreign cardStep by step connection to Grok 4.7, 4.6 and 4.5 through a gateway: key, address, first request in curl and Python, streaming, images and payment by SBP or crypto.
- Claude Sonnet 5.5 via API: connection, prices and cache at October 18, 2026How to call claude-sonnet-5-5 from Python and curl, what a typical request costs with and without cache, and how it differs from Sonnet 5 and Sonnet 4.6.
- Claude on Android in Russia: what to do if the app won't installIf the official Claude app won't install on Android in Russia, you can still use the model from your phone: through the gateway's web chat or a client with your own key.