What a roleplay chat needs
A roleplay text based chat looks simple from the outside: a person types, a character replies. Underneath, the model remembers nothing between requests. Every turn you resend the instructions and the conversation so far, and the model continues from there. Most quality problems in these apps come from what you put in that payload and how you trim it as it grows.
The standard parts are these:
- A system prompt that defines the character, the setting and the style of reply.
- A message list alternating user and assistant turns.
- Streaming, so text appears as it is written instead of after a long wait.
- A trimming rule that drops or summarises old turns before the window fills.
The API behind this site is OpenAI-compatible, serving one open-weight model tuned to answer without content refusals for lawful adult use. For fiction that means the model plays dark, tense or mature scenes as a writer would, instead of stopping to lecture. It is text only and runs under the model ID uncensored.
Write the character prompt first
The prompt does more for believability than any setting. A good one is short, concrete and written as direction, not as a list of adjectives.
Give the character a voice, not a label
Compare "Captain Ines is brave and funny" with "Captain Ines answers questions with a joke first and the real answer second. She never swears in front of her crew. She is tired and hides it." The second gives the model behaviour to imitate.
State the format once
Say how replies should look: first person or third, how long, whether actions go in asterisks. Two sentences are enough. Then give one short example exchange. Models copy examples closely, so keep the example the way you want every reply to read.
Set the boundaries you want
If your story needs the character to stay in the scene, say so. If you want the model to stop and ask when the user steers somewhere the scene cannot go, say that too. One boundary is not yours to set: the service blocks sexual content involving minors, always, and no character setup changes that.
Keep facts out of the prose
Names, places and relationships belong in a compact list at the end of the system prompt. When a scene runs long you can edit that list as the story changes, without rewriting the whole prompt.
A working chat loop in Python
This script keeps a history, streams replies and trims old turns. It uses the standard OpenAI SDK. First get a key, then install the SDK with pip install openai.
from openai import OpenAI
client = OpenAI(
base_url="https://api.nsfwwan.top/v1",
api_key="YOUR_KEY",
)
SYSTEM = (
"You are Captain Ines, commander of a worn-out cargo ship. "
"Answer with a joke first and the real answer second. "
"Write in first person, two short paragraphs at most. "
"Facts: ship = Marigold, crew = 6, destination = Port Veyra."
)
history = []
MAX_TURNS = 20 # keep the last 20 user/assistant pairs
def reply(user_text):
history.append({"role": "user", "content": user_text})
messages = [{"role": "system", "content": SYSTEM}] + history[-MAX_TURNS * 2:]
stream = client.chat.completions.create(
model="uncensored",
messages=messages,
temperature=0.9,
max_tokens=400,
stream=True,
)
text = ""
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
piece = chunk.choices[0].delta.content
text += piece
print(piece, end="", flush=True)
print()
history.append({"role": "assistant", "content": text})
while True:
line = input("you> ")
if line.strip() in ("quit", "exit"):
break
reply(line)
Three details are worth understanding. The system message is rebuilt every request and never trimmed, so the character stays fixed. history[-MAX_TURNS * 2:] keeps the latest twenty pairs. And max_tokens is optional on this API, but a cap stops one reply from ballooning when the model gets carried away.
The same request works from the command line, which is useful for debugging:
curl https://api.nsfwwan.top/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","stream":true,"messages":[{"role":"user","content":"Hello, Captain."}]}'
More options, including tool calling and JSON mode, are in the docs.
Keeping a long story coherent
Trimming by turn count is the easy method and it loses things. If the user mentioned a locked cabin in turn three, a twenty-turn window forgets it by turn thirty. Three fixes work well, and you can combine them.
- Rolling summary. Every ten turns, ask the model to summarise the story so far in about 200 words, using a separate non-streamed request. Put that summary into the system message and drop the turns it covers.
- Pinned facts. Keep the compact fact list from the prompt up to date. When the story changes who holds the key, change the list.
- Token-based trimming. Count tokens roughly instead of turns. A simple rule is that one token is about four characters of English. Drop the oldest turns until the history fits a budget of your choice.
The window is 100,000 tokens for prompt plus reply, so many stories never need trimming at all. The cost of not trimming is the next section.
What a session costs
Price is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Because the history is resent each turn, input grows as the chat goes on.
Assume an 800 token system prompt, 100 token user messages and 250 token replies, with no trimming, over 50 turns.
- Turn 1 sends 900 input tokens (800 + 100).
- Each later turn adds 350 tokens of history (100 + 250).
- Total input over 50 turns: 50 x 900 + 350 x (0 + 1 + ... + 49) = 45,000 + 350 x 1,225 = 473,750 tokens.
- Total output: 50 x 250 = 12,500 tokens.
Input cost: 473,750 / 1,000,000 x $0.15 = $0.0710625. Output cost: 12,500 / 1,000,000 x $0.50 = $0.00625. The session total is about $0.077.
That is under eight cents for fifty turns, and the quadratic growth is why a very long unbroken chat costs more per turn than a short one. With the twenty-pair window from the script, history stops growing after turn 20 and each turn costs roughly the same from then on.
Credit is prepaid, never expires, and failed or refused requests are not charged. Top-ups are any whole amount from $20 to $500, with a +5% bonus from $50, +10% from $100 and +15% from $200. Payment on this site is crypto only: USDT on TRC20 or USDC on Base. See pricing.
Common roleplay problems and fixes
The model speaks for the user
This is the most frequent complaint. Add one plain line to the system prompt: write only the character's words and actions, and never decide what the user says, thinks or does. Stating the rule positively works better than a long list of prohibitions.
Replies get longer every turn
Models copy the length of their own earlier replies. Cap output with max_tokens, ask for a length in the prompt, and keep the example exchange short. Trimming the first long replies out of the history also helps.
The character repeats phrases
Raise frequency_penalty or presence_penalty a little, for instance 0.3 to 0.6. These are passed through to the model. Change one value at a time. While testing, set seed so you can compare two prompt versions on equal terms.
More than one character
For group scenes, write one system prompt with a narrator voice and a short block per character, and say who speaks in each reply. Separate requests per character are easier to control but cost more, because each one resends the shared history.
The mood is too tame or too wild
Temperature sets the spread. Around 0.7 gives steady, predictable lines. Above 1.0 you start to see odd word choices. Tune it per scene type if your app allows, and keep it lower for rules-heavy games.
Limits and errors to handle
| Key type | Concurrent requests | Requests per minute |
|---|---|---|
| Full key | 8 | 300 |
| Trial key | 2 | 60 |
A streamed reply keeps its concurrency slot until the last chunk arrives. If your app serves several users, a 429 with error code concurrency means too many replies are in flight at once; queue the next one. A 429 with code rate_limited means you exceeded the per-minute count. If a 429 carries Retry-After: 5, the service is briefly overloaded, so wait five seconds and try again.
A small retry wrapper is enough:
import time
from openai import RateLimitError
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwwan.top/v1", api_key="YOUR_KEY")
def with_retry(call, tries=4):
for attempt in range(tries):
try:
return call()
except RateLimitError:
time.sleep(5 * (attempt + 1))
raise RuntimeError("still rate limited")
result = with_retry(lambda: client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Continue the scene."}],
))
The request body is capped at 8 MB, which a text chat will not reach. New accounts can try all of this on the trial: $0.50 of credit claimed with one click on the key page, valid for 7 days, no payment details, one per person. Prompts are not used for training.
