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

# Gemini Models and Rate Limits

> Understand Google's Gemini models and rate limits so you can choose the right plan for your team's pull request review and scan volume.

Google's Gemini models are available via the Gemini API at `https://generativelanguage.googleapis.com`. Free-tier access is provided through Google AI Studio, while paid usage is billed through a Google Cloud project.

<Info>
  Monitor your current quota and usage in [Google AI Studio](https://aistudio.google.com/) or in the [Google Cloud Console](https://console.cloud.google.com/apis/api/generativelanguage.googleapis.com/quotas) if you are using a Cloud billing account.
</Info>

***

## Supported models

Garth supports the following Gemini models for code review and scan requests.

| Model                     | Best for                                                            | Context window |
| ------------------------- | ------------------------------------------------------------------- | -------------- |
| **`gemini-2.0-flash`**    | Recommended. Fast, accurate reviews with low latency                | 1M tokens      |
| **`gemini-1.5-pro`**      | Complex reasoning over very large diffs and full-repository context | 2M tokens      |
| **`gemini-1.5-flash`**    | High-volume, lower-cost reviews where speed is the priority         | 1M tokens      |
| **`gemini-1.5-flash-8b`** | Lightest model for simple, routine reviews                          | 1M tokens      |

<Tip>
  Use `gemini-1.5-pro` for large or security-sensitive pull requests where maximum context and accuracy matter. Use `gemini-2.0-flash` as the default — it balances speed and quality for most teams.
</Tip>

***

## Usage tiers

The Gemini API provides a free tier for evaluation, and three paid tiers that unlock higher rate limits based on your billing history and cumulative spend.

| Tier       | Qualifications                                                     | Features                                                                        |
| ---------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| **Free**   | Available to eligible countries; no credit card required           | No charge. Requests may be used to improve Google products. Lower rate limits.  |
| **Tier 1** | Billing account linked to the project                              | Requests are not used for product improvement. Paid per token. Standard limits. |
| **Tier 2** | Total spend of at least \$250 + 30 days since successful payment   | Higher rate limits for growing applications.                                    |
| **Tier 3** | Total spend of at least \$1,000 + 30 days since successful payment | Maximum rate limits for enterprise-scale workloads.                             |

<Note>
  For production use, Garth requires at least **Tier 1**. This removes data usage restrictions and unlocks significantly higher rate limits for concurrent pull request reviews. New accounts must use prepaid billing and will be subject to a monthly spend cap.
</Note>

***

## Rate limits

### Free tier

| Model                 | RPM | TPM       | RPD   |
| --------------------- | --- | --------- | ----- |
| `gemini-2.0-flash`    | 15  | 1,000,000 | 1,500 |
| `gemini-1.5-pro`      | 2   | 32,000    | 50    |
| `gemini-1.5-flash`    | 15  | 1,000,000 | 1,500 |
| `gemini-1.5-flash-8b` | 15  | 1,000,000 | 1,500 |

### Tier 1 and above (Paid tiers)

Upon linking a billing account (Tier 1), rate limits increase substantially. Limits scale further as you reach Tiers 2 and 3. Representative Tier 1 limits:

| Model                 | RPM   | TPM       | RPD |
| --------------------- | ----- | --------- | --- |
| `gemini-2.0-flash`    | 2,000 | 4,000,000 | —   |
| `gemini-1.5-pro`      | 1,000 | 4,000,000 | —   |
| `gemini-1.5-flash`    | 2,000 | 4,000,000 | —   |
| `gemini-1.5-flash-8b` | 4,000 | 4,000,000 | —   |

<Note>
  RPM = requests per minute · TPM = tokens per minute · RPD = requests per day. Paid tier limits can be further increased by requesting a quota increase in the Google Cloud Console.
</Note>

***

## Choosing the right tier for your team

<Columns cols={1}>
  <Card title="Free tier — Evaluation only" horizontal icon="seedling">
    Fewer than 5 developers trialling Gemini BYOK. The free tier's low RPM and RPD caps make it unsuitable for sustained team use.
  </Card>

  <Card title="Tier 1 / Tier 2 — Small to medium teams" horizontal icon="chart-line">
    10–100 developers with regular PR activity. The 2,000 RPM limit on `gemini-2.0-flash` handles dozens of concurrent reviews. Enable Cloud billing to unlock Tier 1.
  </Card>

  <Card title="Tier 3 & Quota increases — Large engineering orgs" horizontal icon="building">
    100+ developers or monorepos. If Tier 3 limits are insufficient, request a TPM or RPM increase through the [Google Cloud Console quotas page](https://console.cloud.google.com/iam-admin/quotas).
  </Card>
</Columns>

***

## Token consumption per review

Each Garth review consumes input tokens (your diff and context) and output tokens (the review comments). Estimates below are for `gemini-2.0-flash`.

| Review size                           | Typical input tokens | Typical output tokens |
| ------------------------------------- | -------------------- | --------------------- |
| Small PR (1–5 files, \< 200 lines)    | 3,000 – 8,000        | 500 – 1,500           |
| Medium PR (5–20 files, 200–800 lines) | 8,000 – 25,000       | 1,500 – 4,000         |
| Large PR (20+ files, 800+ lines)      | 25,000 – 80,000      | 4,000 – 10,000        |

<Tip>
  Gemini's large context window (1M–2M tokens) means Garth can include broad repository context in each review. This improves accuracy but increases token usage — monitor your TPM if you have many concurrent reviews.
</Tip>

***

## Rate limit errors

If your account hits a rate limit, Garth retries automatically with exponential backoff. Sustained limits may delay when review comments are posted.

**What you will see:**

* A delayed review comment once the retry succeeds
* A dashboard notification if retries are exhausted and the review is dropped

**How to resolve:**

* Enable Cloud billing to upgrade from the free tier to pay-as-you-go
* Request a quota increase in the [Google Cloud Console](https://console.cloud.google.com/iam-admin/quotas)
* Switch to `gemini-2.0-flash` or `gemini-1.5-flash` to reduce per-request cost and increase throughput
* Contact [support](mailto:supports@darner.ai) if you need help sizing the right plan

***

## Getting a Gemini API key

<Steps>
  <Step title="Sign in to Google AI Studio">
    Go to [aistudio.google.com](https://aistudio.google.com/) and sign in with your Google account.
  </Step>

  <Step title="Create an API key">
    Click **Get API key** in the left sidebar, then click **Create API key**. Choose an existing Google Cloud project or create a new one to associate the key with.
  </Step>

  <Step title="Enable Cloud billing (recommended)">
    To unlock pay-as-you-go rate limits, open the [Google Cloud Console](https://console.cloud.google.com/billing), select your project, and link a billing account. This upgrades your quota automatically.
  </Step>

  <Step title="Copy and store the key">
    Copy the generated key — it starts with `AIza`. Paste it into Garth's [Settings → Integrations → LLM](https://app.heygarth.ai/settings/integrations) under the **Gemini** provider.
  </Step>
</Steps>

<Warning>
  Never commit your Gemini API key to a repository. Garth's secure vault is the correct place to store it. Garth's own code scan will flag any key found in source code.
</Warning>

***

## Provider references

Official Google documentation for Gemini models, pricing, and rate limits.

<CardGroup cols={2}>
  <Card title="Gemini models" icon="book" href="https://ai.google.dev/gemini-api/docs/models">
    Full list of available Gemini models with context windows and capabilities.
  </Card>

  <Card title="Rate limits" icon="gauge-high" href="https://ai.google.dev/gemini-api/docs/rate-limits">
    Official rate limit reference for free and pay-as-you-go tiers.
  </Card>

  <Card title="Pricing" icon="receipt" href="https://ai.google.dev/pricing">
    Per-token pricing for all Gemini models.
  </Card>

  <Card title="Google AI Studio — API keys" icon="key" href="https://aistudio.google.com/app/apikey">
    Create and manage your Gemini API keys in Google AI Studio.
  </Card>
</CardGroup>

***

## Next steps

<Columns cols={2}>
  <Card title="BYOK overview" icon="key" href="/byok/overview">
    Add your Gemini key to Garth's secure vault and set it as your active provider.
  </Card>

  <Card title="Google AI Studio — API keys" icon="arrow-up-right-from-square" href="https://aistudio.google.com/app/apikey">
    Manage your Gemini API keys and view usage in Google AI Studio.
  </Card>
</Columns>
