Issues connecting to Gemini API using Network or Advanced HTTP extensions

Hi everyone! I’m trying to integrate the Gemini API into my project, but I’m having some trouble with the connection. I’ve tried two different approaches and I’m stuck on both:

  1. Network Extension: I keep getting an error when I try to send the request. I suspect it might be a formatting issue with the JSON body or the headers, but I can’t pinpoint it.
  2. Advanced HTTP Extension: I’m not sure how to properly check if the connection was successful or how to handle the response data within GDevelop’s events.

Does anyone have a working example or a screenshot of the events required to make a POST request to Gemini? Specifically, I’d like to know how to structure the headers (API Key) and the body to get a simple text response.

I’m attaching images of both implementations (which I tested separately) so you can see how I set up the events and the parameters.

Thanks in advance for the help!