EN ▾
Get API key

Best LLM for Roleplay: What to Look For and Connect

The best LLM for roleplay is one that stays in character, remembers a long scene and does not break the story with a refusal. This article lists the criteria, then shows how to connect an uncensored API to SillyTavern or your own script.

Updated

Theatrical masks on a lit stage with floating chat bubbles, representing an LLM roleplay session

Key points

  • Judge a roleplay model on refusals, context length, character consistency and sampling control, not on leaderboard scores.
  • The 100,000-token window holds a long session, and a 60-turn chat costs about $0.13 at $0.15 and $0.50 per 1M tokens.
  • Connect through any OpenAI-compatible client: set the base URL, key and model name uncensored.
  • Use it for fiction, roleplay and companion apps for lawful adult use. Content involving minors is never allowed.

What a roleplay model has to do well

No single list ranks models for every writer, so decide by the behaviours that ruin a session. There are four.

  1. It does not refuse mid-scene. A story that turns dark, tense or emotionally heavy should continue. A model that stops to lecture, or replaces the scene with a summary, ends the immersion. Models tuned to answer without content refusals avoid this for lawful adult fiction.
  2. It remembers. Characters, locations, injuries and promises from forty turns ago should still be in play. That depends on context length and on how you build the prompt.
  3. It keeps the voice. A gruff innkeeper should not turn into a polite assistant after ten messages.
  4. You can steer it. Temperature, top_p, stop sequences, seed and the repetition penalties should reach the model, so you can tune creativity and kill loops.

Everything else, such as raw speed or a long feature list, matters less than these four once you have been in a session for an hour.

How this API measures up

This service gives you one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. The model ID is uncensored. It is not the official API of any large vendor and not a router across models, so you get one consistent behaviour rather than a menu.

Roleplay needWhat you get
RefusalsTuned to answer without content refusals for lawful adult use
Memory100,000-token context, prompt plus completion
Samplingtemperature, top_p, stop, seed and penalties are passed through
Live feelStreaming over SSE with stream: true
FormatOpenAI-compatible POST /v1/chat/completions

One honest limit: it is a single model. If you like switching between many different models to compare prose styles, a service that offers a catalog suits you better. If you want one dependable setup without filters, this fits. It is text only, so there is no image or voice generation. The hard rule is that sexual content involving minors is not allowed, and that applies to every character and scenario.

Connect it to SillyTavern

SillyTavern lets you add an OpenAI-compatible endpoint, which is all you need here. The menu names change between versions, so treat these steps as a guide.

  1. Create an account and an API key.
  2. In SillyTavern open the API connections panel and choose Chat Completion as the API type.
  3. Pick the custom OpenAI-compatible source.
  4. Set the endpoint URL to https://api.anonymousllmapi.com/v1.
  5. Paste your key and set the model to uncensored.
  6. Press connect, then send a short test message.

If the connection check fails, call the API yourself to separate a key problem from a client problem:

curl https://api.anonymousllmapi.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

curl https://api.anonymousllmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Say hello in character as a ship captain."}]}'

Tune two settings first: a temperature around the middle of the range for lively prose, and a modest repetition penalty if the character starts repeating phrases. Raise the context size in your frontend to use more of the 100,000-token window, but keep an eye on cost, covered below.

Connect it from your own code

For a custom bot or a companion app, the OpenAI Python SDK is enough. This example keeps a character sheet in the system message, streams the reply and appends both sides to the history.

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.anonymousllmapi.com/v1", api_key=os.environ["API_KEY"])

history = [{"role": "system", "content":
    "You are Mara, a sarcastic ship captain in an adult fantasy story. "
    "Stay in character. Write in third person, two short paragraphs per turn."}]

while True:
    user = input("> ")
    history.append({"role": "user", "content": user})
    stream = client.chat.completions.create(
        model="uncensored", messages=history, stream=True,
        temperature=0.9, top_p=0.95, frequency_penalty=0.3)
    reply = ""
    for chunk in stream:
        if chunk.choices and chunk.choices[0].delta.content:
            piece = chunk.choices[0].delta.content
            reply += piece
            print(piece, end="", flush=True)
    print()
    history.append({"role": "assistant", "content": reply})

The same base URL and key work in Node, in curl and in any app with a custom OpenAI endpoint field. The quickstart covers the basics, and the page on a private LLM API explains how the service treats your data. Prompts are not used for training.

What a long session costs

Roleplay is cheap per message but repeats history, so the bill grows with session length. Say a character sheet is 1,500 tokens and each turn adds 400 tokens (100 from you, 300 from the model). A 60-turn session works out like this:

  • Input at turn k is 1,500 + 400 × (k − 1) tokens. Summed over 60 turns: 1,500 × 60 + 400 × 1,770 = 90,000 + 708,000 = 798,000 tokens.
  • Output: 60 × 300 = 18,000 tokens.
  • Cost: 798,000 × $0.15 / 1M = $0.1197, plus 18,000 × $0.50 / 1M = $0.009. Total about $0.13.

By turn 60 the context is 1,500 + 400 × 59 = 25,100 tokens, so you are nowhere near the 100,000 limit. Pricing is pay as you go from prepaid credit, with no subscription, and failed or refused requests are not charged. Top-ups run from $20 to $500 in whole amounts, paid by crypto (USDT on TRC20, USDC on Base), with a bonus of 5% from $50, 10% from $100 and 15% from $200. Full rates are on the pricing page.

Common problems and quick fixes

The character drifts into an assistant voice

Add two or three lines of example dialogue to the system message and state the voice plainly: short sentences, no explanations, no summaries of the scene. Examples teach style faster than adjectives.

Replies repeat the same phrases

Raise frequency_penalty a little, or presence_penalty if whole topics keep returning. Change one value at a time, and set seed while testing so you can compare runs fairly.

The model writes your character's actions

Say in the system message that it must never speak or act for the user's character, and add a stop sequence such as the user's name followed by a colon.

Replies are too long or too short

Ask for a length in the prompt ("two short paragraphs") rather than relying on max_tokens, which cuts text off mid-sentence. Use max_tokens only as a safety cap.

Group scenes get muddled

List every character with one line each at the top of the system prompt and tell the model to label speakers. A pinned cast list costs a few hundred tokens and stops most mix-ups.

Keeping long stories coherent

Context length helps, but good prompt habits matter as much as the model.

  • Put the rules in the system message, not in the first user turn, so they never scroll out of a trimmed history.
  • Keep a short story-so-far note. Every 20 turns, ask the model for a summary of events and relationships, then replace the oldest turns with it.
  • Pin facts that must not drift, such as names, ages and a map of who is where, in a small block at the top.
  • Use stop sequences so the model does not write the other character's lines for you.
  • Handle limits. The trial key allows 2 concurrent requests and 60 requests per minute, a full key 8 and 300. A 429 with code rate_limited or concurrency means wait and retry; a streamed reply holds its slot until it ends.

New accounts can claim $0.50 of trial credit with one click on the key page, which is enough for a first test session. It lasts 7 days and needs no payment.

Questions and answers

Is there a single top model for roleplay?

It depends on your taste, but the traits that matter are no mid-scene refusals, long memory, a steady character voice and sampling control. Test a model with your own characters before committing.

Can I use this with SillyTavern?

Yes. Add it as an OpenAI-compatible chat completion endpoint with your base URL, key and the model name uncensored.

What is not allowed?

Sexual content involving minors is blocked as a hard limit. The service is for lawful adult use only.

How much context can a character chat use?

Up to 100,000 tokens for the prompt and the reply together, which is enough for hundreds of turns of a typical chat.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.