> ## Documentation Index
> Fetch the complete documentation index at: https://help.nextmatter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to Google Gemini

> Generate text, JSON, and answers about documents and images with Google Gemini in a code-free step.

Use a code-free Google Gemini step to generate text from a prompt, return structured JSON, and give the model documents or images as extra context.

## Before you begin

* Create a Gemini API key in your Google account, for example in Google AI Studio.

* In your Next Matter workspace, go to **Automations library**, click **Connect** in the **Google Gemini** app tile, and enter your API key.

> [!NOTE]
>
> Gemini usage is billed by Google to the account that owns the API key, not by Next Matter.

## Generate text

1. Click **Workflows > + Create new\... > Create a new workflow** and give your workflow a name. If you have a workflow ready, click **... > Edit workflow**.

2. Click **+ Add step** and select **Integrations > Google Gemini**.

3. Click the step and click **Configure integration**.

4. Select **Generates text from a prompt using Google's Gemini AI**.

5. Enter the **Prompt**. To use data from earlier steps, insert a data reference in the prompt.

6. Select the **Model**. The list shows the Gemini models that your API key can use for text generation.

7. (Optional) Enter a **System message** to tell the model how to behave, for example "You are a support assistant. Answer in two sentences."

8. Select the **Output type**:

   * **Text** — the model answers in plain text.

   * **JSON** — the model answers with a JSON object you can use in later steps.

   * **Specific JSON schema** — the model answers in the structure you define in **Output structure**.

9. Select the output as a variable you can refer to later on. Use **Generated text** for plain text, or **Generated JSON** for the two JSON output types.

10. Save your changes.

## Add documents or images

Use the **Files** field to give Gemini extra context, such as a contract to summarize or a photo to describe.

1. In the step, open the **Files** field.

2. Add one or more links to files, separated by commas. You can use data references to files uploaded in earlier steps.

3. Save your changes.

* Gemini reads PDF, DOCX, and TXT files as text. Next Matter adds up to 10,000 characters per file and up to 50,000 characters in total to the prompt, and cuts off the rest.

* Gemini analyzes images in PNG, JPEG, GIF, and WEBP format. WEBP images larger than 25 megapixels aren't supported.

> [!NOTE]
>
> If a file can't be downloaded or read, the step fails with a message that says which files caused the problem.

## Fine-tune the answer

* **Temperature** — controls how creative the answers are. The default is 0.7. Lower values give more predictable answers.

* **Max tokens** — sets the maximum length of the answer. The default is 1024. Increase it if answers are cut off.

* **Replace placeholders in prompt** — replaces text such as `{{country}}` in your prompt with data from earlier steps.

* **Message history** — continues an earlier conversation. Select the **Message history** output of a previous Gemini step. Leave it empty to start a new conversation.

> [!TIP]
>
> You can use decimals to set **Temperature**. In German and other European locales, use a comma (,) instead of a point (.) as the decimal separator.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.