GLM-5.2 for roleplay: setup and settings that work.

Updated 2026-07-16

GLM-5.2 connects to SillyTavern, RisuAI, and any frontend with a custom OpenAI-compatible option: base URL https://api.apisrouter.com/v1, your key, and the model id glm-5.2. This page covers the exact config fields, sampler starting points, context budgeting on the 200K catalog window, and the one GLM-specific behavior, thinking mode, that changes how roleplay replies feel and bill.

Quick answer: three values in any custom-endpoint frontend.

Every roleplay frontend with a custom OpenAI-compatible option needs the same three values: an endpoint, a key, and a model id. For GLM-5.2 through APIsRouter those are https://api.apisrouter.com/v1, your sk-... key, and glm-5.2 typed exactly. Frontends differ only in whether they want the base URL or the full completions path, and in where the model id goes. The same connection serves glm-5.1 and glm-5 at lower rates, plus DeepSeek and Claude ids, so once the endpoint is in, comparing models mid-story is a dropdown change rather than a new setup.

Endpoint:  https://api.apisrouter.com/v1
API key:   sk-...            (from APIsRouter)
Model:     glm-5.2           (typed exactly; glm-5.1 and glm-5 also work)

Why GLM-5.2 turns up in roleplay setups.

GLM-5.2 was built and marketed for coding agents, but the properties that launch story rests on, instruction adherence over long sequences and sustained coherence across a long horizon, are the same properties that keep a character consistent at message three hundred. Z.ai's release notes claim open-source state of the art on long-horizon task benchmarks, and in roleplay terms a long chat is exactly that: a long-horizon task where the instructions are the character card. The tradeoff to know before committing a story to it: GLM-5.2 is a reasoning model. It can spend tokens thinking before it writes, which costs latency between your message and the first visible word, and those reasoning tokens bill as output. For slow-burn, detail-heavy scenes where consistency matters most, that trade often reads as worth it; for rapid back-and-forth chat, a non-reasoning model or a family downshift to glm-5 keeps replies snappier per dollar. Send a few test messages and watch both the reply delay and the completion_tokens count before settling.

SillyTavern setup, field by field.

The one failure that catches most people: SillyTavern appends /chat/completions itself, so pasting the full completions URL produces a doubled path and a 404. The URL stops at /v1. If the dropdown stays empty after Connect, recheck that the source is Custom (OpenAI-compatible) rather than plain OpenAI, and that the key pasted clean without whitespace. Use Chat Completion mode, not Text Completion. GLM-5.2 is a hosted chat model that expects structured role messages; Text Completion exists for local backends, and pointing it at a hosted endpoint produces errors or broken formatting.

  • Open API Connections (the plug icon).
  • Set API to Chat Completion.
  • Set Chat Completion Source to Custom (OpenAI-compatible).
  • Custom Endpoint (Base URL): https://api.apisrouter.com/v1, stopping at /v1 with no trailing path.
  • Custom API Key: your sk-... key.
  • Click Connect; the model dropdown fills from /v1/models. Pick glm-5.2.

RisuAI setup.

In RisuAI, open Settings, go to the API tab, and choose the custom OpenAI-compatible provider rather than a named preset. Fill in the key, the endpoint https://api.apisrouter.com/v1, and type glm-5.2 into the model field, enabling the custom-model option if the id is not in the built-in dropdown; gateway ids rarely are, and without the custom-model field enabled the app quietly keeps whatever built-in model was last selected. Field labels shift slightly across RisuAI's web, desktop, and mobile builds, but the same three values apply everywhere. On the web build specifically, your browser makes the API call directly, so if a correct key and endpoint still produce silence, check the developer console for a CORS error before blaming the config; the desktop build is the usual workaround. Save the provider, open any character, and send one short test message. A reply confirms all three values; anything else narrows to one of them.

Samplers and response length for GLM-5.2 roleplay.

Hosted chat endpoints expose the Chat Completion sampler set: temperature, top P, and the frequency and presence penalties, plus response length and context size. Z.ai's own GLM-5.2 examples use temperatures of 1.0 for open-ended work and 0.6 for precise tasks, which brackets the useful roleplay range: start near 0.9 for prose variety, drop toward 0.7 if the character drifts or contradicts the card, and adjust one setting at a time. Two GLM-specific notes. Response length (max_tokens) needs more headroom than the visible reply suggests, because reasoning tokens spend from the same budget; a cap sized exactly for a 300-token reply can truncate mid-thought. Give it two to three times the target reply length. And keep the penalties low (0 to 0.3): long roleplay histories plus high repetition penalties are how names and recurring phrasing get mangled. For character consistency, the strongest lever is not a sampler at all: keep the character card and system prompt stable, front-load the important facts, and let the model's long-horizon adherence do the work. Rewriting the card mid-story costs more coherence than any temperature change wins back.

