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

# Chat Completions 接口

> 使用 OpenAI Chat Completions 格式调用 NexusAPI 文本模型。

本页只说明 **OpenAI Chat Completions**。模型是否支持该接口、Responses、Anthropic Messages 或图片接口，请先查看[接口与模型能力矩阵](/developer/capability-matrix)。

<Tip>
  **字段参考与可用性以不同来源判断**

  完整请求字段和响应结构可查看 [Apifox 接口参考](https://nexusapi.apifox.cn/)；但模型是否当前上架、当前 Key 是否可用、以及应使用哪种协议，应以能力矩阵和控制台模型广场为准。
</Tip>

## Chat Completions

请求地址：

```text theme={"system"}
POST https://nexusapi.link/v1/chat/completions
```

请求示例：

```bash theme={"system"}
curl 'https://nexusapi.link/v1/chat/completions' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [
      {
        "role": "user",
        "content": "你好"
      }
    ]
  }'
```

## 请求头

| 请求头             | 必填 | 说明                        |
| --------------- | -- | ------------------------- |
| `Content-Type`  | 是  | 固定为 `application/json`    |
| `Authorization` | 是  | 格式为 `Bearer YOUR_API_KEY` |

## 常见错误

| 错误          | 可能原因                        |
| ----------- | --------------------------- |
| 401         | API Key 错误、未传 Key 或 Key 已失效 |
| 429         | 请求过快、触发限流或服务暂时繁忙            |
| 500/502/503 | 请求处理暂时失败或服务不可用              |
| 524         | 请求等待时间过长                    |

遇到 `status_code=500, not implemented` 时，不要按普通 500 重试；当请求的是当前平台 Anthropic 类型 Claude 渠道时，这通常是误用了不兼容的 `/v1/responses` 接口，详见[常见错误说明](/faq/common-errors)。

遇到其他错误时请保存 Request ID，并参考[问题自查](/faq/self-check)。不要在短时间内连续高频重试。
