Open main menu
首页
专栏
课程
分类
归档
Chat
Sci-Hub
谷歌学术
Libgen
GitHub镜像
登录/注册
搜索
关闭
Previous
Previous
Next
Next
OpenAI-ChatGPT最新官方接口《错误代码大全》全网最详细中英文实用指南和教程,助你零基础快速轻松掌握全新技术(九)(附源码)
sockstack
/
328
/
2023-11-07 00:01:24
<p><span style="color: red; font-size: 18px">ChatGPT 可用网址,仅供交流学习使用,如对您有所帮助,请收藏并推荐给需要的朋友。</span><br><a href="https://ckai.xyz/?sockstack§ion=detail" target="__blank">https://ckai.xyz</a><br><br></p> <article class="baidu_pl"><div id="article_content" class="article_content clearfix"> <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css"> <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-25cebea3f9.css"> <div id="content_views" class="markdown_views prism-atom-one-dark"> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path></svg><p></p> <div class="toc"> <h3>Error codes 错误码</h3> <ul> <li>前言</li> <li>Introduction 导言</li> <li>API errors API 错误</li> <li> <ul> <li>401 - Invalid Authentication 401 -验证无效</li> <li>401 - Incorrect API key provided 401 -提供的API密钥不正确</li> <li>401 - You must be a member of an organization to use the API 401 -您必须是组织的成员才能使用API</li> <li>429 - Rate limit reached for requests 429 -请求已达到速率限制</li> <li>429 - You exceeded your current quota, please check your plan and billing details 429 -您已超出当前配额,请检查您的计划和账单详细信息</li> <li>429 - The engine is currently overloaded, please try again later 429 -发动机当前过载,请稍后再试</li> </ul> </li> <li>Python library error types Python库错误类型</li> <li> <ul> <li>APIError API错误</li> <li>Timeout 超时</li> <li>RateLimitError 速率限制错误</li> <li>APIConnectionError API连接错误</li> <li>InvalidRequestError 无效请求错误</li> <li>AuthenticationError 验证错误</li> <li>ServiceUnavailableError 服务不可用错误</li> </ul> </li> <li>Persistent errors 持续错误</li> <li>Handling errors 错误处理 (附python源码)</li> <li>其它资料下载</li> </ul> </div> <p></p> <p><img referrerpolicy="no-referrer" src="https://img-blog.csdnimg.cn/98be187dd3de4d6db15ee1354ee02a84.jpeg#pic_center" alt="在这里插入图片描述"></p> <h1> <a id="_6"></a>前言</h1> <p>在 ChatGPT 中,由于各种原因(如网络连接不稳定、并发超限、服务器故障等),可能会发生一些错误。ChatGPT 会根据错误类型返回相应的错误代码,以便开发人员进行问题排查和解决。作为二次开发ChatGPT的开发人员,也应该时刻关注和处理系统中出现的错误,以提高用户的体验和满意度。</p> <h1> <a id="Introduction__10"></a>Introduction 导言</h1> <p>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.<br> 本指南包括您可能从API和我们的官方Python库中看到的错误代码的概述。概述中提到的每个错误代码都有一个专门的部分提供进一步的指导。</p> <h1> <a id="API_errors_API__15"></a>API errors API 错误</h1> <table> <thead><tr> <th>CODE错误码</th> <th>OVERVIEW 概览</th> </tr></thead> <tbody> <tr> <td>401 - Invalid Authentication 401 -验证无效</td> <td>Cause: Invalid Authentication 原因:无效身份验证 Solution: Ensure the correct API key and requesting organization are being used.解决方案:确保使用正确的API密钥和请求组织。</td> </tr> <tr> <td>401 - Incorrect API key provided 401 -提供的API密钥不正确</td> <td>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密钥正确,清除浏览器缓存,或生成一个新的。</td> </tr> <tr> <td>401 - You must be a member of an organization to use the API 401 -您必须是组织的成员才能使用API</td> <td>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. 解决方案:联系我们以添加到新组织,或要求您的组织经理邀请您加入组织。</td> </tr> <tr> <td>429 - Rate limit reached for requests 429 -请求已达到速率限制</td> <td>Cause: You are sending requests too quickly. 原因:您发送请求的速度太快 Solution: Pace your requests. Read the Rate limit guide.解决方案:加快你的请求。阅读速率限制指南。</td> </tr> <tr> <td>429 - You exceeded your current quota, please check your plan and billing details 429 -您已超出当前配额,请检查您的计划和账单详细信息</td> <td>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. 解决办法:申请增加配额。</td> </tr> <tr> <td>429 - The engine is currently overloaded, please try again later 429 -服务器当前过载,请稍后再试</td> <td>Cause: Our servers are experiencing high traffic.原因:我们的服务器正在经历高流量。Solution: Please retry your requests after a brief wait. 解决方案:请在短暂等待后重试您的请求。</td> </tr> <tr> <td>500 - The server had an error while processing your request 500 -服务器在处理您的请求时出错</td> <td>Cause: Issue on our servers. 原因:我们的服务器上的问题。Solution: Retry your request after a brief wait and contact us if the issue persists. Check the status page. 解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。检查状态页面。</td> </tr> </tbody> </table> <h2> <a id="401__Invalid_Authentication_401__26"></a>401 - Invalid Authentication 401 -验证无效</h2> <p>This error message indicates that your authentication credentials are invalid. This could happen for several reasons, such as:<br> 此错误消息表示您的身份验证凭据无效。这可能有几个原因,例如:</p> <ul> <li>You are using a revoked API key.<br> 您正在使用已撤销的API密钥。</li> <li>You are using a different API key than the one assigned to the requesting organization.<br> 您使用的API密钥与分配给请求组织的API密钥不同。</li> <li>You are using an API key that does not have the required permissions for the endpoint you are calling.<br> 您正在使用的API密钥不具有所调用端点所需的权限。</li> </ul> <p>To resolve this error, please follow these steps:<br> 要解决此错误,请执行以下步骤:</p> <ul> <li>Check that you are using the correct API key and organization ID in your request header. You can find your API key and organization ID in your account settings.<br> 检查您是否在请求头中使用了正确的API密钥和组织ID。您可以在帐户设置中找到您的API密钥和组织ID。</li> <li>If you are unsure whether your API key is valid, you can generate a new one. Make sure to replace your old API key with the new one in your requests and follow our best practices guide.<br> 如果您不确定API密钥是否有效,可以生成一个新密钥。请确保在请求中使用新的API密钥替换旧的API密钥,并遵循我们的最佳实践指南。</li> </ul> <h2> <a id="401__Incorrect_API_key_provided_401_API_44"></a>401 - Incorrect API key provided 401 -提供的API密钥不正确</h2> <p>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:<br> 此错误消息表示您在请求中使用的API密钥不正确。这可能有几个原因,例如:</p> <ul> <li>There is a typo or an extra space in your API key.<br> 您的API密钥中有拼写错误或多余的空格。</li> <li>You are using an API key that belongs to a different organization.<br> 您正在使用属于其他组织的API密钥。</li> <li>You are using an API key that has been deleted or deactivated.<br> 您使用的API密钥已被删除或停用。</li> <li>An old, revoked API key might be cached locally.<br> 已吊销的旧API密钥可能会在本地缓存。</li> </ul> <p>To resolve this error, please follow these steps:<br> 要解决此错误,请执行以下步骤:</p> <ul> <li>Try clearing your browser’s cache and cookies, then try again.<br> 请尝试清除浏览器的缓存和Cookie,然后重试。</li> <li>Check that you are using the correct API key in your request header.<br> 检查您在请求头中使用的API密钥是否正确。</li> <li>If you are unsure whether your API key is valid, you can generate a new one. Make sure to replace your old API key with the new one in your requests and follow our best practices guide.<br> 如果您不确定API密钥是否有效,可以生成一个新密钥。请确保在请求中使用新的API密钥替换旧的API密钥,并遵循我们的最佳实践指南。</li> </ul> <h2> <a id="401__You_must_be_a_member_of_an_organization_to_use_the_API_401_API_67"></a>401 - You must be a member of an organization to use the API 401 -您必须是组织的成员才能使用API</h2> <p>This error message indicates that your account is not part of an organization. This could happen for several reasons, such as:<br> 此错误消息表示您的帐户不属于组织。这可能有几个原因,例如:</p> <ul> <li>You have left or been removed from your previous organization.<br> 您已离开或被从以前的组织中删除。</li> <li>Your organization has been deleted.<br> 您的组织已被删除。</li> </ul> <p>To resolve this error, please follow these steps:<br> 要解决此错误,请执行以下步骤:</p> <ul> <li>If you have left or been removed from your previous organization, you can either request a new organization or get invited to an existing one.<br> 如果您已经离开或被从以前的组织中删除,您可以申请新组织或被邀请加入现有组织。</li> <li>To request a new organization, reach out to us via help.openai.com<br> 要申请新组织,请通过www.example.com与我们联系help.openai.com</li> <li>Existing organization owners can invite you to join their organization via the Members Panel.<br> 现有的组织所有者可以通过成员面板邀请您加入他们的组织。</li> </ul> <h2> <a id="429__Rate_limit_reached_for_requests_429__85"></a>429 - Rate limit reached for requests 429 -请求已达到速率限制</h2> <p>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:<br> 此错误消息表示您已达到为API分配的速率限制。这意味着您在短时间内提交了太多令牌或请求,并且超过了允许的请求数量。这可能有几个原因,例如:</p> <ul> <li>You are using a loop or a script that makes frequent or concurrent requests.<br> 您正在使用一个循环或一个脚本,它会频繁地或并发地发出请求。</li> <li>You are sharing your API key with other users or applications.<br> 您正在与其他用户或应用程序共享您的API密钥。</li> <li>You are using a free plan that has a low rate limit.<br> 您使用的是速率限制较低的免费计划。</li> </ul> <p>To resolve this error, please follow these steps:<br> 要解决此错误,请执行以下步骤:</p> <ul> <li>Pace your requests and avoid making unnecessary or redundant calls.<br> 加快你的请求,避免打不必要或多余的电话。</li> <li>If you are using a loop or a script, make sure to implement a backoff mechanism or a retry logic that respects the rate limit and the response headers. You can read more about our rate limiting policy and best practices in our rate limit guide.<br> 如果您使用的是循环或脚本,请确保实现了一个退避机制或重试逻辑,以遵守速率限制和响应头。您可以在我们的速率限制指南中关于我们的速率限制政策和最佳实践的信息。</li> <li>If you are sharing your organization with other users, note that limits are applied per organization and not per user. It is worth checking on the usage of the rest of your team as this will contribute to the limit.<br> 如果您与其他用户共享您的组织,请注意限制是按组织而不是按用户应用的。值得检查团队其他成员的使用情况,因为这将有助于限制。</li> <li>If you are using a free or low-tier plan, consider upgrading to a pay-as-you-go plan that offers a higher rate limit. You can compare the restrictions of each plan in our rate limit guide.<br> 如果您使用的是免费或低层计划,请考虑升级到提供更高速率限制的现收现付计划。您可以在我们的速率限制指南中比较每个计划的限制。</li> </ul> <h2> <a id="429__You_exceeded_your_current_quota_please_check_your_plan_and_billing_details_429__107"></a>429 - You exceeded your current quota, please check your plan and billing details 429 -您已超出当前配额,请检查您的计划和账单详细信息</h2> <p>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:<br> 此错误消息表明您已达到API的每月最大支出。您可以在[帐户计费设置](/account/billing/limits)中的“硬限制”下查看您的每月最高限额。这意味着您已消耗了分配给计划的所有积分,并已达到当前计费周期的限额。这可能有几个原因,例如:</p> <ul> <li>You are using a high-volume or complex service that consumes a lot of credits or tokens.<br> 您正在使用消耗大量信用或标记的高容量或复杂服务。</li> <li>Your limit is set too low for your organization’s usage.<br> 您的限制设置得太低,不适合您的组织使用。</li> </ul> <p>To resolve this error, please follow these steps:<br> 要解决此错误,请执行以下步骤:</p> <ul> <li>Check your current quota in your account settings. You can see how many tokens your requests have consumed in the usage section of your account.<br> 在您的帐户设置中检查您的当前配额。您可以在帐户的使用情况部分查看您的请求已消耗了多少标记。</li> <li>If you are using a free plan, consider upgrading to a pay-as-you-go plan that offers a higher quota.<br> 如果您使用的是免费计划,请考虑升级到提供更高配额的现收现付计划。</li> <li>If you need a quota increase, you can apply for one and provide relevant details on expected usage. We will review your request and get back to you in ~7-10 business days.<br> 如果您需要增加配额,您可以申请并提供有关预期使用量的相关详细信息。我们将审核您的请求,并在7-10个工作日内回复您。</li> </ul> <h2> <a id="429__The_engine_is_currently_overloaded_please_try_again_later_429__125"></a>429 - The engine is currently overloaded, please try again later 429 -发动机当前过载,请稍后再试</h2> <p>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:<br> 此错误消息表示我们的服务器正在经历高流量,目前无法处理您的请求。这可能有几个原因,例如:</p> <ul> <li>There is a sudden spike or surge in demand for our services.<br> 对我们服务的需求突然激增。</li> <li>There is scheduled or unscheduled maintenance or update on our servers.<br> 我们的服务器有定期或不定期的维护或更新。</li> <li>There is an unexpected or unavoidable outage or incident on our servers.<br> 我们的服务器发生意外或不可避免的中断或事件。</li> </ul> <p>To resolve this error, please follow these steps:<br> 要解决此错误,请执行以下步骤:</p> <ul> <li>Retry your request after a brief wait. We recommend using an exponential backoff strategy or a retry logic that respects the response headers and the rate limit. You can read more about our rate limit best practices.<br> 请在短暂等待后重试您的请求。我们建议使用指数回退策略或重试逻辑,以遵守响应报头和速率限制。您可以关于我们的费率限制最佳实践。</li> <li>Check our status page for any updates or announcements regarding our services and servers.<br> 查看我们的状态页面,了解有关我们的服务和服务器的任何更新或公告。</li> <li>If you are still getting this error after a reasonable amount of time, please contact us for further assistance. We apologize for any inconvenience and appreciate your patience and understanding.<br> 如果您在一段合理的时间后仍然收到此错误,请与我们联系以获得进一步帮助。查询不到您需要的页面,给您造成的不便我们深表歉意!</li> </ul> <h1> <a id="Python_library_error_types_Python_145"></a>Python library error types Python库错误类型</h1> <table> <thead><tr> <th>TYPE 类型</th> <th>OVERVIEW 概览</th> </tr></thead> <tbody> <tr> <td>APIError API错误</td> <td>Cause: Issue on our side. 原因:我们这边的问题。Solution: Retry your request after a brief wait and contact us if the issue persists. 解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。</td> </tr> <tr> <td>Timeout 超时</td> <td>Cause: Request timed out. 原因:请求超时。Solution: Retry your request after a brief wait and contact us if the issue persists.解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。</td> </tr> <tr> <td>RateLimitError 速率限制错误</td> <td>Cause: You have hit your assigned rate limit.原因:您已达到指定的速率限制。Solution: Pace your requests. Read more in our Rate limit guide. 解决方案:加快你的请求。阅读我们的速率限制指南。</td> </tr> <tr> <td>APIConnectionError API连接错误</td> <td>Cause: Issue connecting to our services.原因:连接到我们的服务的问题。Solution: Check your network settings, proxy configuration, SSL certificates, or firewall rules. 解决方案:检查网络设置、代理配置、SSL证书或防火墙规则。</td> </tr> <tr> <td>InvalidRequestError 无效请求错误</td> <td>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方法的文档,并确保发送的参数有效且完整。您可能还需要检查请求数据的编码、格式或大小。</td> </tr> <tr> <td>AuthenticationError 验证错误</td> <td>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密钥或令牌,并确保其正确且处于活动状态。您可能需要从您的帐户仪表板生成一个新的。</td> </tr> <tr> <td>ServiceUnavailableError 服务不可用错误</td> <td>Cause: Issue on our servers. 原因:我们的服务器上的问题。Solution: Retry your request after a brief wait and contact us if the issue persists. Check the status page.解决方案:在短暂等待后重试您的请求,如果问题仍然存在,请与我们联系。检查状态页面。</td> </tr> </tbody> </table> <h2> <a id="APIError_API_157"></a>APIError API错误</h2> <p>An <code>APIError</code> 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.<br> “APIError”表示在处理您的请求时,我们这边出现了问题。这可能是由于临时错误、bug或系统中断。<br> 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.<br> 查询不到您需要的页面,给您造成的不便我们深表歉意!您可以查看我们的系统状态页面了解更多信息。</p> <p>If you encounter an <code>APIError</code>, please try the following steps:<br> 如果遇到 <code>APIError</code> ,请尝试以下步骤:</p> <ul> <li>Wait a few seconds and retry your request. Sometimes, the issue may be resolved quickly and your request may succeed on the second attempt.<br> 等待几秒钟,然后重试您的请求。有时,问题可能会很快得到解决,您的请求可能会在第二次尝试时成功。</li> <li>Check our status page for any ongoing incidents or maintenance that may affect our services. If there is an active incident, please follow the updates and wait until it is resolved before retrying your request.<br> 查看我们的状态页面,了解可能影响我们服务的任何正在进行的事件或维护。如果存在活动事件,请遵循更新并等待事件解决,然后重试请求。</li> <li>If the issue persists, check out our Persistent errors next steps section.<br> 如果问题仍然存在,请查看我们的持续错误后续步骤部分。</li> </ul> <p>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.<br> 我们的支持团队将调查此问题并尽快回复您。请注意,由于需求量大,我们的支持队列时间可能会很长。您也可以在我们的社区论坛发帖,但请务必省略任何敏感信息。</p> <h2> <a id="Timeout__176"></a>Timeout 超时</h2> <p>A <code>Timeout</code> 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.<br> “超时”错误表示您的请求花费了太长时间才完成,我们的服务器关闭了连接。这可能是由于网络问题,我们的服务负载过重,或者需要更多处理时间的复杂请求。<br> If you encounter a Timeout error, please try the following steps:<br> 如果遇到 Timeout 错误,请尝试以下步骤:</p> <ul> <li>Wait a few seconds and retry your request. Sometimes, the network congestion or the load on our services may be reduced and your request may succeed on the second attempt.<br> 等待几秒钟,然后重试您的请求。有时,网络拥塞或我们服务的负载可能会减少,您的请求可能会在第二次尝试时成功。</li> <li>Check your network settings and make sure you have a stable and fast internet connection. You may need to switch to a different network, use a wired connection, or reduce the number of devices or applications using your bandwidth.<br> 检查您的网络设置,并确保您有一个稳定和快速的互联网连接。您可能需要切换到其他网络、使用有线连接或减少使用您的带宽的设备或应用程序的数量。</li> <li>If the issue persists, check out our persistent errors next steps section.<br> 如果问题仍然存在,请查看我们的持续错误后续步骤部分。</li> </ul> <h2> <a id="RateLimitError__188"></a>RateLimitError 速率限制错误</h2> <p>A <code>RateLimitError</code> 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.<br> <code>RateLimitError</code>表示您已达到指定的速率限制。这意味着您在给定时间内发送了太多标记或请求,我们的服务暂时阻止您发送更多标记或请求。<br> We impose rate limits to ensure fair and efficient use of our resources and to prevent abuse or overload of our services.<br> 我们实施速率限制,以确保公平和有效地使用我们的资源,并防止滥用或超载我们的服务。</p> <p>If you encounter a RateLimitError, please try the following steps:<br> 如果遇到 <code>RateLimitError</code> ,请尝试以下步骤:</p> <ul> <li>Send fewer tokens or requests or slow down. You may need to reduce the frequency or volume of your requests, batch your tokens, or implement exponential backoff. You can read our Rate limit guide for more details.<br> 发送更少的标记或请求或减慢速度。您可能需要减少请求的频率或数量,批量处理标记或实现指数回退。您可以阅读我们的速率限制指南了解更多详情。</li> <li>Wait until your rate limit resets (one minute) and retry your request. The error message should give you a sense of your usage rate and permitted usage.<br> 等待您的速率限制重置(一分钟),然后重试您的请求。错误消息应该给予您了解您的使用率和允许的使用情况。</li> <li>You can also check your API usage statistics from your account dashboard.<br> 您还可以从帐户仪表板查看API使用统计信息。</li> </ul> <h2> <a id="APIConnectionError_API_203"></a>APIConnectionError API连接错误</h2> <p>An <code>APIConnectionError</code> 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.<br> “APIConnectionError”表示您的请求无法到达我们的服务器或建立安全连接。这可能是由于网络问题、代理配置、SSL证书或防火墙规则。<br> If you encounter an <code>APIConnectionError</code>, please try the following steps:<br> 如果遇到 <code>APIConnectionError</code> ,请尝试以下步骤:</p> <ul> <li>Check your network settings and make sure you have a stable and fast internet connection. You may need to switch to a different network, use a wired connection, or reduce the number of devices or applications using your bandwidth.<br> 检查您的网络设置,并确保您有一个稳定和快速的互联网连接。您可能需要切换到其他网络、使用有线连接或减少使用您的带宽的设备或应用程序的数量。</li> <li>Check your proxy configuration and make sure it is compatible with our services. You may need to update your proxy settings, use a different proxy, or bypass the proxy altogether.<br> 检查您的代理配置,并确保它与我们的服务兼容。您可能需要更新代理设置、使用其他代理或完全绕过代理。</li> <li>Check your SSL certificates and make sure they are valid and up-to-date. You may need to install or renew your certificates, use a different certificate authority, or disable SSL verification.<br> 检查您的SSL证书并确保它们是有效的和最新的。您可能需要安装或续订证书、使用其他证书颁发机构或禁用SSL验证。</li> <li>Check your firewall rules and make sure they are not blocking or filtering our services. You may need to modify your firewall settings.<br> 检查您的防火墙规则,确保它们没有阻止或过滤我们的服务。您可能需要修改防火墙设置。</li> <li>If appropriate, check that your container has the correct permissions to send and receive traffic.<br> 如果合适,请检查您的容器是否具有发送和接收流量的正确权限。</li> <li>If the issue persists, check out our persistent errors next steps section.<br> 如果问题仍然存在,请查看我们的持续错误后续步骤部分。</li> </ul> <h2> <a id="InvalidRequestError__222"></a>InvalidRequestError 无效请求错误</h2> <p>An <code>InvalidRequestError</code> 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.<br> <code>InvalidRequestError</code> 表示您的请求格式不正确或缺少某些必需的参数,例如标记或输入。这可能是由于代码中的打字错误、格式错误或逻辑错误。</p> <p>If you encounter an <code>InvalidRequestError</code>, please try the following steps:<br> 如果遇到 <code>InvalidRequestError</code> ,请尝试以下步骤:</p> <ul> <li>Read the error message carefully and identify the specific error made. The error message should advise you on what parameter was invalid or missing, and what value or format was expected.<br> 请仔细阅读错误消息并确定所犯的具体错误。错误消息应该告诉您哪个参数无效或丢失,以及需要什么值或格式。</li> <li>Check the API Reference for the specific API method you were calling and make sure you are sending valid and complete parameters. You may need to review the parameter names, types, values, and formats, and ensure they match the documentation.<br> 检查API参考以获取您调用的特定API方法,并确保您发送的参数有效且完整。您可能需要检查参数名称、类型、值和格式,并确保它们与文档匹配。</li> <li>Check the encoding, format, or size of your request data and make sure they are compatible with our services. You may need to encode your data in UTF-8, format your data in JSON, or compress your data if it is too large.<br> 检查您的请求数据的编码、格式或大小,并确保它们与我们的服务兼容。您可能需要使用UTF-8编码数据,使用JSON格式化数据,或者如果数据太大,则需要压缩数据。</li> <li>Test your request using a tool like Postman or curl and make sure it works as expected. You may need to debug your code and fix any errors or inconsistencies in your request logic.<br> 使用Postman或curl等工具测试您的请求,并确保其按预期运行。您可能需要调试代码并修复请求逻辑中的任何错误或不一致。</li> <li>If the issue persists, check out our persistent errors next steps section.<br> 如果问题仍然存在,请查看我们的持续错误后续步骤部分。</li> </ul> <h2> <a id="AuthenticationError__239"></a>AuthenticationError 验证错误</h2> <p>An <code>AuthenticationError</code> 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.<br> <code>AuthenticationError</code>表示您的API密钥或令牌无效、已过期或已撤销。这可能是由于打字错误、格式错误或安全漏洞造成的。<br> If you encounter an <code>AuthenticationError</code>, please try the following steps:<br> 如果遇到 <code>AuthenticationError</code> ,请尝试以下步骤:</p> <ul> <li>Check your API key or token and make sure it is correct and active. You may need to generate a new key from the API Key dashboard, ensure there are no extra spaces or characters, or use a different key or token if you have multiple ones.<br> 检查您的API密钥或令牌,并确保其正确且处于活动状态。您可能需要从API Key仪表板生成新密钥,确保没有额外的空格或字符,或者如果有多个密钥或令牌,则使用不同的密钥或令牌。</li> <li>Ensure that you have followed the correct formatting.<br> 确保您遵循了正确的格式。</li> </ul> <h2> <a id="ServiceUnavailableError__249"></a>ServiceUnavailableError 服务不可用错误</h2> <p>A <code>ServiceUnavailableError</code> 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.<br> “ServiceUnavailableError”表示我们的服务器暂时无法处理您的请求。这可能是由于计划内或计划外的维护、系统升级或服务器故障。这些错误也可能在高流量期间返回。<br> We apologize for any inconvenience and we are working hard to restore our services as soon as possible.<br> 查询不到您需要的页面,给您造成的不便我们深表歉意!</p> <p>If you encounter a <code>ServiceUnavailableError</code>, please try the following steps:<br> 如果遇到 <code>ServiceUnavailableError</code> ,请尝试以下步骤:</p> <ul> <li>Wait a few minutes and retry your request. Sometimes, the issue may be resolved quickly and your request may succeed on the next attempt.<br> 请等待几分钟,然后重试您的请求。有时,问题可能会很快得到解决,您的请求可能会在下次尝试时成功。</li> <li>Check our status page for any ongoing incidents or maintenance that may affect our services. If there is an active incident, please follow the updates and wait until it is resolved before retrying your request.<br> 查看我们的状态页面,了解可能影响我们服务的任何正在进行的事件或维护。如果存在活动事件,请遵循更新并等待事件解决,然后重试请求。</li> <li>If the issue persists, check out our persistent errors next steps section.<br> 如果问题仍然存在,请查看我们的持续错误后续步骤部分。</li> </ul> <h1> <a id="Persistent_errors__266"></a>Persistent errors 持续错误</h1> <p>If the issue persists, contact our support team via chat and provide them with the following information:<br> 如果问题仍然存在,请通过聊天联系我们的支持团队,并向他们提供以下信息:</p> <ul> <li>The model you were using 你用的模型</li> <li>The error message and code you received<br> 您收到的错误消息和代码</li> <li>The request data and headers you sent<br> 您发送的请求数据和标头</li> <li>The timestamp and timezone of your request<br> 请求的时间戳和时区</li> <li>Any other relevant details that may help us diagnose the issue<br> 可能有助于我们诊断问题的任何其他相关详细信息</li> </ul> <p>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.<br> 我们的支持团队将调查此问题并尽快回复您。请注意,由于需求量大,我们的支持队列时间可能会很长。您也可以在我们的社区论坛发帖,但请务必忽略任何敏感信息。</p> <h1> <a id="Handling_errors___python_283"></a>Handling errors 错误处理 (附python源码)</h1> <p>We advise you to programmatically handle errors returned by the API. To do so, you may want to use a code snippet like below:<br> 我们建议您以编程方式处理API返回的错误。要做到这一点,您可能需要使用如下代码段:</p> <pre><code class="prism language-python"><span class="token keyword">try</span><span class="token punctuation">:</span><span class="token comment">#Make your OpenAI API request here</span>response <span class="token operator">=</span> openai<span class="token punctuation">.</span>Completion<span class="token punctuation">.</span>create<span class="token punctuation">(</span>prompt<span class="token operator">=</span><span class="token string">"Hello world"</span><span class="token punctuation">,</span>model<span class="token operator">=</span><span class="token string">"text-davinci-003"</span><span class="token punctuation">)</span> <span class="token keyword">except</span> openai<span class="token punctuation">.</span>error<span class="token punctuation">.</span>APIError <span class="token keyword">as</span> e<span class="token punctuation">:</span><span class="token comment">#Handle API error here, e.g. retry or log</span><span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"OpenAI API returned an API Error: </span><span class="token interpolation"><span class="token punctuation">{<!-- --></span>e<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span><span class="token keyword">pass</span> <span class="token keyword">except</span> openai<span class="token punctuation">.</span>error<span class="token punctuation">.</span>APIConnectionError <span class="token keyword">as</span> e<span class="token punctuation">:</span><span class="token comment">#Handle connection error here</span><span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"Failed to connect to OpenAI API: </span><span class="token interpolation"><span class="token punctuation">{<!-- --></span>e<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span><span class="token keyword">pass</span> <span class="token keyword">except</span> openai<span class="token punctuation">.</span>error<span class="token punctuation">.</span>RateLimitError <span class="token keyword">as</span> e<span class="token punctuation">:</span><span class="token comment">#Handle rate limit error (we recommend using exponential backoff)</span><span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"OpenAI API request exceeded rate limit: </span><span class="token interpolation"><span class="token punctuation">{<!-- --></span>e<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span><span class="token keyword">pass</span> </code></pre> <h1> <a id="_306"></a>其它资料下载</h1> <p>如果大家想继续了解人工智能相关学习路线和知识体系,欢迎大家翻阅我的另外一篇博客《重磅 | 完备的人工智能AI 学习——基础知识学习路线,所有资料免关注免套路直接网盘下载》<br> 这篇博客参考了Github知名开源平台,AI技术平台以及相关领域专家:Datawhale,ApacheCN,AI有道和黄海广博士等约有近100G相关资料,希望能帮助到所有小伙伴们。</p> </div> <link href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/markdown_views-98b95bb57c.css" rel="stylesheet"> <link href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/style-c216769e99.css" rel="stylesheet"> </div> <div id="treeSkill"></div> </article>
OpenAI-ChatGPT最新官方接口《错误代码大全》全网最详细中英文实用指南和教程,助你零基础快速轻松掌握全新技术(九)(附源码)
作者
sockstack
许可协议
CC BY 4.0
发布于
2023-11-07
修改于
2024-12-22
上一篇:软件:常用 Linux 软件汇总,值得收藏
下一篇:ChatGPT 高阶使用手册
尚未登录
登录 / 注册
文章分类
博客重构之路
5
Spring Boot简单入门
4
k8s 入门教程
0
MySQL 知识
1
NSQ 消息队列
0
ThinkPHP5 源码分析
5
使用 Docker 从零开始搭建私人代码仓库
3
日常开发汇总
4
标签列表
springboot
hyperf
swoole
webman
php
多线程
数据结构
docker
k8s
thinkphp
mysql
tailwindcss
flowbite
css
前端