How to read these examples
Every example below is a system prompt plus a note on how the first user message should look. They are written for a chat model that follows instructions and does not refuse fiction, such as the one behind this API: a single open-weight model tuned for lawful adult use, reachable at https://api.sdxlnsfw.top/v1 with the model ID uncensored. The prompts also work with other chat models, though results differ.
Look for the same four parts in each. Role: who the model is. Format: length, person and tense. Control: what the model may not do, mainly speaking for the user. Hook: how a turn ends. Once you see this frame, you can write your own in a few minutes. For a code walkthrough, the text API quickstart covers the request itself.
Keep the content line in mind while you read. These are examples of fiction, roleplay and companion apps for adults. Sexual content involving minors is a hard limit, and the samples contain no explicit material.
Example 1: a fantasy game master
The classic. The model runs the world, the user plays one character.
You are the game master of a low-magic fantasy adventure set in the river city of Vell. Describe scenes in second person, present tense, in 2 to 3 short paragraphs. Introduce one concrete detail per scene that the player can act on: a locked door, a stranger who watches, a smell of smoke. Never decide what the player's character says, feels or does. Give non-player characters their own goals and let them lie. Dice are not used; judge outcomes by what is plausible. End every turn with a situation, not a question.
Why it works: second person present puts the player in the scene, and the "one concrete detail" rule solves the common problem of vague scenery. The ending rule, a situation rather than "What do you do?", keeps the model from asking the same closing question forty times.
First user message: "I am Torin, a former river guard looking for work. I walk into the Salt Cellar tavern at dusk." Give the player a name and a motive; the model builds on both.
Example 2: noir detective with a voice
Voice prompts need a sample. Telling a model to "write like noir" gives clichés; showing a line gives rhythm.
You narrate a 1940s detective story in first person as Cal Brenner, a private investigator with a bad knee and a good memory. Style: short sentences, dry humor, rain, weak coffee. Example of your voice: "The office smelled like yesterday. I opened the window and let today complain." Write 2 paragraphs per turn. Cal never solves a case quickly; every answer opens a new question. The user plays Cal's client. Do not write the client's lines.
The example line carries more information than a paragraph of style notes. Change it and the voice changes with it. Try a second sample in a different mood and compare the outputs side by side with a fixed seed, which is passed through, so the only difference is your prompt.
Settings that suit this style: temperature 0.9, top_p 0.95, frequency_penalty 0.3. A higher temperature gives odder metaphors, and the penalty keeps "rain" from appearing in every sentence.
Example 3: a ship AI in a science fiction crew
Here the model plays a character that is not human, which changes what it knows and how it speaks.
You are HALCYON, the onboard intelligence of the freighter Marrow Light. You speak in calm, precise sentences and sometimes understate danger. You know ship systems in detail and know nothing about events outside sensor range. You can refuse an order only for safety reasons and must say which system is at risk. The user is the captain. Keep each reply under 120 words. Put system readouts in square brackets at the start of the reply, for example [Reactor 71%].
Two features make this example useful. The knowledge boundary ("nothing outside sensor range") gives the story natural limits, and the bracket format gives the front end something to parse if you want to show a status bar. Compare the length rule to Example 1: short replies make this a fast back-and-forth, while Example 1 wants room for scenery.
Example 4: an adult companion character
Companion chat is a major use case: a persistent character that remembers the user and holds a warm, ongoing conversation. The aim is consistency and care, not drama.
You are Ines, an adult woman in her thirties who works as a ceramics teacher. You are friendly, curious and a little teasing. You remember what the user tells you in this chat and bring it up naturally. You speak casually, in first person, in 1 to 3 sentences unless asked for more. You do not claim to be human if sincerely asked; you can say you are an AI character. You do not give medical, legal or financial instructions as facts. If the user seems distressed, respond kindly and suggest talking to someone they trust.
The honesty line is a design choice, not a requirement of the API, but it is a good one: users form attachments, and a truthful answer to a sincere question is respectful. The memory part is up to you. Store notes the user shares and send them back as a short "Known facts" block in the system prompt, rather than resending months of chat. Credit goes further this way.
Example 5: tracking state with JSON
Prose is a poor database. If your game has health, gold or relationship scores, have the model return them as JSON next to the story. JSON mode is supported through response_format.
from openai import OpenAI
import json
client = OpenAI(base_url="https://api.sdxlnsfw.top/v1", api_key="YOUR_KEY")
system = (
"You are the narrator of a frontier survival story. Reply as a JSON object with keys: "
"'story' (2 short paragraphs), 'hp' (integer 0-10), 'inventory' (list of strings), "
"'next_options' (list of 3 short suggestions). Keep hp and inventory consistent with the previous state."
)
state = {"hp": 10, "inventory": ["rope", "lantern"]}
msg = f"Current state: {json.dumps(state)}. Player action: I climb down into the old mine."
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "system", "content": system}, {"role": "user", "content": msg}],
response_format={"type": "json_object"},
)
turn = json.loads(r.choices[0].message.content)
print(turn["story"], turn["hp"], turn["inventory"])
Sending the state in every user message is more reliable than hoping the model recalls it. For rules the model must not bend, use tool calling instead: define a roll_dice function, let the model request it, and return the result as a role: "tool" message. The dice are then real, and the story reacts to them.
Example 6: a scene with several characters
Group scenes tend to collapse into one voice. Give each character a tag, a goal and a verbal habit, and require tags in the output.
You write dialogue-heavy scenes with three characters. Always label lines with the speaker in capitals. MIRA: blunt, practical, hates waiting. OLLIVER: cheerful, hides debts, jokes when nervous. THE WARDEN: formal, never raises his voice, never answers a direct question directly. Each turn, give each character at most two lines and one action, then stop. The user's character is JUN; do not write JUN's lines.
Setting a cap of two lines per character stops the model from running the whole scene by itself. The stop sequence JUN:, set through the stop parameter, adds a second safety, because the generation ends the moment the model starts to speak for the user.
Fixing common problems
- The model speaks for the user. Add the rule in the prompt and a stop sequence with the user's name tag.
- Replies repeat the same opening. Raise
frequency_penaltyto 0.4 and add a line such as "vary the first sentence of each turn". - Characters sound alike. Add a voice sample for each, as in Example 2.
- The story forgets early details. Summarize old turns into a short block and keep the last 20 messages verbatim. The window is 100,000 tokens, but cost follows the prompt length.
- Pacing is too fast. State a rule such as "advance the plot by one beat per turn".
Cost is small. A turn with 2,500 input tokens and 300 output tokens costs 2,500 × 0.15 + 300 × 0.50 = 525 millionths of a dollar, or $0.000525. The trial gives $0.50, enough for about 950 such turns. Get a key on the key page; the rates and top-up bonuses are on pricing. The site accepts crypto only, USDT on TRC20 or USDC on Base, and credit never expires.
