GUIDES /

How to Use Chinese AI APIs Outside China: Qwen, DeepSeek, GLM and Kimi

Pick the right international endpoint and API key for four Chinese model families, make a small Qwen test request, and diagnose region or billing mismatches.

Start with the job: an editor that helps you write code can use a supported coding subscription; your own product backend needs a standard model API. A plan key and a standard API key can look similar while belonging to different billing systems. Decide this before choosing a model.

Choose an official API entry point

Model familyStandard API base URL for the documented routeExample model IDWhere to get the key
Qwenhttps://{workspace-id}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1qwen3.6-plusAlibaba Cloud Model Studio, Singapore workspace
DeepSeekhttps://api.deepseek.comdeepseek-flashDeepSeek API Platform
GLMhttps://api.z.ai/api/paas/v4glm-5.4Z.ai Open Platform, standard API key
Kimihttps://api.moonshot.ai/v1kimi-k3.1-proKimi API Platform

These are examples from the linked official documents, not a promise that an account in any country can buy or use them. Use the vendor’s published signup and billing options; if your account or location is ineligible, select a provider or region you can legitimately use. Do not reuse a mainland-platform key against a different provider account or regional endpoint.

Qwen: set up a small standard API test in Singapore

  1. Match the account, workspace and endpoint. Open Model Studio with an eligible Alibaba Cloud account and select Singapore. Create a standard API key in the workspace you will call. Copy the region’s workspace endpoint from the console and confirm that your workspace offers qwen3.6-plus.
  2. Set local environment variables. Set MODEL_STUDIO_WORKSPACE to the workspace ID copied from the console (normally beginning llm-) and MODEL_STUDIO_API_KEY to the standard key. Do not put the token into a browser bundle or commit it to your repo.
  3. Make one bounded request. Save the following script as check-qwen.py and run python check-qwen.py. It sends only a harmless test prompt. Calling a standard API may incur charges; check the rate and your account beforehand. If successful, look for an answer resembling ready and a usage object, rather than assuming that a response is free.
import json
import os
from urllib.request import Request, urlopen

# Use a standard Singapore Model Studio key, not a Coding Plan key.
workspace = os.environ["MODEL_STUDIO_WORKSPACE"]
key = os.environ["MODEL_STUDIO_API_KEY"]
if not workspace.startswith("llm-") or not workspace.replace("-", "").isalnum():
    raise ValueError("Use the workspace ID shown in your Model Studio console.")
if key.startswith("sk-sp-"):
    raise ValueError("Use a standard API key for this metered endpoint.")

base = f"https://{workspace}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
body = {"model": "qwen3.6-plus", "messages": [
    {"role": "user", "content": "Reply with the word ready."}
], "max_tokens": 128, "enable_thinking": False}
req = Request(base + "/chat/completions", data=json.dumps(body).encode(),
              headers={"Authorization": f"Bearer {key}",
                       "Content-Type": "application/json"}, method="POST")
with urlopen(req, timeout=30) as reply:
    result = json.load(reply)
print(result["choices"][0]["message"]["content"])
print(result.get("usage", {}))
Note:The sample targets the standard Singapore workspace route documented by Alibaba. Alibaba distinguishes the access region from inference deployment: it describes Singapore’s international deployment scope as including nodes outside mainland China, not as proof that every inference is executed in Singapore. Check current vendor terms and internal data requirements before sending real files or source code.

Use Qwen Code without mixing billing routes

In Qwen Code, select Alibaba ModelStudio, select the billing route you actually have, then choose Singapore when using the international setup documented here. A Coding Plan takes its dedicated key and plan endpoint (https://coding-intl.dashscope.aliyuncs.com/v1 for the OpenAI-compatible route); the standard API uses the Singapore workspace key and URL above. Use the documentation for the client’s required protocol. Alibaba documents the Coding Plan for interactive coding, not general backend scripts or batch jobs.

If you see 401, 403, 404 or a surprise charge

  • 401: Compare the key family and region with the base URL first. A valid key in the wrong region or plan can still fail authentication.
  • 403: Check that the account has permission to use that workspace and that any key restrictions allow the application's outbound connection. Do not send full keys in screenshots or logs.
  • 404 or model unavailable: Make sure a client that appends /chat/completions received the base URL only, then confirm the exact model ID is listed in that region or subscription.
  • Usage shows up as metered: Check that the editor is not still configured with your standard key and endpoint. A subscription on the account does not convert calls made to a metered endpoint into plan usage.

When access works, compare a single small, non-confidential task before moving a project. See Coding Plan vs pay-as-you-go API for the same-model calculation and a downloadable sample coding task.

Sources & verification

Sources checked YYSI checked official documentation for the four routes and separated vendor statements from editorial guidance. The sample uses a standard Python HTTP client. No provider API request, account signup, purchase, or country-by-country eligibility test was made for this guide.

Read our editorial standards or send corrections to [email protected].