示例代码
POST
https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
$x$ 表示数学符号
$4x+5 = 6x+7$ 表示数学公式
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions' \
--header 'Authorization: Bearer {{DASHSCOPE_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "qwen2-math-72b-instruct",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Find the value of $x$ that satisfies the equation $4x+5 = 6x+7$."
}
]
}'
响应示例响应示例
{
"choices": [
{
"message": {
"role": "string",
"content": "string"
},
"finish_reason": "string",
"index": 0,
"logprobs": null
}
],
"object": "string",
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
},
"created": 0,
"system_fingerprint": null,
"model": "string",
"id": "string"
}
请求参数
Header 参数
Authorization
string
必需
示例值:
Bearer {{DASHSCOPE_API_KEY}}
Content-Type
string
必需
示例值:
application/json
Body 参数application/json
返回响应
修改于 2025-02-28 10:36:36