Qwen
Qwen Chat Completions
阿里百炼上的通义千问系列模型调用指南(预览通道)
POST
v1/chat/completionsAuthorizations
Authorizationstringheaderrequired
OpenAI 兼容通道:Bearer sk-pat-您的AccessToken
密钥的值使用HAI Gateway的个人访问令牌(以 sk-pat- 开头),无需在阿里云处单独申请 API Key。
Base URL
OpenAI 兼容:
Body 参数
请求体格式与阿里云百炼 OpenAI 兼容接口一致,详细参数说明请参考 阿里云官方文档。
不支持 developer 角色
OpenAI 兼容入口只接受 system / user / assistant 三种 role;Anthropic 通道遵循官方 user / assistant 对话结构,system 单独通过顶层 system 字段传入。
cURL
curl https://api.hai.network/compatible-preview/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-pat-您的Access Token" \
-d '{
"model": "qwen3-max",
"messages": [
{
"role": "user",
"content": "你好,请用一句话介绍自己"
}
]
}'200
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "qwen3-max",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "我是通义千问,阿里巴巴研发的大语言模型。"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 18,
"total_tokens": 33
}
}