# Chat Completions API

向 `/v1/chat/completions` 发送兼容 OpenAI 的消息内容，模型标识应来自 `/v1/models`。

## 步骤

1. 获取当前模型列表，不要硬编码提供商模型。
2. 按顺序发送 `messages`，并提供非空 `model`。
3. 从 `choices` 读取回复，从 `usage` 读取计量数据。
4. 请求失败时保留 `x-request-id`。

### 示例

```bash
curl https://api.foxora.ai/v1/chat/completions \
  -H "Authorization: Bearer $FOXORA_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model-id-from-v1-models>",
    "messages": [
      {"role": "user", "content": "Summarize this in three bullets."}
    ]
  }'
```

## 预期结果

HTTP 成功响应包含助手回复和此次请求的用量信息。

> **注意：** 只有当客户端能处理 SSE 事件和提前中断的流时，才设置 `stream: true`。
