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

# Why do long roleplay replies time out or cut off mid-sentence?

> Separate Cloudflare 100-second timeouts, Failed to fetch / No response from bot drops, and max_tokens truncation in SillyTavern, Tavo, OMate, and JanitorAI.

A roleplay reply that stops mid-sentence comes from one of two causes: a **network timeout** (the connection closed before the model finished) or an **output token cap** (the model reached `max_tokens` and stopped). Identifying which cause occurred points directly to the right setting.

## 1. Fix network timeouts, `Failed to fetch`, and `No response from bot`

When a client displays a timeout, `502`/`504`, `A network error occurred / Failed to fetch (unk)`, `PROXY ERROR: No response from bot`, or an empty bubble after waiting over a minute, the connection dropped before completion.

* **Use `https://direct.beatapi.io/v1` for text chat**: `https://api.beatapi.io` runs behind Cloudflare and inherits Cloudflare's 100-second wait limit on non-streaming responses. `https://direct.beatapi.io/v1` uses the same key, models, and prices without the 100-second ceiling.
* **Use `https://api-asia.beatapi.io/v1` in East and Southeast Asia**: If `direct.beatapi.io` drops packets on mobile or residential networks in Asia, switch to `https://api-asia.beatapi.io/v1`, which also bypasses the 100-second limit.
* **Enable streaming (`stream: true`)**: Streaming sends tokens over server-sent events as soon as generation starts, keeping the HTTP connection active during long story turns.

## 2. Fix `max_tokens` truncation

When the reply ends cleanly mid-sentence with no network error and the raw response reports `finish_reason: "length"` (or `stop_reason: "max_tokens"` on Claude), the model hit your configured output cap.

* **Set `max_tokens` to `2000`–`4096`** for standard roleplay dialogue.
* **Set `max_tokens` to `4096`–`8192` for reasoning models**: Reasoning tokens count toward `max_tokens`. Even `hy4-flash-free` spends roughly 230 reasoning tokens on a one-sentence reply, so reasoning models need `max_tokens` of at least `2000`.
* **Keep `max_tokens` below `32000` on small balances**: Oversized caps can trigger `402 insufficient_credits` during BeatAPI's balance pre-check; see [402 error from oversized max_tokens](/faq/roleplay-max-tokens-402).

## Related

* [Text timeouts and safe retries](/faq/model-text-timeout)
* [Reasoning `<think>` cut-offs & loops](/faq/roleplay-thinking-tags-cutoff)
* [Back to AI Models questions](/faq/models)