agentic
agentic copied to clipboard
Running into 429 errors on 4.2.0 as well as 4.1.0
Verify latest release
- [X] I verified that the issue exists in the latest
chatgptrelease
Verify webapp is working
- [X] I verify that the ChatGPT webapp is working properly for this account.
Environment details
v4.2.0 as well as v4.1.0
Describe the Bug
Running into following very frequently.
"error": {
"message": "The server had an error while processing your request. Sorry about that!",
"type": "server_error",
"param": null,
"code": null
}
}
//
ChatGPTError: ChatGPT error 429: {
"error": {
"message": "The server had an error while processing your request. Sorry about that!",
"type": "server_error",
"param": null,
"code": null
}
}
at file:///Users/karamkhanna/Documents/dev/dev-projects/StudyBuddy/node_modules/chatgpt/build/index.js:202:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
statusCode: 429,
statusText: 'Too Many Requests',
[cause]: Response {
[Symbol(realm)]: null,
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: true,
requestIncludesCredentials: true,
type: 'default',
status: 429,
timingInfo: [Object],
cacheState: '',
statusText: 'Too Many Requests',
headersList: [HeadersList],
urlList: [Array],
body: [Object]
},
[Symbol(headers)]: HeadersList {
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
}
}
}
I'm pretty confused by this since this should just be calling text-davinci, and I have a paid account set up so not sure why I'd be rate limited.
I also encountered the same problem
I know that paid accounts only have a limit of about 2x.
I also encountered the same problem
I also encountered the same problem
It came about by accident
For me, I use a little retry mechanism because of this intermittent behavior:
export async function tryTimes(promiseFn, maxTries=10) {
try {
return await promiseFn();
} catch (e) {
if (maxTries > 0) {
console.log("Failed, retry "+maxTries)
return tryTimes(promiseFn, maxTries - 1);
}
throw e;
}
}
and then call as follows:
let res = await tryTimes(async () => await api.sendMessage(question));
@SimonBaars Thanks. For the time being will add something like that
Frequently also now getting:
Error message: TypeError: fetch failed"
This package is now using the official OpenAI API under the hood. I've seen occasional 429 errors as well which is either an OpenAI rate limit or problems on their end that we can't do anything about. I recommend that you write your app logic with this in mind.
https://github.com/sindresorhus/p-retry is also very useful
I now have a ChatGPT Plus account but it doesn't solve this kind of problem. I guess ChatGPT Plus doesn't give more possibilities for the OpenAI API.
I've tried getting this work using the API key I setup under the account. I have ChatGPT Plus, however, I don't think that has an impact on the API Key itself.
I even tried @SimonBaars nice retry suggestion and put it to 50 tries and they all fail with 429.
Do I need to add billing to the account for the API, or should it just work?
@adam91holt the official OpenAI API has rate limits: https://platform.openai.com/docs/guides/rate-limits/overview
This is the official OpenAI API, so any consistent 429 errors you may be hitting are very likely because you're trying to use the API too aggressively.
If you're hitting 429 errors consistently, make sure you're adding some delay between your requests. Don't just retry 50 times in a row – that will make the problem worse and OpenAI may block your account. Use a smart retry method with exponential backoff like https://github.com/sindresorhus/p-retry
Your rate limits will go up quite a bit by adding payment to your account (though they'll still be limited by OpenAI for the first 48 hours to prevent abuse). See their official rate limits for more details.
Also note that I just added a new approach in v4.5.0 ChatGPTUnofficialProxyAPI which is free, though it is still rate limited.