Cannot get ChatGPT API working with Arduino Giga R1 WiFi

I’m having trouble sending a web request to the ChatGPT API with my Arduino board – the main issue is that documentation for Arduino HTTPS is scarce.
I keep getting error 400 (Malformed request)
Here’s the code:

Also, I have tried the same web request with the same API key with a shell command and it actually works

1 Like

Welcome to the community!

I chucked my R1 in the trash because the documentation is so terrible…
not really but sometimes I want to lol

I haven’t tried this, but I think it’s a lot easier with the httpclient.h if it works on the R1.

I’m not sure what the issue is here, specifically, but don’t you need two linefeeds at the end of the request? :thinking:

two linefeeds? like \r\n\r\n after the payload?

Nevermind, no, I looked for it but I’m probably mistaken. Dunno, sorry :confused:

But it’s more likely than not probably better solved by the arduino community (https://forum.arduino.cc/) than here :confused:

Good luck with your R1!

I’ve asked in over 5 places and still haven’t fixed the issue

1 Like

Yeah it’s tough. I don’t want to offer any more half baked advice because I can’t test it atm, but other than trying to debug it with the help of chatgpt or maybe switching to micropython for IoT, the only thing I can offer you is thoughts and prayers :grimacing: