认证
除公开端点外,所有请求都需要在 Header 中携带 API Key。
http
Authorization: Bearer sk-tmp-...端点列表
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /v1/models | 模型列表 |
| POST | /v1/chat/completions | OpenAI Chat 兼容接口 |
| POST | /v1/messages | Anthropic Messages 兼容接口 |
| POST | /v1/responses | Responses 兼容接口 |
| POST | /v1/images/generations | 图片生成接口 |
Chat Completions 示例
json
{
"model": "glm-5",
"messages": [
{"role": "system", "content": "你是一个有帮助的助手。"},
{"role": "user", "content": "你好!"}
],
"stream": false,
"temperature": 0.7,
"max_tokens": 2048
}错误码
| HTTP 状态码 | 类型 | 说明 |
|---|---|---|
| 400 | validation_error | 请求参数错误 |
| 401 | authentication_error | API Key 无效或缺失 |
| 402 | insufficient_quota | 余额或套餐不足 |
| 429 | rate_limit_exceeded | 速率或套餐窗口超限 |
| 500+ | upstream_error | 上游服务异常或超时 |