安全规范:密钥需在服务端环境变量存储,禁止前端硬编码或提交至代码仓库。
POST https://aigw.omniedu.com/v1/chat/completions| 头部字段 | 值 | 说明 |
|---|---|---|
Content-Type | application/json | 固定值 |
Authorization | Bearer {api_key} | 鉴权密钥 |
{
"model": "qwen3.5-plus",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}{
"id": "chatcmpl-bc64043e-1dba-9a26-8481-64543930307c",
"object": "chat.completion",
"created": 1773192778,
"model": "",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好!有什么可以帮助你的吗?"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 2,
"completion_tokens": 9,
"total_tokens": 11
},
"system_fingerprint": "fp_abc123"
}| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 请求唯一标识 |
object | string | 对象类型,固定为 chat.completion |
created | integer | 响应生成时间戳(Unix) |
model | string | 实际使用的模型 ID |
choices[].message.role | string | 消息角色,固定为 assistant |
choices[].message.content | string | 模型生成的文本内容 |
choices[].finish_reason | string | 结束原因:stop(正常)/length(长度限制)/content_filter(内容过滤) |
usage.prompt_tokens | integer | 输入 Token 数量 |
usage.completion_tokens | integer | 输出 Token 数量 |
usage.total_tokens | integer | 总 Token 数量 |