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

# 认证与 API Key

> 了解 Bearer API Key 的使用方式和安全建议。

所有公开 AI API 使用 Bearer Token 认证：

```http theme={null}
Authorization: Bearer sk-your-api-key
```

## 安全建议

* 不要把 API Key 写进前端浏览器代码。
* 不要把 API Key 提交到 Git 仓库。
* 不要把 API Key 放进 URL query。
* 服务端应从环境变量或密钥管理系统读取 API Key。
* 日志中不要打印完整 `Authorization` header。

## 常见认证错误

| HTTP 状态码 | 错误码                  | 说明                      |
| -------- | -------------------- | ----------------------- |
| 401      | `invalid_api_key`    | API Key 缺失、格式错误、已禁用或不存在 |
| 403      | `model_not_allowed`  | API Key 不允许调用该模型        |
| 402      | `insufficient_quota` | 余额或额度不足                 |

<Warning>
  Phase 1 文档站不启用生产 API Try It，避免用户在文档页面输入生产密钥。
</Warning>
