> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# Using BeatAPI in SillyTavern

> Connect SillyTavern to BeatAPI through Custom (OpenAI-compatible) for GPT, Gemini, DeepSeek, Grok, GLM, and MiniMax, or through SillyTavern's native Claude Reverse Proxy field for Claude models.

SillyTavern connects to BeatAPI through two Chat Completion sources based on the model family. SillyTavern calls GPT, Gemini, Grok, DeepSeek, GLM, Qwen, Kimi, MiniMax, MiMo, Hunyuan, and Muse models through **Custom (OpenAI-compatible)**. SillyTavern calls Claude models through the native **Claude** source with a Reverse Proxy URL, because BeatAPI serves Claude models only on Anthropic Messages (`POST /v1/messages`).

## Prerequisites

1. A running SillyTavern instance on desktop, server, or mobile Termux.
2. A dedicated BeatAPI API key from [Dashboard → API Keys](https://beatapi.io/dashboard/apikeys). A dedicated key isolates SillyTavern spend in usage reports and supports a per-key quota cap.

## Base URL selection

Use `https://direct.beatapi.io/v1` as the default Base URL in SillyTavern. `direct.beatapi.io` bypasses Cloudflare's 100-second wait limit on long replies and reasoning outputs while keeping the same API key, model catalogue, and token rates as `https://api.beatapi.io/v1`.

For connections from East or Southeast Asia that drop packets on mobile or residential networks, use `https://api-asia.beatapi.io/v1`. `api-asia.beatapi.io` also avoids the 100-second wait limit. Keep `https://api.beatapi.io/v1` as a fallback host.

## Route A: Custom (OpenAI-compatible) for non-Claude models

SillyTavern's `Custom (OpenAI-compatible)` source handles Gemini, DeepSeek, Grok, GPT, GLM, Qwen, Kimi, MiniMax, MiMo, Hunyuan, Muse, and BeatAPI `-free` models.

1. Open the **API Connections** panel (the plug icon in SillyTavern's top bar).
2. Set **API** to `Chat Completion`.
3. Set **Chat Completion Source** to `Custom (OpenAI-compatible)`.
4. Enter `https://direct.beatapi.io/v1` in **Custom Endpoint (Server URL)**. Omit `/chat/completions`, because SillyTavern appends `/chat/completions` automatically.
5. Paste the BeatAPI API key into **Custom API Key**.
6. Set **Prompt Post-Processing** to `Semi-strict` or `Merge consecutive messages`. Strict models such as Gemini, DeepSeek, and MiniMax return `400 Bad Request` when SillyTavern sends consecutive same-role messages. If `Test Message` succeeds while SillyTavern displays an API status warning, enable **Bypass API status check**.
7. Click **Connect**. SillyTavern calls `GET /v1/models` to load the models available to the key.
8. Select a model ID from the dropdown, or type the exact case-sensitive model ID if the list does not refresh.

## Route B: Native Claude source for Claude models

BeatAPI serves Claude models only on `POST /v1/messages`. Sending a Claude model ID through `Custom (OpenAI-compatible)` returns `404 not_found`. SillyTavern's native `Claude` source hardcodes `api.anthropic.com` by default, so redirecting SillyTavern's native `Claude` requests to BeatAPI requires filling SillyTavern's **Reverse Proxy** field.

1. Open the **API Connections** panel and set **API** to `Chat Completion`.
2. Set **Chat Completion Source** to `Claude`.
3. Open the **Reverse Proxy** section under the Claude fields.
4. Enter `https://direct.beatapi.io/v1` in **Proxy Server URL**.
5. Paste the BeatAPI API key into **Claude API Key** (or **Proxy Password** when the installed SillyTavern build reads the proxy credential from that field).
6. Select or type a BeatAPI Claude model ID such as `claude-sonnet-5-5`, `claude-opus-5-5`, or `claude-haiku-5-5`.
7. Click **Connect**.

To use Claude prompt caching in SillyTavern, set `claude.enableSystemPromptCache: true` and `claude.cachingAtDepth: 2` in SillyTavern's `config.yaml`, then restart SillyTavern. See [Prompt caching not hitting](/faq/roleplay-prompt-caching-not-working).

## Models and initial parameters

You can test connectivity at zero balance with a `-free` model on Route A before switching to a paid model.

| Model ID                   | SillyTavern route          | Typical roleplay use                                                             |
| -------------------------- | -------------------------- | -------------------------------------------------------------------------------- |
| `deepseek-v4.1-flash-free` | Custom (OpenAI-compatible) | Zero-balance connectivity test (1 req/min before top-up, up to 10 req/min after) |
| `glm-5.3-flash-free`       | Custom (OpenAI-compatible) | Zero-balance connectivity test and short chat                                    |
| `claude-sonnet-5-5`        | Claude (Reverse Proxy)     | Long-form dialogue and prose (1M context)                                        |
| `gemini-4-neon`            | Custom (OpenAI-compatible) | Long-context story tracking (1M context)                                         |
| `deepseek-v4-pro-0813`     | Custom (OpenAI-compatible) | Reasoning and multi-turn plot development (1M context)                           |
| `MiniMax-M3`               | Custom (OpenAI-compatible) | Low-cost daily dialogue (1M context)                                             |

Live token prices are published on the [pricing page](https://beatapi.io/pricing), and full model IDs are listed in the [Text API reference](/text-api).

Set two generation parameters in SillyTavern's **AI Response Configuration** panel before starting a long chat:

* **Streaming (`stream: true`)**: Streaming renders tokens as they arrive and lets you stop an off-track reply early instead of paying for a full generation.
* **Max Response Length (`max_tokens`)**: Set `2000`–`4096` for regular chat and `4096`–`8192` for reasoning models. BeatAPI estimates required balance from `max_tokens`; setting `32000` or `65536` on a low balance can trigger `402 insufficient_credits` even when the actual reply is short.

## Verify the first message

Click **Test Message** in the **API Connections** panel, or send one short message in a character card. Confirm that the reply streams back without error and that the request appears under the SillyTavern API key in [Dashboard → Usage](https://beatapi.io/dashboard).

## Troubleshooting and next steps

* **404 on Claude models**: [Why does Claude return 404 in SillyTavern, Tavo, or JanitorAI?](/faq/roleplay-claude-404)
* **400 Bad Request or status warning on Custom**: [SillyTavern 400 & Post-Processing](/faq/roleplay-post-processing-400)
* **Claude prompt caching not saving money**: [Prompt caching not hitting](/faq/roleplay-prompt-caching-not-working)
* **Empty replies or `</think>` loops on reasoning models**: [Reasoning `<think>` cut-offs & loops](/faq/roleplay-thinking-tags-cutoff)
* **Replies drop or cut off mid-sentence**: [Roleplay timeouts and cut-offs](/faq/roleplay-timeout-truncation)
* **402 error despite positive balance**: [402 error from oversized max_tokens](/faq/roleplay-max-tokens-402)
* **Lower token spend in long chats**: [Run a dual-model roleplay workflow](/guides/roleplay-dual-model-workflow) and [Keep long roleplay memory consistent while controlling token cost](/guides/roleplay-long-memory-cache).