> ## 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.

# OpenAI Models and Usage Tiers

> Understand OpenAI's models and usage tiers so you can choose the right plan for your team's pull request review and scan volume.

OpenAI provides a family of GPT models accessible via a REST API at `https://api.openai.com`. Rate limits are applied per organisation and scale automatically as your usage and spend increase.

<Info>
  Monitor your current tier, rate limits, and token usage in the [OpenAI Platform dashboard](https://platform.openai.com/settings/organization/limits).
</Info>

***

## Supported models

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

| Model             | Best for                                                                          | Context window |
| ----------------- | --------------------------------------------------------------------------------- | -------------- |
| **`gpt-4o`**      | Recommended. Highest accuracy for code review, security analysis, and large diffs | 128k tokens    |
| **`gpt-4o-mini`** | Fast turnaround, lower cost, high-volume routine reviews                          | 128k tokens    |
| **`gpt-4-turbo`** | Complex reasoning over large codebases                                            | 128k tokens    |
| **`gpt-4`**       | Baseline GPT-4 for standard reviews                                               | 8k tokens      |

<Tip>
  Use `gpt-4o` for security-sensitive pull requests and large diffs. Use `gpt-4o-mini` for high-volume, routine reviews where speed and cost matter more.
</Tip>

***

## Usage tiers

OpenAI automatically advances your account through usage tiers as your cumulative spend increases. Higher tiers unlock greater rate limits.

| Tier       | Requirement                                   | Monthly spend limit |
| ---------- | --------------------------------------------- | ------------------- |
| **Free**   | Account created, no payment method required   | \$100               |
| **Tier 1** | \$5 paid                                      | \$100               |
| **Tier 2** | \$50 paid and 7+ days since first payment     | \$500               |
| **Tier 3** | \$100 paid and 7+ days since first payment    | \$1,000             |
| **Tier 4** | \$250 paid and 14+ days since first payment   | \$5,000             |
| **Tier 5** | \$1,000 paid and 30+ days since first payment | \$200,000           |

<Note>
  You advance to the next tier as soon as your cumulative payments cross the threshold and the waiting period has elapsed. There is no manual upgrade process.
</Note>

***

## Rate limits by tier

Rate limits are measured in three dimensions:

* **RPM** — requests per minute
* **TPM** — tokens per minute
* **RPD** — requests per day

### Tier 1

| Model         | RPM | TPM     | RPD    |
| ------------- | --- | ------- | ------ |
| `gpt-4o`      | 500 | 30,000  | 10,000 |
| `gpt-4o-mini` | 500 | 200,000 | 10,000 |
| `gpt-4-turbo` | 500 | 30,000  | 10,000 |

### Tier 2

| Model         | RPM   | TPM       | RPD |
| ------------- | ----- | --------- | --- |
| `gpt-4o`      | 5,000 | 450,000   | —   |
| `gpt-4o-mini` | 5,000 | 2,000,000 | —   |
| `gpt-4-turbo` | 5,000 | 450,000   | —   |

### Tier 3

| Model         | RPM   | TPM       | RPD |
| ------------- | ----- | --------- | --- |
| `gpt-4o`      | 5,000 | 800,000   | —   |
| `gpt-4o-mini` | 5,000 | 4,000,000 | —   |
| `gpt-4-turbo` | 5,000 | 800,000   | —   |

### Tier 4

| Model         | RPM    | TPM        | RPD |
| ------------- | ------ | ---------- | --- |
| `gpt-4o`      | 10,000 | 2,000,000  | —   |
| `gpt-4o-mini` | 10,000 | 10,000,000 | —   |
| `gpt-4-turbo` | 10,000 | 2,000,000  | —   |

### Tier 5

| Model         | RPM    | TPM         | RPD |
| ------------- | ------ | ----------- | --- |
| `gpt-4o`      | 10,000 | 30,000,000  | —   |
| `gpt-4o-mini` | 30,000 | 150,000,000 | —   |
| `gpt-4-turbo` | 10,000 | 30,000,000  | —   |

***

## Choosing the right tier for your team

<Columns cols={1}>
  <Card title="Tier 1 — Evaluation or very small teams" horizontal icon="seedling">
    Fewer than 10 developers, infrequent PRs, or you are trialling BYOK before committing. Requires only \$5 in total payments.
  </Card>

  <Card title="Tier 2 — Small to medium teams" horizontal icon="chart-line">
    10–50 developers with regular PR activity. The 5,000 RPM / 450,000 TPM limit on `gpt-4o` handles dozens of concurrent reviews comfortably.
  </Card>

  <Card title="Tier 3 — Large engineering orgs" horizontal icon="building">
    50–200 developers or multiple busy repositories. Nearly doubles the TPM versus Tier 2.
  </Card>

  <Card title="Tier 4 / Tier 5 — High-velocity platforms" horizontal icon="rocket">
    200+ developers, monorepos, or CI pipelines generating high PR volume. Tier 5 supports up to 30M TPM on `gpt-4o`.
  </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 `gpt-4o`.

| 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>
  Keeping PRs focused (under 400 lines changed) reduces token usage per review and generally improves comment accuracy.
</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:**

* Increase your spend to advance to the next tier in the [OpenAI Platform](https://platform.openai.com/settings/organization/billing)
* Switch to `gpt-4o-mini` to reduce per-request token usage
* Contact [support](mailto:supports@darner.ai) if you need help sizing the right tier

***

## Getting an OpenAI API key

<Steps>
  <Step title="Create an OpenAI account">
    Go to [platform.openai.com](https://platform.openai.com) and sign up or log in.
  </Step>

  <Step title="Add a payment method">
    Navigate to **Settings → Billing** and add a payment method. Purchase at least \$5 in credits to activate Tier 1 and unlock rate limits beyond the free tier.
  </Step>

  <Step title="Generate an API key">
    Go to **API Keys** in the left sidebar and click **Create new secret key**. Give it a descriptive name such as `garth-byok` and set the permissions to **All**.
  </Step>

  <Step title="Copy and store the key">
    Copy the key — it is shown only once. Paste it into Garth's [Settings → Integrations → LLM](https://app.heygarth.ai/settings/integrations) under the **OpenAI** provider.
  </Step>
</Steps>

<Warning>
  Never commit your OpenAI 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 OpenAI documentation for models, pricing, and rate limits.

<CardGroup cols={2}>
  <Card title="OpenAI models" icon="book" href="https://platform.openai.com/docs/models">
    Full list of available GPT models with context windows and capabilities.
  </Card>

  <Card title="Rate limits" icon="gauge-high" href="https://platform.openai.com/docs/guides/rate-limits">
    Official rate limit reference for all tiers and models.
  </Card>

  <Card title="Pricing" icon="receipt" href="https://openai.com/api/pricing/">
    Per-token pricing for all OpenAI models.
  </Card>

  <Card title="API keys" icon="key" href="https://platform.openai.com/api-keys">
    Create and manage your OpenAI API keys.
  </Card>
</CardGroup>

***

## Next steps

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

  <Card title="OpenAI Platform — Limits" icon="arrow-up-right-from-square" href="https://platform.openai.com/settings/organization/limits">
    View your current tier and live rate limit usage in the OpenAI Platform dashboard.
  </Card>
</Columns>