Starting values for Chat Completion presets. Adjust one at a time.
SettingStarting pointNote
Temperature0.9Down to 0.7 if the character drifts; Z.ai examples use 0.6-1.0
Top P0.95Leave alone unless output turns incoherent
Frequency / presence penalty0 to 0.3High values corrupt names in long chats
Response length (max_tokens)2-3x target replyReasoning tokens spend from the same budget
Context sizeStart at 32KRaise deliberately; see the context section

Context budgeting on the 200K window.

The glm-5.2 catalog entry on APIsRouter lists a 200K-token context window, which is roughly four hundred messages of ordinary chat history plus a detailed card, far more than most stories need resident at once. The constraint that bites first is cost, not capacity: frontends resend the whole visible context every turn, so a chat allowed to fill 100K tokens bills 100K input tokens per message from then on. The workable pattern is a deliberate context size in the frontend (32K is a generous story window) combined with SillyTavern-style summarization or lorebook entries for older events, so long-running canon survives without paying for its full text every turn. The context-length guide linked below works this math in detail across models.

Pay-as-you-go · transparent per-model pricing

Selected models are priced below official list prices. Exact input, output, cache, and per-request prices are shown for each model.

ModelOfficial PriceOur Price
GLM-5.2$1.14 / $4.00 per M$1.03 / $3.60 per M
GLM-5.1$0.86 / $3.43 per M$0.77 / $3.09 per M
GLM-5$0.57 / $2.57 per M$0.51 / $2.31 per M
DeepSeek V4 Flash$0.14 / $0.28 per M$0.13 / $0.25 per M
Claude Sonnet 4.6$3.00 / $15.00 per M$2.40 / $12.00 per M

Content policy, stated plainly.

GLM-5.2 is subject to Z.ai's usage policies, and requests through APIsRouter are subject to the upstream model's content rules plus the terms of whatever frontend you use; SillyTavern and RisuAI both set their own conditions, and platforms with community content add rules of their own. None of that is unusual, and none of it is worth working around: keep scenarios within each platform's rules and age settings. In practice, community discussion places the Chinese model families as comparatively flexible for fictional scenarios relative to the strictest Western policies, with Claude models holding the most restrictive line on explicit content and the highest ceiling on safe-for-work prose. The policies-compared page linked below covers the landscape factually, provider by provider, and is the right place to check before building a long story on any single model.

FAQ

What settings does SillyTavern need for GLM-5.2?

API: Chat Completion. Source: Custom (OpenAI-compatible). Custom Endpoint: https://api.apisrouter.com/v1, stopping at /v1. Key: your sk-... key. Then Connect and pick glm-5.2 from the dropdown. Pasting the full completions path is the classic mistake; SillyTavern appends /chat/completions itself.

Is GLM-5.2 good for roleplay?

Its strengths map well: long-horizon instruction adherence keeps characters consistent deep into a story, and the family's pricing sits well below Western flagship rates. The tradeoff is reasoning latency and output-billed thinking tokens, so it suits deliberate, detail-heavy scenes better than rapid-fire chat.

Why do GLM-5.2 roleplay replies take longer to start?

GLM-5.2 is a reasoning model and can think before writing. The wait before the first visible word is that reasoning pass, and it bills as output tokens. Streaming makes the wait visible rather than shorter; a family downshift to glm-5 trades some quality for snappier turns.

What temperature works best for GLM-5.2 roleplay?

Start at 0.9 and adjust one step at a time: down toward 0.7 if the character drifts or contradicts the card, up toward 1.0 for more prose variety. Z.ai's own examples bracket the same range, using 1.0 for open-ended output and 0.6 for precision.

How much roleplay history fits in GLM-5.2's context?

The catalog window here is 200K tokens, roughly four hundred ordinary chat messages plus a detailed card. Cost arrives before capacity does, since the full visible context re-bills as input every turn; a 32K working window plus summaries of older events is the economical shape.

Can I switch between GLM-5.2 and other models mid-story?

Yes. The same endpoint and key serve glm-5.1, glm-5, deepseek-v4-flash, and claude-sonnet-4-6, so switching is a model-field change in the frontend. Chat history travels with the frontend, not the model, so nothing about the story is lost in the swap.