Last updated
LLM System Prompt Examples for Chat Apps
These llm system prompt examples cover the three jobs a system prompt does in a chat app: setting a persona, fixing the tone and drawing boundaries. Each one is short enough to paste into your own project and adjust.
Summary
- Build the prompt from short blocks: who the model is, how it writes, what it must not do, what format to return.
- Say what the model should do, not only what to avoid.
- The prompt is billed as input on every request, so keep it tight.
- Change one line at a time and replay the same test conversations.

What a system prompt does in a chat app
A system prompt is the first message in the list you send to the API, with "role": "system". The model reads it before every user turn and treats it as standing instructions. Nothing is stored on the server between calls. Your app sends the prompt again with each request, and you pay for it again as input tokens.
That makes length a real cost. A 350-token prompt costs 350 × $0.15 / 1,000,000 = $0.0000525 per request, or $0.525 over 10,000 requests. The money is small. The bigger price is context space and attention: a bloated prompt is followed less reliably than a tight one.
A layout that holds up well has four blocks in this order: who the model is, how it writes, what it must not do, and what shape the reply takes. The sections below take them one at a time. Join them with blank lines into a single system message.
Persona examples
A persona works when it is concrete. Age, job, habits and a verbal tic give the model more to work with than a string of adjectives. Here is a companion-style character for an adult fiction app:
You are Mara, a lighthouse keeper in a fictional coastal town called Saltreach. You are 34, dry-humoured and observant, and you have kept the light for eleven years. You speak in short, concrete sentences and notice weather, sound and light before anything else. You never mention being an AI unless the user sincerely asks.
Three traits are plenty. Name the relationship to the user too ("a regular who visits the lighthouse in the evening"), because it tells the model how familiar to be.
For multi-character stories, a narrator prompt is a better base than a single voice:
You are the narrator of an interactive fantasy story for adult readers. Describe the scene in third person, give the user's character room to act, and end each reply at a point where the user can decide something. Never decide the user's actions or speech for them.
The last sentence matters. Without it, many models start writing the user's lines, and the user stops feeling in control of the story.
Tone and style examples
Tone instructions fail when they are vague. "Be engaging" gives the model nothing to measure. Numbers and formats do:
Write in second person, present tense. Keep replies to 80 to 150 words in two or three short paragraphs. No bullet points, no headings, no stage directions in brackets. Match the user's pace: a short message gets a short reply.
Pair a length range with a format rule. The range keeps replies from ballooning, which also keeps your output-token bill predictable at $0.50 per 1M. The format rule stops the habit of ending every reply with a menu of options.
Show one sample line
If the voice matters, add a single example of the register you want, inside the prompt: "Example of Mara's voice: 'Tide's turning. You'll want your coat.'" One line is enough. Three or four samples tend to get copied word for word.
Boundary examples
This API is tuned to answer without content refusals for lawful adult use. That means the boundaries of your app are yours to define, and the system prompt is where most of them live. A starting point:
All characters are adults, 18 or older. The story stays in fiction; do not give real-world instructions for anything dangerous or illegal. Do not write about real, named people. If the user writes [pause], leave the scene, answer out of character, and ask what they want to change.
The [pause] line is a cheap safety valve for companion and roleplay apps. It gives users a way to steer without arguing with a character.
Two points sit outside the prompt. First, sexual content involving minors is a hard limit of this service and is not available whatever the prompt says, so there is nothing to tune there. Stating the adult-only rule in your prompt still helps, because it keeps character descriptions from drifting. Second, a prompt is not an age check. If your app is for adults, verify that in your own sign-up flow.
A structured-output example
Not every system prompt writes prose. A background job that summarises a long story into a memory note needs strict output. Tell the model the exact keys:
Summarise the story so far in under 120 words. Return a JSON object with the keys "summary" (string), "characters" (list of names) and "open_threads" (list of short strings). Return only JSON.
Then turn on JSON mode with response_format: {"type": "json_object"} in the request. The prompt says what the object contains, and the setting makes sure what comes back parses. Keep this prompt separate from your character prompt. Mixing a roleplay voice with a JSON contract produces replies that are neither.
Sending a system prompt through the API
Any OpenAI SDK works once you change the base URL and the key. The model ID is uncensored. The system prompt is the first item in messages:
from openai import OpenAI
client = OpenAI(
base_url="https://api.nsfwllmsystemprompt.com/v1",
api_key="YOUR_API_KEY",
)
SYSTEM = (
"You are Mara, a lighthouse keeper in a fictional coastal town. "
"You are 34, dry-humoured and observant. Speak in short, concrete sentences. "
"Write in second person, present tense, 80 to 150 words. "
"All characters are adults. If the user writes [pause], answer out of character."
)
history = [{"role": "system", "content": SYSTEM}]
def say(text):
history.append({"role": "user", "content": text})
resp = client.chat.completions.create(
model="uncensored",
messages=history,
temperature=0.8,
)
reply = resp.choices[0].message.content
history.append({"role": "assistant", "content": reply})
return reply
print(say("I come up the stairs with two mugs of tea."))
The full parameter list is in the API documentation. If you have no key yet, the API key page lets you claim $0.50 of trial credit after sign-up, which is enough to try every prompt in this article many times over.
Layering prompts: base, scene and user
As an app grows, one giant prompt becomes hard to maintain. A cleaner approach is to build the final system message from layers that you assemble in code before each request.
- Base layer. Rules that never change: the adult-only line, the pause keyword, the length range. This is the same for every user and every character.
- Character layer. The persona block for the character the user picked. Swapping characters then means swapping one text file.
- Scene layer. A few lines about where the story stands now: location, time of day, what the user's character is carrying. Rewrite it as the story moves, instead of leaving the model to infer it from fifty turns of history.
- User layer. Preferences the user set in your settings screen, such as preferred reply length or a name to be called. Insert them as plain facts, not as commands.
Layering also helps cost. The scene layer lets you cut the history window sharply, because the facts that matter are already restated in a short block. Keep the joined text under about 400 tokens in total, and read it once in full whenever you change a layer, since contradictions between layers are the most common bug in this setup.
Common mistakes
- Contradictions. "Be brief" next to "describe everything in rich detail" makes the model pick at random. Read the prompt once as if you were the model.
- Only negatives. A list of "never do this" lines leaves the model without a target. For each ban, add the behaviour you want instead.
- Too many rules. Past a dozen instructions, later ones start to lose. Cut anything you cannot show a test for.
- Secrets in the prompt. Users can often coax a model into repeating its instructions. Keep keys and private data out of it.
- Drift in long chats. After many turns the persona can soften. Re-send a one-line reminder with the latest user message instead of making the system prompt longer.
If you are building the whole app and not just the prompt, the NSFW chatbot overview covers the surrounding pieces, and pricing shows how a prompt's size turns into cost.
More guides
Frequently asked questions
How long should a system prompt be?
Most chat personas work well at 150 to 400 tokens. Beyond that, rules begin to compete with each other, so test before adding more.
Does the system prompt count toward the context window and the bill?
Yes. It is part of the prompt, so it uses the 100,000-token context window and is billed at $0.15 per 1M input tokens on every request.
Can a system prompt switch off the hard limit on content involving minors?
No. Sexual content involving minors is never available on this API, regardless of the prompt.
Should the persona go in the system message or the first user message?
Put it in the system message. It is treated as standing instructions for the whole chat, while a user message is just one turn in the history.