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

# OpenAI Configuration

> Set up OpenAI as an alternative AI provider

# OpenAI Configuration

Simili Bot v0.2.0 supports OpenAI as a full alternative to Google Gemini for both embeddings and LLM analysis.

## Getting started

### 1. Get API key

1. Go to [platform.openai.com](https://platform.openai.com/api-keys)
2. Sign in with your OpenAI account
3. Click **Create new secret key**
4. Copy the generated API key

### 2. Set up GitHub secret

Store your API key securely:

1. Go to repository **Settings** → **Secrets and variables** → **Actions**
2. Create secret `OPENAI_API_KEY`
3. Paste your API key

### 3. Configure Simili Bot

Add to `.github/simili.yaml`:

```yaml theme={null}
embedding:
  provider: "openai"
  api_key: "${OPENAI_API_KEY}"
  model: "text-embedding-3-small"
  dimensions: 1536

llm:
  provider: "openai"
  api_key: "${OPENAI_API_KEY}"
  model: "gpt-5.2"
```

## Configuration reference

### Embedding settings

| Property     | Type   | Description             | Required                               |
| ------------ | ------ | ----------------------- | -------------------------------------- |
| `provider`   | string | Must be `"openai"`      | Yes                                    |
| `api_key`    | string | OpenAI API key          | Yes                                    |
| `model`      | string | Embedding model         | No (default: `text-embedding-3-small`) |
| `dimensions` | number | Must match model output | Yes                                    |

### LLM settings

| Property   | Type   | Description        | Default                 |
| ---------- | ------ | ------------------ | ----------------------- |
| `provider` | string | Must be `"openai"` | Inherits from embedding |
| `api_key`  | string | OpenAI API key     | Inherits from embedding |
| `model`    | string | LLM model          | `gpt-5.2`               |

## Available models

### Embedding models

| Model                    | Dimensions | Notes                   |
| ------------------------ | ---------- | ----------------------- |
| `text-embedding-3-small` | 1536       | Default, cost-efficient |
| `text-embedding-3-large` | 3072       | Highest quality         |
| `text-embedding-ada-002` | 1536       | Legacy, not recommended |

<Warning>
  The `dimensions` value must match the model's output. Mismatches will cause Qdrant collection errors.
</Warning>

## Provider precedence

If both `GEMINI_API_KEY` and `OPENAI_API_KEY` are set, **Gemini takes priority**.

To use only OpenAI:

* Only set `OPENAI_API_KEY` (do not set `GEMINI_API_KEY`), or
* Explicitly configure `provider: "openai"` in your `simili.yaml`

## Mixed providers

You can use different providers for embeddings and LLM:

```yaml theme={null}
# Use OpenAI for embeddings, Gemini for LLM
embedding:
  provider: "openai"
  api_key: "${OPENAI_API_KEY}"
  model: "text-embedding-3-large"
  dimensions: 3072

llm:
  provider: "gemini"
  api_key: "${GEMINI_API_KEY}"
  model: "gemini-2.5-flash"
```

## Common issues & solutions

### Invalid API key

**Error:** `Error 401: Incorrect API key provided`

**Solutions:**

1. Verify the key is correct from platform.openai.com
2. Ensure no extra whitespace in the secret value
3. Check the key has not been revoked

### Rate limited

**Error:** `Error 429: Rate limit reached`

**Solutions:**

1. Reduce worker count during bulk indexing
2. Upgrade your OpenAI tier for higher limits

### Dimension mismatch

**Error:** `collection dimension mismatch`

Make sure `dimensions` matches the model:

```yaml theme={null}
embedding:
  model: "text-embedding-3-small"
  dimensions: 1536   # Must match!
```

## Next steps

<CardGroup cols={2}>
  <Card title="Gemini configuration" href="/configuration/gemini">
    Use Gemini instead
  </Card>

  <Card title="Environment variables" href="/reference/environment-variables">
    Configure API keys
  </Card>

  <Card title="OpenAI integration reference" href="/reference/integrations/openai">
    Technical integration details
  </Card>
</CardGroup>
