# Connect SillyTavern to an AI: Gemini, OpenRouter, Claude and DeepSeek

> SillyTavern needs an AI model to reply. Connect a free Gemini key, or use OpenRouter for Claude, DeepSeek and more.

SillyTavern is where you chat. The replies come from an AI model, which you connect with an **API key**. Every option is set up in the same place: the **plug icon** (API Connections) in the top bar.

> [!WARNING]
> Treat an API key like a password. Anyone who has it can use your quota, so don't share screenshots that show it.

## Gemini (free to start)

1. Go to [Google AI Studio](https://aistudio.google.com/apikey), sign in, and click **Create API key**. Copy the key.
2. In SillyTavern, click the **plug icon**.
3. Set **API** to **Chat Completion** and **Chat Completion Source** to **Google AI Studio**.
4. Paste the key and click **Connect**.
5. Pick a **Flash** model. It's fast and has the most free use.
6. Click **Test Message**. If you get a reply, you're done.

The free tier has daily and per-minute limits that Google changes now and then. You can check them on the [Gemini rate limits page](https://ai.google.dev/gemini-api/docs/rate-limits). Going over shows **Too Many Requests**; here's [how to fix it](/articles/fix-sillytavern-errors#too-many-requests-429).

## OpenRouter (Claude, DeepSeek and more)

OpenRouter is one account and one balance for models from Anthropic, DeepSeek, Google and others. You can switch models any time, so it's the easiest way to use Claude or DeepSeek.

1. Sign in at [openrouter.ai](https://openrouter.ai/), open **Keys**, and click **Create Key**.
2. For paid models, add credit under **Credits**. Models whose names end in `:free` work without credit, with daily limits.
3. In SillyTavern, open the **plug icon**, set **Chat Completion Source** to **OpenRouter**, paste the key, and click **Connect**. You can click **Authorize** to sign in with OpenRouter instead.
4. Pick a model and click **Test Message**.

### Which model?

Names and prices change often, so check [OpenRouter's model list](https://openrouter.ai/models). Roughly:

| Model family | Good at | Cost |
| --- | --- | --- |
| Claude | Memory, steady characters, natural writing, strong Thai | Higher |
| DeepSeek | Detailed roleplay, good Thai | Low |
| Gemini | Speed, long chats | Low, or free with your own key |
| `:free` models | Trying things out | Free, daily limits |

## Claude or DeepSeek directly

You can skip OpenRouter. Create a key in the [Anthropic Console](https://console.anthropic.com/) or on the [DeepSeek Platform](https://platform.deepseek.com/), then choose **Claude** or **DeepSeek** as the Chat Completion Source. It can be a little cheaper, but each provider needs its own balance.

## Response settings

The **sliders icon** (AI Response Configuration) has two settings worth knowing:

- **Context Size** is how much of the chat the model reads each time. More remembers more, but costs more and hits limits sooner.
- **Max Response Length** caps each reply. About 2,000 tokens suits most roleplay.

The [SillyTavern TH Discord](https://discord.gg/sgVPM2du6m) shares presets for these that you can import from the same panel.

Next, [set up your first chat](/articles/sillytavern-first-chat). On [Rolezy](https://account.rolezy.com/login) or [Rolezy Plus](https://plus.rolezy.com/), the steps are the same.
