前言
在 ChatGPT 中,由于各種原因(如網(wǎng)絡(luò)連接不穩(wěn)定、并發(fā)超限、服務(wù)器故障等),可能會(huì)發(fā)生一些錯(cuò)誤。ChatGPT 會(huì)根據(jù)錯(cuò)誤類型返回相應(yīng)的錯(cuò)誤代碼,以便開發(fā)人員進(jìn)行問題排查和解決。作為二次開發(fā)ChatGPT的開發(fā)人員,也應(yīng)該時(shí)刻關(guān)注和處理系統(tǒng)中出現(xiàn)的錯(cuò)誤,以提高用戶的體驗(yàn)和滿意度。
Introduction 導(dǎo)言
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庫中看到的錯(cuò)誤代碼的概述。概述中提到的每個(gè)錯(cuò)誤代碼都有一個(gè)專門的部分提供進(jìn)一步的指導(dǎo)。
API errors API 錯(cuò)誤
CODE錯(cuò)誤碼 | OVERVIEW 概覽 |
---|---|
401 - Invalid Authentication 401 -驗(yàn)證無效 | Cause: Invalid Authentication 原因:無效身份驗(yàn)證 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密鑰正確,清除瀏覽器緩存,或生成一個(gè)新的。 |
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. 解決方案:聯(lián)系我們以添加到新組織,或要求您的組織經(jīng)理邀請您加入組織。 |
429 - Rate limit reached for requests 429 -請求已達(dá)到速率限制 | Cause: You are sending requests too quickly. 原因:您發(fā)送請求的速度太快 Solution: Pace your requests. Read the Rate limit guide.解決方案:加快你的請求。閱讀速率限制指南。 |
429 - You exceeded your current quota, please check your plan and billing details 429 -您已超出當(dāng)前配額,請檢查您的計(jì)劃和賬單詳細(xì)信息 | Cause: You have hit your maximum monthly spend (hard limit) which you can view in the account billing section.原因:您已達(dá)到您的最大每月支出(硬限制),您可以在帳戶結(jié)算部分查看。 Solution: Apply for a quota increase. 解決辦法:申請?jiān)黾优漕~。 |
429 - The engine is currently overloaded, please try again later 429 -服務(wù)器當(dāng)前過載,請稍后再試 | Cause: Our servers are experiencing high traffic.原因:我們的服務(wù)器正在經(jīng)歷高流量。Solution: Please retry your requests after a brief wait. 解決方案:請?jiān)诙虝旱却笾卦嚹恼埱蟆?/td> |
500 - The server had an error while processing your request 500 -服務(wù)器在處理您的請求時(shí)出錯(cuò) | Cause: Issue on our servers. 原因:我們的服務(wù)器上的問題。Solution: Retry your request after a brief wait and contact us if the issue persists. Check the status page. 解決方案:在短暫等待后重試您的請求,如果問題仍然存在,請與我們聯(lián)系。檢查狀態(tài)頁面。 |
401 - Invalid Authentication 401 -驗(yàn)證無效
This error message indicates that your authentication credentials are invalid. This could happen for several reasons, such as:
此錯(cuò)誤消息表示您的身份驗(yàn)證憑據(jù)無效。這可能有幾個(gè)原因,例如:
- You are using a revoked API key.
您正在使用已撤銷的API密鑰。 - You are using a different API key than the one assigned to the requesting organization.
您使用的API密鑰與分配給請求組織的API密鑰不同。 - You are using an API key that does not have the required permissions for the endpoint you are calling.
您正在使用的API密鑰不具有所調(diào)用端點(diǎn)所需的權(quán)限。
To resolve this error, please follow these steps:
要解決此錯(cuò)誤,請執(zhí)行以下步驟:
- 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.
檢查您是否在請求頭中使用了正確的API密鑰和組織ID。您可以在帳戶設(shè)置中找到您的API密鑰和組織ID。 - 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.
如果您不確定API密鑰是否有效,可以生成一個(gè)新密鑰。請確保在請求中使用新的API密鑰替換舊的API密鑰,并遵循我們的最佳實(shí)踐指南。
401 - Incorrect API key provided 401 -提供的API密鑰不正確
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:
此錯(cuò)誤消息表示您在請求中使用的API密鑰不正確。這可能有幾個(gè)原因,例如:
- There is a typo or an extra space in your API key.
您的API密鑰中有拼寫錯(cuò)誤或多余的空格。 - You are using an API key that belongs to a different organization.
您正在使用屬于其他組織的API密鑰。 - You are using an API key that has been deleted or deactivated.
您使用的API密鑰已被刪除或停用。 - An old, revoked API key might be cached locally.
已吊銷的舊API密鑰可能會(huì)在本地緩存。
To resolve this error, please follow these steps:
要解決此錯(cuò)誤,請執(zhí)行以下步驟:
- Try clearing your browser’s cache and cookies, then try again.
請嘗試清除瀏覽器的緩存和Cookie,然后重試。 - Check that you are using the correct API key in your request header.
檢查您在請求頭中使用的API密鑰是否正確。 - 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.
如果您不確定API密鑰是否有效,可以生成一個(gè)新密鑰。請確保在請求中使用新的API密鑰替換舊的API密鑰,并遵循我們的最佳實(shí)踐指南。
401 - You must be a member of an organization to use the API 401 -您必須是組織的成員才能使用API
This error message indicates that your account is not part of an organization. This could happen for several reasons, such as:
此錯(cuò)誤消息表示您的帳戶不屬于組織。這可能有幾個(gè)原因,例如:
- You have left or been removed from your previous organization.
您已離開或被從以前的組織中刪除。 - Your organization has been deleted.
您的組織已被刪除。
To resolve this error, please follow these steps:
要解決此錯(cuò)誤,請執(zhí)行以下步驟:
- 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.
如果您已經(jīng)離開或被從以前的組織中刪除,您可以申請新組織或被邀請加入現(xiàn)有組織。 - To request a new organization, reach out to us via help.openai.com
要申請新組織,請通過www.example.com與我們聯(lián)系help.openai.com - Existing organization owners can invite you to join their organization via the Members Panel.
現(xiàn)有的組織所有者可以通過成員面板邀請您加入他們的組織。
429 - Rate limit reached for requests 429 -請求已達(dá)到速率限制
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:
此錯(cuò)誤消息表示您已達(dá)到為API分配的速率限制。這意味著您在短時(shí)間內(nèi)提交了太多令牌或請求,并且超過了允許的請求數(shù)量。這可能有幾個(gè)原因,例如:
- You are using a loop or a script that makes frequent or concurrent requests.
您正在使用一個(gè)循環(huán)或一個(gè)腳本,它會(huì)頻繁地或并發(fā)地發(fā)出請求。 - You are sharing your API key with other users or applications.
您正在與其他用戶或應(yīng)用程序共享您的API密鑰。 - You are using a free plan that has a low rate limit.
您使用的是速率限制較低的免費(fèi)計(jì)劃。
To resolve this error, please follow these steps:
要解決此錯(cuò)誤,請執(zhí)行以下步驟:
- Pace your requests and avoid making unnecessary or redundant calls.
加快你的請求,避免打不必要或多余的電話。 - 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.
如果您使用的是循環(huán)或腳本,請確保實(shí)現(xiàn)了一個(gè)退避機(jī)制或重試邏輯,以遵守速率限制和響應(yīng)頭。您可以在我們的速率限制指南中閱讀更多關(guān)于我們的速率限制政策和最佳實(shí)踐的信息。 - 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.
如果您與其他用戶共享您的組織,請注意限制是按組織而不是按用戶應(yīng)用的。值得檢查團(tuán)隊(duì)其他成員的使用情況,因?yàn)檫@將有助于限制。 - 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.
如果您使用的是免費(fèi)或低層計(jì)劃,請考慮升級(jí)到提供更高速率限制的現(xiàn)收現(xiàn)付計(jì)劃。您可以在我們的速率限制指南中比較每個(gè)計(jì)劃的限制。
429 - You exceeded your current quota, please check your plan and billing details 429 -您已超出當(dāng)前配額,請檢查您的計(jì)劃和賬單詳細(xì)信息
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:
此錯(cuò)誤消息表明您已達(dá)到API的每月最大支出。您可以在[帳戶計(jì)費(fèi)設(shè)置](/account/billing/limits)中的“硬限制”下查看您的每月最高限額。這意味著您已消耗了分配給計(jì)劃的所有積分,并已達(dá)到當(dāng)前計(jì)費(fèi)周期的限額。這可能有幾個(gè)原因,例如:
- You are using a high-volume or complex service that consumes a lot of credits or tokens.
您正在使用消耗大量信用或標(biāo)記的高容量或復(fù)雜服務(wù)。 - Your limit is set too low for your organization’s usage.
您的限制設(shè)置得太低,不適合您的組織使用。
To resolve this error, please follow these steps:
要解決此錯(cuò)誤,請執(zhí)行以下步驟:
- 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.
在您的帳戶設(shè)置中檢查您的當(dāng)前配額。您可以在帳戶的使用情況部分查看您的請求已消耗了多少標(biāo)記。 - If you are using a free plan, consider upgrading to a pay-as-you-go plan that offers a higher quota.
如果您使用的是免費(fèi)計(jì)劃,請考慮升級(jí)到提供更高配額的現(xiàn)收現(xiàn)付計(jì)劃。 - 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.
如果您需要增加配額,您可以申請并提供有關(guān)預(yù)期使用量的相關(guān)詳細(xì)信息。我們將審核您的請求,并在7-10個(gè)工作日內(nèi)回復(fù)您。
429 - The engine is currently overloaded, please try again later 429 -發(fā)動(dòng)機(jī)當(dāng)前過載,請稍后再試
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:
此錯(cuò)誤消息表示我們的服務(wù)器正在經(jīng)歷高流量,目前無法處理您的請求。這可能有幾個(gè)原因,例如:
- There is a sudden spike or surge in demand for our services.
對(duì)我們服務(wù)的需求突然激增。 - There is scheduled or unscheduled maintenance or update on our servers.
我們的服務(wù)器有定期或不定期的維護(hù)或更新。 - There is an unexpected or unavoidable outage or incident on our servers.
我們的服務(wù)器發(fā)生意外或不可避免的中斷或事件。
To resolve this error, please follow these steps:
要解決此錯(cuò)誤,請執(zhí)行以下步驟:
- 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.
請?jiān)诙虝旱却笾卦嚹恼埱?。我們建議使用指數(shù)回退策略或重試邏輯,以遵守響應(yīng)報(bào)頭和速率限制。您可以閱讀更多關(guān)于我們的費(fèi)率限制最佳實(shí)踐。 - Check our status page for any updates or announcements regarding our services and servers.
查看我們的狀態(tài)頁面,了解有關(guān)我們的服務(wù)和服務(wù)器的任何更新或公告。 - 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.
如果您在一段合理的時(shí)間后仍然收到此錯(cuò)誤,請與我們聯(lián)系以獲得進(jìn)一步幫助。查詢不到您需要的頁面,給您造成的不便我們深表歉意!
Python library error types Python庫錯(cuò)誤類型
TYPE 類型 | OVERVIEW 概覽 |
---|---|
APIError API錯(cuò)誤 | Cause: Issue on our side. 原因:我們這邊的問題。Solution: Retry your request after a brief wait and contact us if the issue persists. 解決方案:在短暫等待后重試您的請求,如果問題仍然存在,請與我們聯(lián)系。 |
Timeout 超時(shí) | Cause: Request timed out. 原因:請求超時(shí)。Solution: Retry your request after a brief wait and contact us if the issue persists.解決方案:在短暫等待后重試您的請求,如果問題仍然存在,請與我們聯(lián)系。 |
RateLimitError 速率限制錯(cuò)誤 | Cause: You have hit your assigned rate limit.原因:您已達(dá)到指定的速率限制。Solution: Pace your requests. Read more in our Rate limit guide. 解決方案:加快你的請求。閱讀我們的速率限制指南。 |
APIConnectionError API連接錯(cuò)誤 | Cause: Issue connecting to our services.原因:連接到我們的服務(wù)的問題。Solution: Check your network settings, proxy configuration, SSL certificates, or firewall rules. 解決方案:檢查網(wǎng)絡(luò)設(shè)置、代理配置、SSL證書或防火墻規(guī)則。 |
InvalidRequestError 無效請求錯(cuò)誤 | Cause: Your request was malformed or missing some required parameters, such as a token or an input. 原因:您的請求格式不正確或缺少某些必需的參數(shù),如標(biāo)記或輸入。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.解決方案:錯(cuò)誤消息應(yīng)告知您所犯的具體錯(cuò)誤。檢查您正在調(diào)用的特定API方法的文檔,并確保發(fā)送的參數(shù)有效且完整。您可能還需要檢查請求數(shù)據(jù)的編碼、格式或大小。 |
AuthenticationError 驗(yàn)證錯(cuò)誤 | 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密鑰或令牌,并確保其正確且處于活動(dòng)狀態(tài)。您可能需要從您的帳戶儀表板生成一個(gè)新的。 |
ServiceUnavailableError 服務(wù)不可用錯(cuò)誤 | Cause: Issue on our servers. 原因:我們的服務(wù)器上的問題。Solution: Retry your request after a brief wait and contact us if the issue persists. Check the status page.解決方案:在短暫等待后重試您的請求,如果問題仍然存在,請與我們聯(lián)系。檢查狀態(tài)頁面。 |
APIError API錯(cuò)誤
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”表示在處理您的請求時(shí),我們這邊出現(xiàn)了問題。這可能是由于臨時(shí)錯(cuò)誤、bug或系統(tǒng)中斷。
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.
查詢不到您需要的頁面,給您造成的不便我們深表歉意!您可以查看我們的系統(tǒng)狀態(tài)頁面了解更多信息。
If you encounter an APIError
, please try the following steps:
如果遇到 APIError
,請嘗試以下步驟:
- Wait a few seconds and retry your request. Sometimes, the issue may be resolved quickly and your request may succeed on the second attempt.
等待幾秒鐘,然后重試您的請求。有時(shí),問題可能會(huì)很快得到解決,您的請求可能會(huì)在第二次嘗試時(shí)成功。 - 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.
查看我們的狀態(tài)頁面,了解可能影響我們服務(wù)的任何正在進(jìn)行的事件或維護(hù)。如果存在活動(dòng)事件,請遵循更新并等待事件解決,然后重試請求。 - If the issue persists, check out our Persistent errors next steps section.
如果問題仍然存在,請查看我們的持續(xù)錯(cuò)誤后續(xù)步驟部分。
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.
我們的支持團(tuán)隊(duì)將調(diào)查此問題并盡快回復(fù)您。請注意,由于需求量大,我們的支持隊(duì)列時(shí)間可能會(huì)很長。您也可以在我們的社區(qū)論壇發(fā)帖,但請務(wù)必省略任何敏感信息。
Timeout 超時(shí)
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.
“超時(shí)”錯(cuò)誤表示您的請求花費(fèi)了太長時(shí)間才完成,我們的服務(wù)器關(guān)閉了連接。這可能是由于網(wǎng)絡(luò)問題,我們的服務(wù)負(fù)載過重,或者需要更多處理時(shí)間的復(fù)雜請求。
If you encounter a Timeout error, please try the following steps:
如果遇到 Timeout 錯(cuò)誤,請嘗試以下步驟:
- 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.
等待幾秒鐘,然后重試您的請求。有時(shí),網(wǎng)絡(luò)擁塞或我們服務(wù)的負(fù)載可能會(huì)減少,您的請求可能會(huì)在第二次嘗試時(shí)成功。 - 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.
檢查您的網(wǎng)絡(luò)設(shè)置,并確保您有一個(gè)穩(wěn)定和快速的互聯(lián)網(wǎng)連接。您可能需要切換到其他網(wǎng)絡(luò)、使用有線連接或減少使用您的帶寬的設(shè)備或應(yīng)用程序的數(shù)量。 - If the issue persists, check out our persistent errors next steps section.
如果問題仍然存在,請查看我們的持續(xù)錯(cuò)誤后續(xù)步驟部分。
RateLimitError 速率限制錯(cuò)誤
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
表示您已達(dá)到指定的速率限制。這意味著您在給定時(shí)間內(nèi)發(fā)送了太多標(biāo)記或請求,我們的服務(wù)暫時(shí)阻止您發(fā)送更多標(biāo)記或請求。
We impose rate limits to ensure fair and efficient use of our resources and to prevent abuse or overload of our services.
我們實(shí)施速率限制,以確保公平和有效地使用我們的資源,并防止濫用或超載我們的服務(wù)。
If you encounter a RateLimitError, please try the following steps:
如果遇到 RateLimitError
,請嘗試以下步驟:
- 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.
發(fā)送更少的標(biāo)記或請求或減慢速度。您可能需要減少請求的頻率或數(shù)量,批量處理標(biāo)記或?qū)崿F(xiàn)指數(shù)回退。您可以閱讀我們的速率限制指南了解更多詳情。 - 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.
等待您的速率限制重置(一分鐘),然后重試您的請求。錯(cuò)誤消息應(yīng)該給予您了解您的使用率和允許的使用情況。 - You can also check your API usage statistics from your account dashboard.
您還可以從帳戶儀表板查看API使用統(tǒng)計(jì)信息。
APIConnectionError API連接錯(cuò)誤
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”表示您的請求無法到達(dá)我們的服務(wù)器或建立安全連接。這可能是由于網(wǎng)絡(luò)問題、代理配置、SSL證書或防火墻規(guī)則。
If you encounter an APIConnectionError
, please try the following steps:
如果遇到 APIConnectionError
,請嘗試以下步驟:
- 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.
檢查您的網(wǎng)絡(luò)設(shè)置,并確保您有一個(gè)穩(wěn)定和快速的互聯(lián)網(wǎng)連接。您可能需要切換到其他網(wǎng)絡(luò)、使用有線連接或減少使用您的帶寬的設(shè)備或應(yīng)用程序的數(shù)量。 - 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.
檢查您的代理配置,并確保它與我們的服務(wù)兼容。您可能需要更新代理設(shè)置、使用其他代理或完全繞過代理。 - 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.
檢查您的SSL證書并確保它們是有效的和最新的。您可能需要安裝或續(xù)訂證書、使用其他證書頒發(fā)機(jī)構(gòu)或禁用SSL驗(yàn)證。 - Check your firewall rules and make sure they are not blocking or filtering our services. You may need to modify your firewall settings.
檢查您的防火墻規(guī)則,確保它們沒有阻止或過濾我們的服務(wù)。您可能需要修改防火墻設(shè)置。 - If appropriate, check that your container has the correct permissions to send and receive traffic.
如果合適,請檢查您的容器是否具有發(fā)送和接收流量的正確權(quán)限。 - If the issue persists, check out our persistent errors next steps section.
如果問題仍然存在,請查看我們的持續(xù)錯(cuò)誤后續(xù)步驟部分。
InvalidRequestError 無效請求錯(cuò)誤
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
表示您的請求格式不正確或缺少某些必需的參數(shù),例如標(biāo)記或輸入。這可能是由于代碼中的打字錯(cuò)誤、格式錯(cuò)誤或邏輯錯(cuò)誤。
If you encounter an InvalidRequestError
, please try the following steps:
如果遇到 InvalidRequestError
,請嘗試以下步驟:
- 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.
請仔細(xì)閱讀錯(cuò)誤消息并確定所犯的具體錯(cuò)誤。錯(cuò)誤消息應(yīng)該告訴您哪個(gè)參數(shù)無效或丟失,以及需要什么值或格式。 - 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.
檢查API參考以獲取您調(diào)用的特定API方法,并確保您發(fā)送的參數(shù)有效且完整。您可能需要檢查參數(shù)名稱、類型、值和格式,并確保它們與文檔匹配。 - 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.
檢查您的請求數(shù)據(jù)的編碼、格式或大小,并確保它們與我們的服務(wù)兼容。您可能需要使用UTF-8編碼數(shù)據(jù),使用JSON格式化數(shù)據(jù),或者如果數(shù)據(jù)太大,則需要壓縮數(shù)據(jù)。 - 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.
使用Postman或curl等工具測試您的請求,并確保其按預(yù)期運(yùn)行。您可能需要調(diào)試代碼并修復(fù)請求邏輯中的任何錯(cuò)誤或不一致。 - If the issue persists, check out our persistent errors next steps section.
如果問題仍然存在,請查看我們的持續(xù)錯(cuò)誤后續(xù)步驟部分。
AuthenticationError 驗(yàn)證錯(cuò)誤
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密鑰或令牌無效、已過期或已撤銷。這可能是由于打字錯(cuò)誤、格式錯(cuò)誤或安全漏洞造成的。
If you encounter an AuthenticationError
, please try the following steps:
如果遇到 AuthenticationError
,請嘗試以下步驟:
- 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.
檢查您的API密鑰或令牌,并確保其正確且處于活動(dòng)狀態(tài)。您可能需要從API Key儀表板生成新密鑰,確保沒有額外的空格或字符,或者如果有多個(gè)密鑰或令牌,則使用不同的密鑰或令牌。 - Ensure that you have followed the correct formatting.
確保您遵循了正確的格式。
ServiceUnavailableError 服務(wù)不可用錯(cuò)誤
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”表示我們的服務(wù)器暫時(shí)無法處理您的請求。這可能是由于計(jì)劃內(nèi)或計(jì)劃外的維護(hù)、系統(tǒng)升級(jí)或服務(wù)器故障。這些錯(cuò)誤也可能在高流量期間返回。
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
,請嘗試以下步驟:
- Wait a few minutes and retry your request. Sometimes, the issue may be resolved quickly and your request may succeed on the next attempt.
請等待幾分鐘,然后重試您的請求。有時(shí),問題可能會(huì)很快得到解決,您的請求可能會(huì)在下次嘗試時(shí)成功。 - 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.
查看我們的狀態(tài)頁面,了解可能影響我們服務(wù)的任何正在進(jìn)行的事件或維護(hù)。如果存在活動(dòng)事件,請遵循更新并等待事件解決,然后重試請求。 - If the issue persists, check out our persistent errors next steps section.
如果問題仍然存在,請查看我們的持續(xù)錯(cuò)誤后續(xù)步驟部分。
Persistent errors 持續(xù)錯(cuò)誤
If the issue persists, contact our support team via chat and provide them with the following information:
如果問題仍然存在,請通過聊天聯(lián)系我們的支持團(tuán)隊(duì),并向他們提供以下信息:
- The model you were using 你用的模型
- The error message and code you received
您收到的錯(cuò)誤消息和代碼 - The request data and headers you sent
您發(fā)送的請求數(shù)據(jù)和標(biāo)頭 - The timestamp and timezone of your request
請求的時(shí)間戳和時(shí)區(qū) - Any other relevant details that may help us diagnose the issue
可能有助于我們診斷問題的任何其他相關(guān)詳細(xì)信息
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.
我們的支持團(tuán)隊(duì)將調(diào)查此問題并盡快回復(fù)您。請注意,由于需求量大,我們的支持隊(duì)列時(shí)間可能會(huì)很長。您也可以在我們的社區(qū)論壇發(fā)帖,但請務(wù)必忽略任何敏感信息。
Handling errors 錯(cuò)誤處理 (附python源碼)
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返回的錯(cuò)誤。要做到這一點(diǎn),您可能需要使用如下代碼段:文章來源:http://www.zghlxwxcb.cn/news/detail-431847.html
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
其它資料下載
如果大家想繼續(xù)了解人工智能相關(guān)學(xué)習(xí)路線和知識(shí)體系,歡迎大家翻閱我的另外一篇博客《重磅 | 完備的人工智能AI 學(xué)習(xí)——基礎(chǔ)知識(shí)學(xué)習(xí)路線,所有資料免關(guān)注免套路直接網(wǎng)盤下載》
這篇博客參考了Github知名開源平臺(tái),AI技術(shù)平臺(tái)以及相關(guān)領(lǐng)域?qū)<遥篋atawhale,ApacheCN,AI有道和黃海廣博士等約有近100G相關(guān)資料,希望能幫助到所有小伙伴們。文章來源地址http://www.zghlxwxcb.cn/news/detail-431847.html
到了這里,關(guān)于OpenAI-ChatGPT最新官方接口《錯(cuò)誤代碼大全》全網(wǎng)最詳細(xì)中英文實(shí)用指南和教程,助你零基礎(chǔ)快速輕松掌握全新技術(shù)(九)(附源碼)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!