Problem with APIs

Hi, I'm Michael and I'm 14 y/o and trying to make a medication app. Whenever I use APIs, I always get a 401 code and a not found output. For example, when I tried to make use of Chat GPT through grabbing output from JSON and the web extension, I kept getting not found, but when I did it through the in built chat bot function with the same api key it worked fine. I'm trying to grab an image from a search term using an api, and when I use the url in my browser, it works. However, when I put the same exact url into web1 and make a request, it keeps saying that I have an invalid api key. I would really appreciate it if I could get some help on this.
My code:

Working in browser: