认证
所有请求使用 Bearer Token。不要把真实 API Key 写进公开代码、前端页面或日志。
Authorization: Bearer YOUR_API_KEY
Models
不要在文档里硬编码当前全部模型。前往 NewBee 模型广场查看模型 ID、能力、价格与上下文;也可以按账号权限请求:
curl https://api.newbeeapi.com/v1/models \ -H "Authorization: Bearer YOUR_API_KEY"
Responses API
curl https://api.newbeeapi.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"input": "请回复:NewBee API 连接成功"
}'Chat Completions
curl https://api.newbeeapi.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "user", "content": "你好,NewBee"}
]
}'Embeddings、Images、Videos 与流式响应
Embeddings、图片和视频模型请以模型广场显示的模型类型与当前服务能力为准。支持流式响应时,在请求中按接口要求设置 stream: true,并在客户端处理事件流。
| 能力 | 路径 | 选择模型 |
|---|---|---|
| Embeddings | /v1/embeddings | Embedding 模型 |
| Images | /v1/images | 图片模型 |
| Videos | /v1/videos | 视频模型 |
错误码
| 状态码 | 含义 | 优先检查 |
|---|---|---|
| 400 | 请求参数错误 | JSON、必填字段、模型参数 |
| 401 | 认证失败 | Bearer Key、令牌状态 |
| 403 | 无权限 | 模型权限、账号分组 |
| 404 | 路径或模型不存在 | Base URL、endpoint、模型 ID |
| 409 | 请求冲突 | 重复或状态冲突 |
| 429 | 限流或额度不足 | 频率、余额、额度 |
| 500 / 502 / 503 | 服务或上游异常 | 重试、日志、模型状态 |
| 524 | 上游超时 | 请求复杂度、网络和上游状态 |