---
title: Chat Completions
description: 使用 OpenAI 兼容格式发送消息，支持普通响应和 SSE 流式响应。
api: "POST /v1/chat/completions"
---

<RequestExample>
```bash 非流式
curl https://sub.vcnovb.cn/v1/chat/completions \
  -H "Authorization: Bearer $VC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.2","messages":[{"role":"user","content":"用三句话介绍杭州。"}],"stream":false}'
```
```bash 流式
curl -N https://sub.vcnovb.cn/v1/chat/completions \
  -H "Authorization: Bearer $VC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.2","messages":[{"role":"user","content":"用三句话介绍杭州。"}],"stream":true}'
```
</RequestExample>

## 请求参数

<ParamField body="model" type="string" required>当前 Key 可访问、支持聊天协议的模型 ID。示例使用 gpt-5.2。</ParamField>
<ParamField body="messages" type="array" required>消息列表，每项包含 role 和 content。多轮对话需携带需要保留的历史。</ParamField>
<ParamField body="stream" type="boolean">设为 `true` 返回 SSE 事件流，`false` 返回完整 JSON 响应。</ParamField>

`temperature`、工具调用、图片输入和推理参数的支持范围见对应模型说明。

## 读取响应

| 返回方式 | 读取位置 |
| --- | --- |
| 非流式文本 | `choices[0].message.content` |
| 工具调用 | `choices[].message.tool_calls` |
| 流式增量 | SSE 数据中的 `choices[].delta` |

流式请求需持续读取至完成标记。

请求中断后，可在[使用记录](/guides/usage)查看调用状态和消耗。

图片生成模型应使用[图片接口](/api/images)，视频模型应使用[视频接口](/api/videos)。
