Calling Google Gemini AI from the terminal with Go

Leo Gutiérrez
3 min readMay 4, 2024

Let’s see how to call Google Gemini AI from the terminal using a Go script. I usually spend quite some time in the terminal, having a script to call and have Google AI response there would be really convenient.

Prerequisites

  1. Get an API Key

You will need an API Key to call Gemini, you can get it here: https://ai.google.dev/gemini-api/docs/api-key

2. Store it in an environmental variable. I have it in my ˜/.bashrc:

export…

--

--

Leo Gutiérrez

Hi! I am Leonardo Gutiérrez R., a passionate software developer, I hope you find the content in this blog interesting. I write about IT related stuff.