> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 聊天完成对象

> 基于当前生产行为，理解 Chat Completion 与 Chat Completion Chunk 的核心结构

> 更新日期：2026-06-06

# 聊天完成对象

`/v1/chat/completions` 非流式返回 `chat.completion`，流式返回 `chat.completion.chunk`。

本文页保留的是 Crazyrouter 当前 OpenAI 兼容返回里最稳定、最通用的结构认知。

## 非流式对象

当前生产最小请求示例：

```bash cURL theme={null}
curl https://api.crazyrouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {
        "role": "user",
        "content": "Explain what a REST API is in one sentence."
      }
    ],
    "max_tokens": 64
  }'
```

当前生产返回的典型骨架：

```json theme={null}
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1774177466,
  "model": "gpt-5.5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "...",
        "reasoning_content": null,
        "tool_calls": null
      },
      "finish_reason": "stop"
    }
  ]
}
```

### 应该这样理解

* `message.content` 是最终文本输出
* `message.tool_calls` 只在模型请求工具时出现
* `message.reasoning_content` 在某些模型或某些路由下可能出现，但当前不应把它当成稳定必有字段

***

## 流式对象

流式请求时，服务器通过 SSE 逐块返回 `chat.completion.chunk`：

```json theme={null}
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion.chunk",
  "created": 1774177466,
  "model": "gpt-5.5",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "content": "..."
      },
      "finish_reason": null
    }
  ]
}
```

常见 SSE 形态：

```text theme={null}
data: {"object":"chat.completion.chunk",...}
data: {"choices":[{"delta":{"content":"..."}}],...}
data: [DONE]
```

***

## 常看字段

| 字段                             | 说明                                                 |
| ------------------------------ | -------------------------------------------------- |
| `object`                       | 非流式是 `chat.completion`，流式是 `chat.completion.chunk` |
| `model`                        | 实际返回所使用的模型名                                        |
| `choices[].message.content`    | 非流式最终文本                                            |
| `choices[].message.tool_calls` | 非流式工具调用                                            |
| `choices[].delta.content`      | 流式增量文本                                             |
| `choices[].finish_reason`      | 停止原因，如 `stop`、`length`、`tool_calls`                |

<Note>
  上游模型可能会透传额外字段。写客户端时应优先依赖稳定的通用字段，不要假设每个模型都暴露相同的扩展字段。
</Note>
