Google Gemini API

Hello everyone,
It seems that Google gemini-pro model is now available through API calls, I tried with a curl command to run their demo call and it worked just fine

curl \                                 
  -H 'Content-Type: application/json' \
  -d '{"contents":[{"parts":[{"text":"Write a story about a magic backpack"}]}]}' \
  -X POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent\?key\=API_CODE_HERE

I am wondering how we can call these through n8n would that be an HTTP request wi parameters to fit the gemini argument, do we have any plans to create nodes specifically for Gemini ?

Rad

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Ok I think I got it almost working

The only frustrating thing is that Canada is not in the list of available regions :smiley: so am not able to do that through the API, and my instance is hosted on a Canadian zone, is there any ‘vpn’ sort of trick I can use to make that node work ? please ? :smiley:

Hey @Rad,

I am sure we will add nodes for it at some point but for now if it is working with curl you should be able to make it work with the http request node with something like the below. It might be worth also adding a credential for the API key using a generic type but this should get you started, At the moment though this is not a service I can access as it is still region locked so I am not able to test it.

Hi @Rad @Jon great to see someone using gemini,
You have almost got it correct you have to add proxy if it doesn’t work in your region and moreover if you want you have harmful content etc parameters or temperature modified you can do that too.

I will share screenshot and json to download flow



1 Like

Hi @Rad @Jon ,
here is further help





Thank you so much @bharat_singh this isexactly what I tried indeed, my only issue is with the VPN, I use a service called bulletvpn, not sure how to provide the credentials to it though to be able to use one of the vpn servers

We of course wouldn’t recommend using a proxy or vpn to access a geolocked service as by using it you are going against the terms of service for that product.

This works with direct individual messages, but how would you handle memory or chat history without langchain or any of the existing AI nodes able to be used?

Currently individual messages would be much less useful I would think over having some sort of conversation history.

1 Like

Where i can Find Proxy?

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