First Look at Alibaba’s Qwen API

First Look at Alibaba’s Qwen API

As an avid online shopper, and some-time frustrated e-Commerce entrepreneur, I’m familiar with Alibaba’s online marketplace where you can find suppliers for wholesale purchases, and their consumer focused AliEpress e-Commerce app. I was not however aware of their cloud services, or their Artificial Intelligence offerings. That changed shortly after the release of DeepSeek from another Chinese tech firm. Alibaba hit the headlines with a release of Qwen 2.5-Max, their very own OpenAI and DeepSeek beating AI model (according to their research papers).

In this post, we’ll take a first look at the Chat Completions API to see what benefits there are over the competition.

How to Sign Up to the Qwen API

Following the instructions outlined on the Alibaba Cloud website, you can sign up for a free trial of their cloud service platform. Be mindful that you will be required to enter payment details for any future spending, which is always a barrier to entry – but if you don’t mind risking accidental “bill shock”, you can activate your free trial.

Once you’ve registered for an account, head to the Alibaba Cloud Model Studio Console. There you’ll be confronted with a sight that is familiar to AliEpress and Temu customers the world over. Yes, that’s right, it wouldn’t be Alibaba if there wasn’t a flashing popup where you can claim something or “free”

Last time I tried that on Temu, I ended up getting $300 free credits, which I was unable to use, and accidentally bought a pair of binoculars, so I wasn’t falling for this one.

It turns out however that you do have to “grab the deal” and activate the models to continue, so there was no getting around it.

Making a request to the Chat Completion Endpoint

Once you’ve signed up and obtained an API key, you can start checking out the API.

Thankfully, HTTP requests for Qwen follow the same pattern as OpenAI and DeepSeek, so it is very easy to test using any existing code samples you have.

The only changes required are to replace the API key with the one you just generated and use the Qwen HTTP endpoint URLs. For example, the Chat Completions endpoint is:

Authentication

Authentication is simple using your API key as the Bearer token in an HTTP request using PostMan, or cURL.

curl -X POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen-plus",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user", 
            "content": "Who are you?"
        }
    ]
}'

The Chat Completion Endpoint

POST: https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions

Chat Completions Request

Send the JSON formatted request in the body via a POST to the completion URL.

{
    "model": "qwen-plus",
    "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the average age of a university student in Australia?"}
    ],
    "stream": false
}

Chat Completion Response

{
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "The average age of a university student in Australia is typically around **19 to 21 years old** for undergraduate students. This aligns with the common pathway where students enter university directly after completing high school at approximately 17 or 18 years old and then spend 3 to 4 years pursuing their degree.\n\nHowever, this can vary significantly depending on several factors:\n\n1. **Course Type**: Students enrolled in vocational or postgraduate courses (e.g., master's or doctoral programs) tend to be older, often in their late 20s or 30s.\n   \n2. **Mature-Age Students**: Australia has a significant number of mature-age students (those aged 25 or older) who return to study after gaining work experience or taking time off. These students can raise the average age within certain programs or institutions.\n\n3. **Part-Time Study**: Some students study part-time while working or managing other responsibilities, which may delay their completion and increase their age during their studies.\n\nAccording to data from the **Australian Government's Department of Education**, about 16% of domestic higher education students are considered mature-age (25 years or older). This means that while the majority of students fall into the traditional 18-24 age range, there is considerable diversity in student ages across Australian universities.\n\nIn summary, while the typical undergraduate student is around 19-21 years old, the overall average age of all university students, including postgraduates and mature-age students, is likely to be slightly higher, potentially in the mid-20s."
            },
            "finish_reason": "stop",
            "index": 0,
            "logprobs": null
        }
    ],
    "object": "chat.completion",
    "usage": {
        "prompt_tokens": 31,
        "completion_tokens": 325,
        "total_tokens": 356
    },
    "created": 1738489539,
    "system_fingerprint": null,
    "model": "qwen-plus",
    "id": "chatcmpl-f7e69856-4acc-9c29-9bf7-916dca14a903"
}

As you can see from both the Request and Response object, the API is completely compatible with the OpenAI and DeepSeek API.