private_deployment
约 633 字大约 2 分钟
2025-09-10
私有部署接口服务
模型服务
私有部署提供两种模型服务:
交融大模型
QwQ-32B
请求示例
import requests
url = "API/v1/chat/completions"
payload = {
"model": "XXX",
"messages": [
{
"role": "user",
"content": "<string>"
}
],
"max_tokens": 512,
"temperature": 0.7,
"top_p": 0.7,
"frequency_penalty": 0.5,
"response_format": {"type": "text"}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)响应示例
{
"id": "<string>",
"choices": [
{
"message": {
"role": "assistant",
"content": "<string>",
"reasoning_content": "<string>"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 246
},
"created": 123,
"model": "<string>",
"object": "chat.completion"
}接口文档
**请求方式:**POST
**接口地址:**api/v1/chat/completions
请求参数说明:
headers 参数:
| 参数名称 | 参数说明 | 参数示例 | 数据类型 | 是否必须 |
|---|---|---|---|---|
| Content-Type | 类型 | application/json | string | true |
| Authorization | api key | Bearer | string | true |
Body 参数:
| 参数名称 | 参数说明 | 参数示例 | 数据类型 | 是否必须 |
|---|---|---|---|---|
| model | 要使用的模型的 ID | QwQ-32B | string | true |
| messages | 至今为止对话所包含的消息列表 | [{ "role": "user", "content": "Hello!" } ] | object[] | true |
| messages.role | 提供信息的角色 | user(assistant、 system) | string | true |
| messages.content | 信息内容 | Hello! | string | true |
| temperature | 确定响应的随机程度,,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使输出更加集中和确定 | 0.7 | number | false |
| top_p | 一种替代温度采样的方法,称为核采样,其中模型考虑具有 top_p 概率质量的标记的结果。所以 0.1 意味着只考虑构成前 10% 概率质量的标记 | 0.7 | number | false |
| frequency_penalty | 频率惩罚。-2.0 和 2.0 之间的数字。正值会根据到目前为止是否出现在文本中来惩罚新标记,从而增加模型谈论新主题的可能性 | 0.5 | number | false |
| max_tokens | 生成 token 的最大数量 | 512 | integer | false |
| response_format | 指定模型必须输出的格式的对象 | object | false | |
| response_format.type | 工具的类型 | text | string | false |
响应状态:
| 状态码 | 说明 |
|---|---|
| 200 | OK |
| 401 | "Invalid token" |
| 404 | "404 page not found" |
| 503 | Model service overloaded. Please try again later. |
响应参数说明:
| 参数名称 | 参数说明 | 参数示例 | 数据类型 |
|---|---|---|---|
| id | id | 123 | string |
| choices | 选项 | [ { "message": { "role": "assistant", "content": "", "reasoning_content": "" }, "finish_reason": "stop" } ] | object[] |
| choices.message | 主要信息 | { "role": "assistant", "content": "", "reasoning_content": "" } | object |
| choices.message.role | 响应角色 | assistant | string |
| choices.message.content | 响应内容 | Hello! | string |
| choices.message.reasoning_content | 响应推理内容 | Hello! Nice to meet you! | string |
| choices.finish_reason | 结束原因 | stop(eos、length、tool_calls) | string |
| usage | token 情况 | { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 246 } | object |
| usage.prompt_tokens | prompt 使用的 token 数 | 123 | integer |
| usage.completion_tokens | completion 使用的 token 数 | 123 | integer |
| usage.total_tokens | 总共用的 token 数 | 246 | integer |
| created | 响应的生成时间 | 123 | integer |
| model | 模型 | QwQ-32B | string |
| object | "chat.completion" | chat.completion | string |
