Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build a Basic ChatGPT Clone with Vanilla JavaScript

Kira Banks
seal-mask
.a{fill-rule:evenodd;}techdegree
Kira Banks
Front End Web Development Techdegree Student 9,058 Points

My AI won't answer. Error 429 in the Console

I am getting an error in the console when I try asking my AI chat a question. I don't believe I overloaded it with requests or anything because it gave me this error from the start:

index.js:44 POST https://api.openai.com/v1/chat/completions 429

index.js:72 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0')

at updateMessage (index.js:72:36)

at index.js:62:19

I can't seem to find anything different in my code from the video, so I'm not sure what the issue is. If anyone could help it would be greatly appreciated!

2 Answers

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hi Kira Banks 👋

The 429 status code indicates that you're being rate limited. When on a free plan for the OpenAI API you're limited to make 3 requests per minute. If you make more than 3 request per minute you'll experience this error. After waiting for a minute you should be getting the responses back again as expected 🙂

Kira Banks
seal-mask
.a{fill-rule:evenodd;}techdegree
Kira Banks
Front End Web Development Techdegree Student 9,058 Points

I see, I haven't been able to get it to respond at all though. I'm not sure why I'm getting the 429 error with just one request. Is there anything else I should check? I also tried creating and connecting a new api key, but no luck. :(

I have the same issue, I can't get any response back Kira Banks Rohald van Merode And I have waited several minutes