How to get a Google Gemini API key

To use Generate with AI with Gemini, connect your own Gemini API key. Here's how to create one - it takes a minute.

Create the key

  1. Sign in to Google AI Studio with your Google account and open Get API key - direct link: aistudio.google.com/app/apikey.
  2. Select Create API key, choose or create a Google Cloud project, and copy the key. It usually starts with AIza.
  3. For more than a few test generations, turn on billing for that project: ai.google.dev/gemini-api/docs/billing. Generation calls are billed to your Google account.

Google's own guide to Gemini API keys: ai.google.dev/gemini-api/docs/api-key.

Connect it

  1. In your Shopify admin, open Workflow Trigger Extensions -> Developer -> Connections.
  2. Paste the key into the Google Gemini card and select Save key.

Your key is encrypted at rest and used only for generation. It is never shown again, and it never runs inside your trigger code. Then open a custom trigger, use Generate with AI on the Code tab and pick Gemini and a model there. A key that Google rejects shows up as an error on your first generation.