ChatGPT request returning undefined

With this code, my label just returns “undefined”. I don’t even think it’s going to OpenAI. I’ve also defined the API code in the Service. Here’s my code:

Hi @bschwartz25ev, welcome to Thunkable! :tada:

Be sure to check out our posts about How to ask Great Questions v2.0 and our Community Guidelines as you get started.

The real reason for this error likely lives in your console. You’ll probably see a 4-- error from https://api.openai.com/v1/chat/completions. Let us know what you see. You can find info on how to access your browser’s console here.

Hello. Thanks! My error was {
“error”: {
“message”: “You didn’t provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you’re accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}
I entered the key, though. On my end, it says "main.16d4bd70.js:1

   POST https://api.openai.com/v1/chat/completions 429 (Too Many Requests)", but I haven't sent a request in hours.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.