Qwen
Qwen Chat Completions
Guide for calling Qwen series models on Alibaba Bailian (preview channel)
POST
v1/chat/completionsAuthorizations
Authorizationstringheaderrequired
OpenAI-compatible channel: Bearer sk-pat-YourAccessToken
The key value is your HAI Gateway Personal Access Token (starting with sk-pat-). No separate API key from Alibaba Cloud is required.
Base URL
OpenAI-compatible:
Body Parameters
The request body format is compatible with the Alibaba Bailian OpenAI-compatible interface. For detailed parameter descriptions, refer to the Alibaba Cloud official documentation.
The developer role is not supported
The OpenAI-compatible endpoint only accepts system / user / assistant roles. The Anthropic channel follows the official user / assistant conversation structure, with system messages passed via the top-level system field.
cURL
curl https://api.hai.network/compatible-preview/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-pat-YourAccessToken" \
-d '{
"model": "qwen3-max",
"messages": [
{
"role": "user",
"content": "Hello, please introduce yourself in one sentence"
}
]
}'200
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "qwen3-max",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I am Qwen, a large language model developed by Alibaba."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 18,
"total_tokens": 33
}
}