赞
踩
在 ChatGPT 中,由于各种原因(如网络连接不稳定、并发超限、服务器故障等),可能会发生一些错误。ChatGPT 会根据错误类型返回相应的错误代码,以便开发人员进行问题排查和解决。作为二次开发ChatGPT的开发人员,也应该时刻关注和处理系统中出现的错误,以提高用户的体验和满意度。
This guide includes an overview on error codes you might see from both the API and our official Python library. Each error code mentioned in the overview has a dedicated section with further guidance.
本指南包括您可能从API和我们的官方Python库中看到的错误代码的概述。概述中提到的每个错误代码都有一个专门的部分提供进一步的指导。
CODE错误码 | OVERVIEW 概览 |
---|---|
401 - Invalid Authentication 401 -验证无效 | Cause: Invalid Authentication 原因:无效身份验证 Solution: Ensure the correct API key and requesting organization are being used.解决方案:确保使用正确的API密钥和请求组织。 |
401 - Incorrect API key provided 401 -提供的API密钥不正确 | Cause: The requesting API key is not correct.原因:请求的API密钥不正确。Solution: Ensure the API key used is correct, clear your browser cache, or generate a new one. 解决方案:确保使用的API密钥正确,清除浏览器缓存,或生成一个新的。 |
401 - You must be a member of an organization to use the API 401 -您必须是组织的成员才能使用API | Cause: Your account is not part of an organization.原因:您的帐户不属于组织。Solution: Contact us to get added to a new organization or ask your organization manager to invite you to an organization. 解决方案:联系我们以添加到新组织,或要求您的组织经理邀请您加入组织。 |
429 - Rate limit reached for requests 429 -请求已达到速率限制 | Cause: You are sending requests too quickly. 原因:您发送请求的速度太快 Solution: Pace your requests. Read the Rate limit guide.解决方案:加快你的请求。阅读速率限制指南。 |
429 - You exceeded your current quota, please check your plan and billing details 429 -您已超出当前配额,请检查您的计划和账单详细信息 | Cause: You have hit your maximum monthly spend (hard limit) which you can view in the account billing section.原因:您已达到您的最大每月支出(硬限制),您可以在帐户结算部分查看。 Solution: Apply for a quota increase. 解决办法:申请增加配额。 |
429 - The engine is currently overloaded, please try again later 429 -服务器当前过载,请稍后再试 | Cause: Our servers are experiencing high traffic.原因:我们的服务器正在经历高流量。Solution: Please retry your requests after a brief wait. 解决方案:请在短暂等待后重试您的请求。 |
500 - The server had an error while processing your request 500 -服务器在处理您的请求时出错 | Cause: Issue on our servers. 原因:我们的服务器上的问题。Solution: Retry your request after a brief wait and contact us if the issue persists. Check the status page. 解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。检查状态页面。 |
This error message indicates that your authentication credentials are invalid. This could happen for several reasons, such as:
此错误消息表示您的身份验证凭据无效。这可能有几个原因,例如:
To resolve this error, please follow these steps:
要解决此错误,请执行以下步骤:
This error message indicates that the API key you are using in your request is not correct. This could happen for several reasons, such as:
此错误消息表示您在请求中使用的API密钥不正确。这可能有几个原因,例如:
To resolve this error, please follow these steps:
要解决此错误,请执行以下步骤:
This error message indicates that your account is not part of an organization. This could happen for several reasons, such as:
此错误消息表示您的帐户不属于组织。这可能有几个原因,例如:
To resolve this error, please follow these steps:
要解决此错误,请执行以下步骤:
This error message indicates that you have hit your assigned rate limit for the API. This means that you have submitted too many tokens or requests in a short period of time and have exceeded the number of requests allowed. This could happen for several reasons, such as:
此错误消息表示您已达到为API分配的速率限制。这意味着您在短时间内提交了太多令牌或请求,并且超过了允许的请求数量。这可能有几个原因,例如:
To resolve this error, please follow these steps:
要解决此错误,请执行以下步骤:
This error message indicates that you have hit your maximum monthly spend for the API. You can view your maximum monthly limit, under ‘hard limit’ in your [account billing settings] (/account/billing/limits). This means that you have consumed all the credits allocated to your plan and have reached the limit of your current billing cycle. This could happen for several reasons, such as:
此错误消息表明您已达到API的每月最大支出。您可以在[帐户计费设置](/account/billing/limits)中的“硬限制”下查看您的每月最高限额。这意味着您已消耗了分配给计划的所有积分,并已达到当前计费周期的限额。这可能有几个原因,例如:
To resolve this error, please follow these steps:
要解决此错误,请执行以下步骤:
This error message indicates that our servers are experiencing high traffic and are unable to process your request at the moment. This could happen for several reasons, such as:
此错误消息表示我们的服务器正在经历高流量,目前无法处理您的请求。这可能有几个原因,例如:
To resolve this error, please follow these steps:
要解决此错误,请执行以下步骤:
TYPE 类型 | OVERVIEW 概览 |
---|---|
APIError API错误 | Cause: Issue on our side. 原因:我们这边的问题。Solution: Retry your request after a brief wait and contact us if the issue persists. 解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。 |
Timeout 超时 | Cause: Request timed out. 原因:请求超时。Solution: Retry your request after a brief wait and contact us if the issue persists.解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。 |
RateLimitError 速率限制错误 | Cause: You have hit your assigned rate limit.原因:您已达到指定的速率限制。Solution: Pace your requests. Read more in our Rate limit guide. 解决方案:加快你的请求。阅读我们的速率限制指南。 |
APIConnectionError API连接错误 | Cause: Issue connecting to our services.原因:连接到我们的服务的问题。Solution: Check your network settings, proxy configuration, SSL certificates, or firewall rules. 解决方案:检查网络设置、代理配置、SSL证书或防火墙规则。 |
InvalidRequestError 无效请求错误 | Cause: Your request was malformed or missing some required parameters, such as a token or an input. 原因:您的请求格式不正确或缺少某些必需的参数,如标记或输入。Solution: The error message should advise you on the specific error made. Check the documentation for the specific API method you are calling and make sure you are sending valid and complete parameters. You may also need to check the encoding, format, or size of your request data.解决方案:错误消息应告知您所犯的具体错误。检查您正在调用的特定API方法的文档,并确保发送的参数有效且完整。您可能还需要检查请求数据的编码、格式或大小。 |
AuthenticationError 验证错误 | Cause: Your API key or token was invalid, expired, or revoked.原因:您的API密钥或令牌无效、过期或已撤销。Solution: Check your API key or token and make sure it is correct and active. You may need to generate a new one from your account dashboard.解决方案:检查您的API密钥或令牌,并确保其正确且处于活动状态。您可能需要从您的帐户仪表板生成一个新的。 |
ServiceUnavailableError 服务不可用错误 | Cause: Issue on our servers. 原因:我们的服务器上的问题。Solution: Retry your request after a brief wait and contact us if the issue persists. Check the status page.解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。检查状态页面。 |
An APIError
indicates that something went wrong on our side when processing your request. This could be due to a temporary error, a bug, or a system outage.
“APIError”表示在处理您的请求时,我们这边出现了问题。这可能是由于临时错误、bug或系统中断。
We apologize for any inconvenience and we are working hard to resolve any issues as soon as possible. You can check our system status page for more information.
查询不到您需要的页面,给您造成的不便我们深表歉意!您可以查看我们的系统状态页面了解更多信息。
If you encounter an APIError
, please try the following steps:
如果遇到 APIError
,请尝试以下步骤:
Our support team will investigate the issue and get back to you as soon as possible. Note that our support queue times may be long due to high demand. You can also post in our Community Forum but be sure to omit any sensitive information.
我们的支持团队将调查此问题并尽快回复您。请注意,由于需求量大,我们的支持队列时间可能会很长。您也可以在我们的社区论坛发帖,但请务必省略任何敏感信息。
A Timeout
error indicates that your request took too long to complete and our server closed the connection. This could be due to a network issue, a heavy load on our services, or a complex request that requires more processing time.
“超时”错误表示您的请求花费了太长时间才完成,我们的服务器关闭了连接。这可能是由于网络问题,我们的服务负载过重,或者需要更多处理时间的复杂请求。
If you encounter a Timeout error, please try the following steps:
如果遇到 Timeout 错误,请尝试以下步骤:
A RateLimitError
indicates that you have hit your assigned rate limit. This means that you have sent too many tokens or requests in a given period of time, and our services have temporarily blocked you from sending more.
RateLimitError
表示您已达到指定的速率限制。这意味着您在给定时间内发送了太多标记或请求,我们的服务暂时阻止您发送更多标记或请求。
We impose rate limits to ensure fair and efficient use of our resources and to prevent abuse or overload of our services.
我们实施速率限制,以确保公平和有效地使用我们的资源,并防止滥用或超载我们的服务。
If you encounter a RateLimitError, please try the following steps:
如果遇到 RateLimitError
,请尝试以下步骤:
An APIConnectionError
indicates that your request could not reach our servers or establish a secure connection. This could be due to a network issue, a proxy configuration, an SSL certificate, or a firewall rule.
“APIConnectionError”表示您的请求无法到达我们的服务器或建立安全连接。这可能是由于网络问题、代理配置、SSL证书或防火墙规则。
If you encounter an APIConnectionError
, please try the following steps:
如果遇到 APIConnectionError
,请尝试以下步骤:
An InvalidRequestError
indicates that your request was malformed or missing some required parameters, such as a token or an input. This could be due to a typo, a formatting error, or a logic error in your code.
InvalidRequestError
表示您的请求格式不正确或缺少某些必需的参数,例如标记或输入。这可能是由于代码中的打字错误、格式错误或逻辑错误。
If you encounter an InvalidRequestError
, please try the following steps:
如果遇到 InvalidRequestError
,请尝试以下步骤:
An AuthenticationError
indicates that your API key or token was invalid, expired, or revoked. This could be due to a typo, a formatting error, or a security breach.
AuthenticationError
表示您的API密钥或令牌无效、已过期或已撤销。这可能是由于打字错误、格式错误或安全漏洞造成的。
If you encounter an AuthenticationError
, please try the following steps:
如果遇到 AuthenticationError
,请尝试以下步骤:
A ServiceUnavailableError
indicates that our servers are temporarily unable to handle your request. This could be due to a planned or unplanned maintenance, a system upgrade, or a server failure. These errors can also be returned during periods of high traffic.
“ServiceUnavailableError”表示我们的服务器暂时无法处理您的请求。这可能是由于计划内或计划外的维护、系统升级或服务器故障。这些错误也可能在高流量期间返回。
We apologize for any inconvenience and we are working hard to restore our services as soon as possible.
查询不到您需要的页面,给您造成的不便我们深表歉意!
If you encounter a ServiceUnavailableError
, please try the following steps:
如果遇到 ServiceUnavailableError
,请尝试以下步骤:
If the issue persists, contact our support team via chat and provide them with the following information:
如果问题仍然存在,请通过聊天联系我们的支持团队,并向他们提供以下信息:
Our support team will investigate the issue and get back to you as soon as possible. Note that our support queue times may be long due to high demand. You can also post in our Community Forum but be sure to omit any sensitive information.
我们的支持团队将调查此问题并尽快回复您。请注意,由于需求量大,我们的支持队列时间可能会很长。您也可以在我们的社区论坛发帖,但请务必忽略任何敏感信息。
We advise you to programmatically handle errors returned by the API. To do so, you may want to use a code snippet like below:
我们建议您以编程方式处理API返回的错误。要做到这一点,您可能需要使用如下代码段:
try:
#Make your OpenAI API request here
response = openai.Completion.create(prompt="Hello world",
model="text-davinci-003")
except openai.error.APIError as e:
#Handle API error here, e.g. retry or log
print(f"OpenAI API returned an API Error: {e}")
pass
except openai.error.APIConnectionError as e:
#Handle connection error here
print(f"Failed to connect to OpenAI API: {e}")
pass
except openai.error.RateLimitError as e:
#Handle rate limit error (we recommend using exponential backoff)
print(f"OpenAI API request exceeded rate limit: {e}")
pass
如果大家想继续了解人工智能相关学习路线和知识体系,欢迎大家翻阅我的另外一篇博客《重磅 | 完备的人工智能AI 学习——基础知识学习路线,所有资料免关注免套路直接网盘下载》
这篇博客参考了Github知名开源平台,AI技术平台以及相关领域专家:Datawhale,ApacheCN,AI有道和黄海广博士等约有近100G相关资料,希望能帮助到所有小伙伴们。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。