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

# Gemini

> Use Gemini models from Google in your Guild agents: supported models, inference providers, setup, and agent code.

Guild supports Gemini models from Google. This page lists the models Guild recognizes, the inference providers that serve them, and how to call them from an agent.

| | |
| - | - |
| Name under **Models** in the credential form | Gemini |
| `provider` in `llmPreferences` | `"gemini"` |
| Default model | `gemini-3.5-flash` |
| Managed access | Yes, when Guild holds a managed key |

## Inference providers

You can reach these models through the Google AI API itself or through a third-party provider.

| Provider | Notes |
| - | - |
| Google AI | The Gemini API, listed as **Google AI**. Available on every account. |
| [OpenRouter](/platform/providers/openrouter) | Served under OpenRouter's `google/` namespace. |

Write the canonical model name, such as `gemini-3.5-flash`, everywhere in Guild. Guild maps it to each provider's own model ID.

## Models

Guild prices and recognizes these Gemini model IDs. A policy or preference can also name any other model your credential can reach. Third-party providers route more models than this list, and their catalogs change; see each provider's page for what it serves.

| Model | Notes |
| - | - |
| `gemini-3.8-flash` | |
| `gemini-3.6-flash` | |
| `gemini-3.5-flash` | The default. |
| `gemini-3.1-pro-preview` | |
| `gemini-3-pro` | Also matched as `gemini-3-pro-preview`. |
| `gemini-2.5-flash` | |
| `gemini-2.5-flash-lite` | |

## Set up Gemini

On a managed account, agents can use Gemini models without a credential, as long as Guild holds a managed key for Gemini. To use your own Gemini account instead, add a credential. Adding your first credential switches the whole account to bring your own key (BYOK).

<Steps>
  <Step title="Open Models & providers">Click **Access & setup** in the left nav, then **Models & providers**. In an organization, only admins can open it.</Step>
  <Step title="Add a credential">Click **Add API key** and choose an inference provider from the table above.</Step>
  <Step title="Enter the provider's secret">Give the credential a **Name** and paste your provider's **API key**. [AWS Bedrock](/platform/providers/aws-bedrock) asks for an IAM role and region instead.</Step>
  <Step title="Choose Gemini">Under **Models**, check **Gemini**. Keep `gemini-3.5-flash` as its default model or enter another from the list above. Then click **Add Key**.</Step>
</Steps>

To control which workspaces and agents can use Gemini models, add a [model policy](/platform/llm-settings#model-policies) for the credential. For example, `--models "gemini-*-flash"` limits a policy to matching models:

```bash theme={null}
guild llm policy create --credential <credential-id> --publisher GEMINI --target-id <workspace-or-agent-id> --models "gemini-*-flash"
```

## Use it from an agent

Agent code never names a credential. Guild resolves the call against the workspace owner's settings. To ask for Gemini explicitly, put it in `llmPreferences`:

```typescript theme={null}
const result = await task.llm.generateText({
  prompt: "Summarize this text...",
  llmPreferences: [
    { provider: "gemini", model: "gemini-3.1-pro-preview" },
    { provider: "gemini" },
  ],
})
```

The first entry asks for `gemini-3.1-pro-preview`. The second falls back to the default model of the matching policy. Preferences are strict: if no credential or policy allows any of them, the call fails rather than using another publisher. See [LLM preferences](/guide/llms#llm-preferences).

## Notes

* Guild requests Gemini's thoughts, so the session can show reasoning progress.
* Gemini accepts a narrower JSON Schema than other publishers. Guild rewrites tool and structured-output schemas to fit before it sends them.
* In traces, Gemini calls carry the provider name `gcp.gemini`, following the OpenTelemetry GenAI conventions.

## Related pages

* [Models & providers](/platform/llm-settings) for credentials, model policies, and the daily token limit
* [LLMs](/guide/llms) for `task.llm` and the unified LLM proxy
* [Usage](/insights/usage) for spend by model
