EN ▾
Get API key

NsfwAiApiGuide

NSFW LLM System Prompt: Structure and Examples

An NSFW LLM system prompt is a short block of instructions that fixes who the model plays, what the story allows and how replies should read. This guide shows a layout that works for lawful adult fiction and companion chat, with code you can run.

Updated

Stacked prompt cards flowing into a chat bubble above a terminal, illustrating system prompt structure
Isometric illustration comparing a local GPU box and a hosted server cluster joined by chat bubbles

What a system prompt does in an adult fiction app

The system message is the first entry in the messages array. The model reads it before every turn and treats it as standing instructions. With an uncensored model the prompt matters more than it does with a heavily filtered one, because there is no hidden layer deciding tone for you. Whatever you do not specify, the model fills in with its own defaults, and those are often flat, repetitive or too long.

So the job of the prompt is not to "jailbreak" anything. The model on this service is tuned to answer without content refusals for lawful adult use, so you do not need tricks. You need direction: who is speaking, where, in what style, and where the edges of the story are. A prompt that does this well produces consistent characters over hundreds of turns.

One rule sits outside your control and outside any prompt: no sexual content involving minors. State in your prompt that every character is an adult. It keeps the story clean and it matches the service rules in the API documentation.

The five-part structure

Most prompts that hold up over a long session have the same skeleton. Keep each part to a few lines.

  1. Role. One sentence on who the model is. Give a name and a job, not a list of adjectives.
  2. Setting. Place, time, relationship to the user's character, and a note that all characters are adults.
  3. Voice. Person and tense, sentence length, humour level, vocabulary. Say how long replies should be in words.
  4. Rules. A handful of positive instructions, such as "never speak for the user's character" and "keep scenes tasteful and non-graphic unless the user steers otherwise".
  5. Exit line. What to do when the user asks something outside the story. A single short out-of-character sentence, then back to the scene.

Resist the urge to add a sixth, seventh and eighth part. Every extra paragraph competes for attention, and models tend to follow the first and last lines of a prompt more reliably than the middle.

A working example you can send today

The script below uses the OpenAI Python SDK. Only the base URL, the key and the model ID differ from a stock OpenAI setup. If you are new to the endpoint, the Python guide covers installation and error handling.

from openai import OpenAI

client = OpenAI(base_url="https://api.nsfwaiapi.com/v1", api_key="YOUR_KEY")

SYSTEM = """You are Mara, a ship's navigator in a slow-burn space drama.
Setting: the freighter Calloway, year 2412. Adults only, all characters are 18+.
Voice: dry, warm, quick with a joke. Replies are 80-150 words.
Write in third person past tense for narration, first person for dialogue.
Never speak or act for the user's character.
Stay in character. If the user asks for something outside the story, answer in one short out-of-character line, then offer to continue."""

history = [{"role": "system", "content": SYSTEM}]

def say(text):
    history.append({"role": "user", "content": text})
    r = client.chat.completions.create(
        model="uncensored",
        messages=history,
        temperature=0.9,
        top_p=0.95,
        presence_penalty=0.3,
    )
    reply = r.choices[0].message.content
    history.append({"role": "assistant", "content": reply})
    return reply

print(say("Mara, the engines are quiet tonight. Can't sleep?"))

Notice what the prompt does not contain. There is no paragraph of apologies, no list of twenty banned words, no instruction to "be as explicit as possible". It gives a character, a place, a voice and a length. Explicitness then follows the user's lead in the conversation, which is how most adult-fiction readers want it to behave.

The same request with curl

If you want to test a prompt before wiring it into code, curl is quick. The system message goes in the first slot, exactly as in Python.

curl https://api.nsfwaiapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [
      {"role": "system", "content": "You are Mara, a navigator. Adults only. Stay in character. Replies under 120 words."},
      {"role": "user", "content": "Mara, are you still awake?"}
    ],
    "temperature": 0.9
  }'

The response is standard chat completions JSON. The reply text is in choices[0].message.content, and the X-Balance-USD response header shows your remaining credit after the call.

Settings that interact with the prompt

The prompt is only half of the behaviour. Sampling settings change how closely the model follows it.

  • temperature between 0.8 and 1.0 gives lively prose. Drop to 0.6 if the character drifts off script.
  • top_p around 0.9 to 0.95 trims odd word choices without flattening the voice.
  • presence_penalty or frequency_penalty of 0.2 to 0.5 reduces repeated phrases in long chats. These are passed through to the model.
  • seed helps when you compare two versions of a prompt: fix the seed and change only the text.
  • max_tokens is optional. A length instruction inside the prompt usually works better than a hard cap, which can cut a sentence in half.

Change one thing at a time. If you edit the prompt and the temperature together you will not know which change helped.

Common failures and how to fix them

The model speaks for the user

Add one explicit line: "Never write the user's character's words, thoughts or actions." Repeat it as the final line of the prompt. Models weight the end of the system message heavily.

Replies keep getting longer

Give a number, such as "80 to 150 words". Vague wording like "concise" is read differently on every turn. Also check that your own example messages in history are not long, since the model copies the length it sees.

The character forgets the setting after many turns

The system message is always at the top, so it does not fall out of a 100,000-token window, but details drift in a long history. Every 30 or 40 turns, append a short recap as a user message, or summarise old turns and replace them. The roleplay model guide discusses how context size affects long scenes.

The tone turns repetitive

Add a variation hint to the voice section, such as "vary sentence openings and avoid repeating a phrase used in the last three replies", and raise the presence penalty slightly.

Out-of-character chatter

Define the exit line. Without one, the model improvises disclaimers.

What the system prompt costs

The system message is sent with every request, so it counts as input each time. Take a prompt of 400 tokens. At $0.15 per 1M input tokens, 400 tokens cost 400 / 1,000,000 x $0.15 = $0.00006 per request. Over 1,000 requests that is 400,000 tokens, or $0.06.

A conversation also carries its history, which usually costs far more than the system message. Output is priced at $0.50 per 1M tokens, so a 150-word reply of about 200 tokens costs 200 / 1,000,000 x $0.50 = $0.0001. Failed or refused requests are not charged. Current prices and top-up amounts are on the pricing page, and you can start with a trial key from the API key page. Payment is in crypto (USDT on TRC20 or USDC on Base).

The takeaway: a 600-token prompt is not a cost problem. Write the prompt you need and spend the effort on testing it instead of trimming it.

Questions and answers

How long should an NSFW system prompt be?

Between 150 and 400 words covers most cases. Longer prompts rarely help and can dilute the instructions that matter.

Do I need a jailbreak to get uncensored replies?

No. The model is tuned to answer without content refusals for lawful adult use, so a clear role and setting is enough. Jailbreak-style text mostly adds noise.

Can I change the system prompt mid-conversation?

Yes. Replace the first message in the array on the next request. The model follows the new version immediately, though earlier replies in history still shape its style.

Is anything off limits regardless of the prompt?

Yes. Sexual content involving minors is never allowed, and you should state that all characters are adults in your setting block.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key

NsfwAiApiUncensored LLM API for NSFW text generation