Detailed Roleplay Response Software With an API
Detailed roleplay response software needs three things from its model: room to remember a long story, replies that arrive as they are written, and no sudden refusals in the middle of a scene. This guide shows how to build that on an OpenAI-compatible API.

Key points
- A 100,000-token context window lets a story carry tens of thousands of words of history.
- Streaming over SSE shows text as it is generated, so long replies feel fast.
- Detail comes mostly from the system prompt and the history you send, not from a single setting.
- The service is for lawful adult fiction; sexual content involving minors is never allowed.
What makes a roleplay reply detailed
If you are building detailed roleplay response software, the model is only one ingredient. Detail comes from what you put in front of it. A model that gets a two-line prompt and no history will write a generic reply, whatever its quality. The same model, given a clear scene description, a character sheet, the last twenty exchanges and a note about style, will write something specific.
This API gives you the pieces: a 100,000-token context window shared between your prompt and the completion, streaming over SSE, and a model tuned to answer without content refusals for lawful adult use. The ID is uncensored and the endpoint is POST /v1/chat/completions. Everything else in this article is about how to use those pieces well.
One rule applies to every project here: no sexual content involving minors, ever. Build your characters and scenarios accordingly, and keep adult fiction clearly adult.
Structure the prompt in layers
Send the context in a fixed order so the model always finds things in the same place. A layout that works well:
- System message: the rules of the roleplay. Who the model plays, the setting, tone, point of view, tense, and the length you expect.
- Character and world notes: short bullet facts about each character, relationships and open plot threads. Put them in the system message or in a second system-style block at the top.
- Summary of older events: a paragraph or two covering what happened before the recent turns.
- Recent turns: the last 10 to 30 messages, verbatim.
- The new user message.
Be specific about form. Instead of "write detailed replies", say "write 3 to 5 paragraphs in third person past tense, include what the character sees, hears and does, and stop before deciding anything for the user's character." The last clause matters. Without it, models tend to speak for the player.
Use the context window for memory, not for padding
A window of 100,000 tokens is large. Rough English prose runs near 0.75 words per token, so the window holds on the order of 70,000 words, prompt and reply combined. A long campaign can sit in it for a good while without any trimming.
That does not mean you should always fill it. You pay for every input token on every turn, at $0.15 per 1M. Take a story with 6,000 tokens of history and a 400-token reply: input costs 6,000 times 0.15 divided by 1,000,000, which is $0.0009, output costs 400 times 0.50 divided by 1,000,000, which is $0.0002, so a turn costs $0.0011. A thousand turns come to $1.10. If you sent the full 100,000 tokens every turn, the same turn would cost $0.015 for input plus $0.0002 for output, about $0.0152. That is still small, but it is nearly fourteen times more.
A sensible policy is to keep recent turns verbatim, summarize everything older once the history crosses a threshold, and store the summary next to the session. Re-summarize when the summary and the recent turns together pass, say, 30,000 tokens. The details of rates are on the pricing page.
A streaming chat loop in Python
Streaming matters more for roleplay than for most apps. A detailed reply of 600 tokens can take a while to finish, and a user staring at a blank box will assume it has stalled. With stream: true the first words appear almost immediately and the rest follow.
from openai import OpenAI
client = OpenAI(
base_url="https://api.nsfwroleplay.cc/v1",
api_key="YOUR_KEY",
)
SYSTEM = (
"You are the narrator and non-player characters in an adult fantasy story. "
"Write 3 to 5 paragraphs in third person, past tense. Describe what the scene "
"looks, sounds and feels like. Never decide actions for the player's character."
)
history = [{"role": "system", "content": SYSTEM}]
def turn(user_text):
history.append({"role": "user", "content": user_text})
stream = client.chat.completions.create(
model="uncensored",
messages=history,
stream=True,
temperature=0.9,
top_p=0.95,
max_tokens=900,
)
parts = []
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
piece = chunk.choices[0].delta.content
parts.append(piece)
print(piece, end="", flush=True)
print()
history.append({"role": "assistant", "content": "".join(parts)})
turn("The gate creaks open. I step into the courtyard, lantern raised.")
Two details are easy to miss. First, store the assistant reply in the history after the stream ends, or the next turn will have no memory of it. Second, guard the chunk access as shown, because the final chunk, which carries usage, may have no choices. If you want the usage numbers, read them from that last chunk.
Settings that change the writing
The sampling parameters are passed through to the model, so they behave as you would expect. A starting point for narrative text:
| Setting | Starting value | Effect |
|---|---|---|
temperature | 0.8 to 1.0 | Higher gives more varied wording and more risk of drifting off script. |
top_p | 0.9 to 0.95 | Cuts the unlikely tail of word choices. |
frequency_penalty | 0.2 to 0.5 | Reduces repeated phrases within a reply. |
presence_penalty | 0.0 to 0.3 | Nudges the model toward new topics and details. |
max_tokens | 600 to 1,200 | Caps length. Optional; leave it off if you want the model to finish naturally. |
stop | for example a speaker tag | Ends the reply before the model starts writing the user's lines. |
Change one value at a time and keep the seed fixed while comparing, so the difference you see comes from the setting and not from chance. Tune per genre. A noir mystery likes lower temperature and tighter prose. A dream-like fantasy can take more.
Concurrency, rate limits and multi-user apps
If your software serves more than one player, plan around the limits. A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 concurrent requests and 60 per minute. A streamed request holds its slot until the stream ends, so eight players reading eight long streams at once will fill the slots, and the ninth request will get HTTP 429 with the error code concurrency. If you exceed the per-minute count, the code is rate_limited.
The fix is a small queue in your own backend. Cap in-flight requests at 8, hold the rest briefly, and retry when you see a 429 with a Retry-After: 5 header, which the API sends on temporary overload. Do not retry in a tight loop. The response headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency tell you the limits your key is running under, and X-Request-Id helps when you need to trace a single call. For other errors, see the troubleshooting page.
Pitfalls and how to fix them
- Replies get shorter as the story grows. The model copies the length of the recent turns. Keep an early long reply as an example, or restate the length in the system message every few turns.
- The model speaks for the player. Add an explicit rule and a
stopsequence that matches your player's speaker label. - Characters forget facts. Facts that fell out of the verbatim window need to live in the summary or the character notes. Update the notes when something important changes.
- Cost climbs over a long session. Summarize older turns instead of sending them forever.
- Stalled streams. Set a client timeout, and when a stream drops, start a new request with the history you have rather than waiting.
When you are ready, the quickstart docs show the first request, and new users can claim $0.50 of trial credit with one click on the API key page. Top-ups run from $20 to $500 in crypto (USDT on TRC20 or USDC on Base), with bonuses from $50 up.
More guides
Questions and answers
How long can a roleplay session get before the model forgets?
The window is 100,000 tokens for prompt plus reply, which is roughly 70,000 words. Past that, you need to summarize older turns and keep the summary in the prompt.
Does streaming cost extra?
No. You pay the same per-token rates, $0.15 per 1M input and $0.50 per 1M output. A streamed request does hold a concurrency slot until it finishes.
Can I use this API with an existing roleplay front end?
Any client that lets you set an OpenAI-compatible endpoint should work. Enter the base URL, your key and the model ID uncensored.
Are there content limits?
The model is tuned to answer without content refusals for lawful adult use. Sexual content involving minors is not allowed.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.