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

# 错误处理

**1. 尝试获取 HTTP 错误代码，初步定位问题**

a. 在代码中，尽量把错误码和报错信息（message）打印出来，利用这些信息，可以定位大部分问题。

```shell theme={null}
HTTP/1.1 400 Bad Request
Date: Thu, 19 Dec 2024 08:39:19 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 87
Connection: keep-alive

{"code":20012,"message":"Model does not exist. Please check it carefully.","data":null}

```

* 常见错误代码及原因：
  * **400**：参数不正确，请参考报错信息（message）修正不合法的请求参数；
  * **401**：API Key 没有正确设置；
  * **403**：账户余额不足或者权限不够，权限不够最常见的原因是该模型需要实名认证，其他情况参考报错信息（message）；
  * **429**：触发了 rate limits；参考报错信息（message）判断触发的是 `RPM /RPD / TPM / TPD / IPM / IPD` 中的具体哪一种，可以参考 [Rate Limits](https://docs.siliconflow.cn/rate-limits/rate-limit-and-upgradation) 了解具体的限流策略
  * **504 / 503**：
    * 一般是服务系统负载比较高，可以稍后尝试；
    * 对于对话和文本转语音请求，可以尝试使用流式输出（"stream" : true），参考 [流式输出](https://docs.siliconflow.cn/faqs/stream-mode)；
  * **500**：服务发生了未知的错误，可以联系相关人员进行排查

<Frame>
  <img width="200" src="https://mintcdn.com/siliconflow-37161621/avRxNd36OE2uuCpS/images/faqs/mic/image_3.webp?fit=max&auto=format&n=avRxNd36OE2uuCpS&q=85&s=c5c28255f7a1b7b1f26e23d2e4ad6d19" data-path="images/faqs/mic/image_3.webp" />
</Frame>

b. 如果客户端没有输出相应的信息，可以考虑在命令行下运行 curl 命令 （以 LLM 模型为例）:

```shell theme={null}
curl --request POST \
   --url https://api.siliconflow.cn/v1/chat/completions \
   --header 'accept: application/json' \
   --header 'authorization: Bearer 改成你的apikey' \
   --header 'content-type: application/json' \
   --data '
{
  "model": "记得改模型",
  "messages": [
    {
      "role": "user",
      "content": "你好"
    }
  ],
  "max_tokens": 128
}' -i
```

**2. 可以尝试换一个模型，看看问题是否依旧**

**3. 如果开了代理，可以考虑将代理关闭后再尝试访问**

<Note> 如遇其他问题，请点击[硅基流动MaaS线上需求收集表](https://siliconflow.feishu.cn/share/base/form/shrcnDiK9EIkGN3sK0PepqN1Ppb?hide_subject_id=1\&hide_passport_id=1\&hide_phone=1\&hide_email=1)反馈。</Note>
