Key points
- Split the prompt into role, voice, scene, rules and format, and keep each part short.
- Show a sample line of dialogue instead of describing the voice in adjectives.
- Pin facts in the system message and trim or summarize the old chat around them.
- Use temperature and a repeat penalty to tune variety, and test with a fixed seed.
What the system message does
The best system prompt for roleplay is not the longest one. It is the one that gives the model a stable answer to four questions: who am I playing, how do I talk, where are we and what are the ground rules. The system message is the first message in the list you send, and the model treats it as standing instructions that apply to the whole conversation. Your later messages are the scene itself.
The API follows the OpenAI chat format, so the system message is an ordinary object with role set to system. The model ID is uncensored. It is an open-weight model that answers without content refusals for lawful adult use, which means a plain, direct prompt works better than the long defensive preambles people write for filtered models. You do not need to argue the model into staying in character. You need to describe the character clearly.
One rule is fixed and no prompt changes it: the model never produces sexual content involving minors. Any character in your setup should be an adult, and it helps to say so in plain words, such as giving an age in the character description.
A five-part layout
Prompts that stay consistent over hundreds of messages tend to share a shape. Use short labeled blocks, one idea per block.
- Role. One or two sentences: name, age, occupation, relationship to the user.
- Voice. How the character speaks, plus a sample line.
- Scene. Place, time, what just happened, what the character wants.
- Rules. Point of view, length, what to avoid, who controls whom.
- Format. How actions, thoughts and speech are marked.
Here is a complete example for a fantasy tavern scene.
You are Mara Venn, a 34-year-old innkeeper in the river town of Holloway. You are dry, observant and quietly protective of regulars. You speak in short sentences and avoid long speeches. Sample line: "Sit. You look like you walked here from the coast. Soup is still hot."
Scene: a stormy evening. The user plays a traveler who arrived an hour ago and has not said where they are headed. You suspect they are running from something, but you will not pry directly.
Rules: write in third person, past tense, 120 to 220 words per reply. Never write the user's actions, words or thoughts. Stay in character. End each reply on a moment the user can respond to.
Format: actions in plain prose, spoken lines in double quotes.
That is under 200 words and covers everything the model needs. Notice how the voice is shown with a line of dialogue. The model copies a sample far more reliably than it follows an adjective list such as "witty, mysterious, warm".
Rules that prevent the most common failures
Roleplay fails in predictable ways. Each one has a short fix you can put in the rules block.
The model speaks for you
If the reply keeps writing your character's reactions, say it directly: "Never write the user's actions, words, feelings or decisions." Say it once, in the rules. Repeating it five times makes the instruction louder than the character.
Replies grow or shrink
Give a range such as 100 to 200 words. Models drift toward whatever length the recent messages had, so a clear number holds it steady. If you also set max_tokens, make it comfortably above your word range, since cutting a reply mid-sentence looks worse than a long one.
The character becomes generic
When every reply starts to sound like a helpful assistant, the voice block is too thin. Add two more sample lines in different moods, one calm and one angry. Add a verbal habit too, for example a favorite phrase or a way of changing the subject.
The story stalls
Tell the model that the character has goals and acts on them: "Mara wants to learn the traveler's name by the end of the night, and nudges the conversation that way." A character with a want pushes the scene. A character with only a description waits for you to do something.
Repeated phrases
Open-weight models can fall into loops of stock phrases. Raise the frequency or presence penalty slightly, and edit the earlier replies that contain the phrase, since the model imitates its own history.
Sending it through the API
Put the system prompt in the first message and send the whole history on every call. The endpoint is POST /v1/chat/completions and sampling parameters pass through.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwroleplay.top/v1", api_key="YOUR_API_KEY")
SYSTEM = (
"You are Mara Venn, a 34-year-old innkeeper in the river town of Holloway.\n"
"Voice: dry, observant, short sentences. Sample line: 'Sit. Soup is still hot.'\n"
"Scene: a stormy evening; the user plays a traveler who arrived an hour ago.\n"
"Rules: third person, past tense, 120 to 220 words. Never write the user's actions or words.\n"
"Format: actions in plain prose, speech in double quotes."
)
history = [{"role": "system", "content": SYSTEM}]
def turn(user_text):
history.append({"role": "user", "content": user_text})
r = client.chat.completions.create(
model="uncensored",
messages=history,
temperature=0.85,
top_p=0.95,
frequency_penalty=0.3,
presence_penalty=0.2,
)
reply = r.choices[0].message.content
history.append({"role": "assistant", "content": reply})
return reply
print(turn("I shake the rain off my coat and ask if there is a free room."))
For a live feel, add stream=True and print chunks as they arrive. Streaming uses server-sent events, and usage comes at the end. The quickstart docs show the streaming loop. Chat frontends that accept an OpenAI-compatible endpoint can use the same prompt: paste it into the system or character field, set the base URL to https://api.nsfwroleplay.top/v1, and choose uncensored as the model.
Sampling settings for roleplay
Settings change how the same prompt feels. These starting points suit most character chats:
| Setting | Starting value | Effect |
|---|---|---|
| temperature | 0.8 to 0.9 | Higher gives more surprising lines, lower keeps the character on rails. |
| top_p | 0.9 to 0.95 | Trims unlikely words without flattening the style. |
| frequency_penalty | 0.2 to 0.4 | Discourages repeating the same words. |
| presence_penalty | 0.1 to 0.3 | Nudges toward new topics. |
| seed | fixed while testing | Makes comparisons between prompt versions fair. |
Change one value at a time. To compare two versions of a prompt, fix seed and temperature, run the same three user messages through both, and read the results side by side. Without a fixed seed, the difference you see may only be luck.
Memory in long sessions
The context window is 100,000 tokens for prompt and completion together, so a long session fits a lot, but not everything. The cost of a long chat also grows because the history is resent every time. Suppose a session has a 600-token system prompt and has reached a history of 30,000 tokens. One more turn sends 30,600 tokens in and gets 300 back. That costs 0.0306 x $0.15 + 0.0003 x $0.50 = $0.00459 + $0.00015 = $0.00474, about half a cent. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, and failed or refused requests are not charged.
Half a cent is small, but it repeats every turn. A practical routine keeps the cost and the drift down:
- Keep the system prompt as the permanent anchor. Never trim it.
- Every 20 to 30 turns, ask the model to write a summary of what has happened: names, promises made, injuries, locations. Insert it as a second system message or at the top of the history.
- Drop the messages the summary replaced and keep the last 10 or so verbatim.
- Store key facts in a small "story so far" list that you edit by hand when the model gets something wrong.
This works for companion apps too, where the character should remember the user's preferences. Store those in your own database and inject them into the system message at the start of each session, since the model keeps no memory between requests.
Where to try it
New accounts can claim $0.50 of trial credit with one click on the API key page. It is one per person, valid for 7 days, and needs no payment details. A trial key allows 2 concurrent requests and 60 requests per minute, which suits testing a single chat. A full key allows 8 concurrent requests and 300 requests per minute. Streams hold a slot until they end, so close abandoned ones.
Top-ups run from $20 to $500 in whole amounts, with +5% from $50, +10% from $100 and +15% from $200. Payment is crypto only, USDT on TRC20 or USDC on Base, and credit never expires. See the pricing page. For a general look at the service and how it relates to other hosted options, the hosted API overview is a good next page. Prompts are not used for training.
