> For the complete documentation index, see [llms.txt](https://docs.deva.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deva.me/guides/bring-your-own-llm.md).

# Bring Your Own LLM

Genie includes AI credits by default, but you can also connect your own LLM provider account. When connected, messages use your own API quota — no Genie credits consumed.

This is useful when you have run out of credits, want higher rate limits, or prefer a specific provider.

***

## Supported Providers

| Provider               | Auth Method               | Token Lifetime          |
| ---------------------- | ------------------------- | ----------------------- |
| **Claude** (Anthropic) | Setup token (recommended) | Long-lived              |
| **Claude** (Anthropic) | OAuth (quick)             | \~8 hours, auto-refresh |
| **Codex** (OpenAI)     | OAuth sign-in             | Session-based           |
| **Gemini** (Google)    | OAuth sign-in             | Session-based           |

Multiple providers can be connected simultaneously. You can switch between them at any time.

***

## Prerequisites

* A Genie account with a provisioned server
* Server must be in **Running** state (Settings → Server)
* An account with at least one of the supported providers

***

## Connecting a Provider

Go to **Settings → Server → LLM Integrations** and select the provider tab you want to connect.

### Claude — Setup Token (Recommended)

The setup token method creates a long-lived connection and enables Claude Opus as the default model on your server.

1. Click **Start Setup** under the Claude tab
2. A new tab opens to Claude's authorization page
3. Sign in to your Claude/Anthropic account and authorize access
4. Copy the authorization code from the callback page
5. Paste the code into the input field and click **Connect**

For the full walkthrough with screenshots, see [Setting Up Your Server — Claude Setup Token](/quick-start/onboarding-genie/setting-up-server.md#claude-setup-token).

### Claude — OAuth (Quick)

A faster alternative with shorter-lived tokens (\~8 hours, auto-refreshed).

1. Click **Connect** in the OAuth section
2. Authorize in the browser window that opens
3. The page may show a connection error — this is expected
4. Copy the **full URL** from the address bar
5. Paste the URL back into Genie and click **Connect**

### Codex (OpenAI)

Uses your ChatGPT subscription and its rate limits.

1. Select the **Codex** tab and click **Connect Codex CLI**
2. Sign in with your OpenAI account in the browser
3. Authorize access on the consent page
4. Copy the **full callback URL** from the address bar (connection error is expected)
5. Paste back into Genie and click **Connect**

For the full walkthrough with screenshots, see [Connect OpenAI Codex](/guides/connect-codex.md).

### Gemini (Google)

1. Select the **Gemini** tab
2. Enter your **GCP Project ID** — recommended to avoid free-tier rate limits, required for Google Workspace or organization accounts
   * Go to [console.cloud.google.com](https://console.cloud.google.com), select or create a project
   * Enable the **Gemini for Google Cloud** API under APIs & Services → Library
   * Copy the Project ID
3. Click **Continue to sign in**
4. Authorize with your Google account
5. Copy the **full callback URL** from the address bar (connection error is expected)
6. Paste back into Genie and click **Connect**

For the full walkthrough with screenshots, see [Connect Google Gemini](/guides/connect-gemini.md).

***

## Using Your Connected LLM

### Start a New Chat

Connecting or switching an LLM provider does **not** take effect in your current active session.

* **On Dashboard** — create a **new chat** to start using the connected provider
* **On Telegram** — run the `/models` command and select your preferred provider/model from the list

### Switching Between Providers

* You can have multiple providers connected at the same time
* Use `/models` (Telegram) or the model selector (Dashboard) to switch between them
* Each new chat session uses whichever model is currently selected

***

## Troubleshooting

| Problem                                   | Solution                                                                          |
| ----------------------------------------- | --------------------------------------------------------------------------------- |
| "Server must be running"                  | Start your server in Settings → Server before connecting                          |
| OAuth callback shows "connection refused" | This is expected — just copy the URL from the address bar and paste it into Genie |
| Token expired (Claude OAuth)              | OAuth tokens last \~8 hours. Switch to setup-token for a long-lived connection    |
| Gemini rate limits                        | Provide your own GCP Project ID during setup for higher rate limits               |
| Connected but still using credits         | Start a **new chat** or run `/models` on Telegram to switch to your provider      |
