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

# 错误码

> HTTP 状态码与业务错误码对照及排查

错误响应为 JSON，形如：

```json theme={null}
{ "error": { "message": "...", "type": "...", "code": "invalid_request" } }
```

## HTTP 状态码

| 状态  | 含义        | 常见原因                                       |
| --- | --------- | ------------------------------------------ |
| 400 | 请求无效      | 参数缺失 / 格式错误                                |
| 401 | 未鉴权       | 密钥缺失或错误                                    |
| 403 | 禁止        | 密钥被吊销 / 无该模型权限                             |
| 404 | 不存在       | 路径或模型不存在                                   |
| 429 | 限流        | 见[限流](/zh/api-reference/guide/rate-limits) |
| 5xx | 上游 / 网关错误 | 重试或联系支持                                    |

## 业务错误码

错误响应 `error.code` 字段的可能取值：

| code                             | 含义         | 处理                  |
| -------------------------------- | ---------- | ------------------- |
| `invalid_request`                | 请求参数无效     | 校对参数与请求体            |
| `bad_request_body`               | 请求体格式错误    | 检查 JSON 是否合法        |
| `read_request_body_failed`       | 读取请求体失败    | 检查请求体与 Content-Type |
| `convert_request_failed`         | 请求转换失败     | 检查参数是否符合该接口格式       |
| `sensitive_words_detected`       | 触发敏感词      | 调整输入内容              |
| `prompt_blocked`                 | 提示被拦截      | 调整提示内容              |
| `access_denied`                  | 无访问权限      | 检查密钥、权限与分组          |
| `model_not_found`                | 模型不存在      | 确认 `model` 名与套餐可用模型 |
| `invalid_api_type`               | 接口类型不支持    | 使用受支持的接口格式          |
| `get_channel_failed`             | 无可用渠道      | 稍后重试或联系支持           |
| `channel:no_available_key`       | 渠道无可用密钥    | 稍后重试或联系支持           |
| `channel:invalid_key`            | 渠道密钥无效     | 联系支持                |
| `channel:model_mapped_error`     | 模型映射错误     | 联系支持                |
| `channel:response_time_exceeded` | 上游响应超时     | 重试；必要时减小请求          |
| `insufficient_user_quota`        | 额度不足       | 充值或检查套餐额度           |
| `pre_consume_token_quota_failed` | 预扣额度失败     | 检查额度后重试             |
| `model_price_error`              | 模型计价异常     | 联系支持                |
| `count_token_failed`             | token 统计失败 | 检查输入后重试             |
| `do_request_failed`              | 请求上游失败     | 重试                  |
| `bad_response`                   | 上游响应异常     | 重试或联系支持             |
| `bad_response_status_code`       | 上游返回异常状态码  | 重试或联系支持             |
| `empty_response`                 | 上游空响应      | 重试；流式可增大超时          |
| `read_response_body_failed`      | 读取上游响应失败   | 重试                  |
| `json_marshal_failed`            | 序列化失败      | 重试或联系支持             |
| `query_data_error`               | 数据查询错误     | 重试或联系支持             |
| `update_data_error`              | 数据写入错误     | 重试或联系支持             |
