EN ▾
Get API key

NSFW LLM Roleplay API: Setup, Settings, Costs

An NSFW LLM roleplay API gives your chat client or companion app a model that does not refuse mature fiction between consenting adult characters. This guide covers the system prompt, client settings, memory over a long session and what a turn costs.

Updated

Theatre stage with glass masks and glowing speech bubbles representing text-based roleplay with an AI model

Key points

  • Point any OpenAI-compatible client at the base URL with the model ID uncensored and your key.
  • A good system prompt sets the setting, the character and the rules, and keeps replies in character.
  • The 100,000-token context is large but not infinite. Summarize old turns to keep cost and drift down.
  • A typical turn costs a fraction of a cent. The model is text only and never allows sexual content involving minors.

What this setup is for

Roleplay is a plain use of a chat model: you describe a character and a scene, the model answers in character, and you keep trading turns. Interactive fiction, tabletop-style adventures, companion apps and writers testing dialogue all work this way. The usual friction with hosted models is refusals. A model tuned for general assistant use will often decline or soften mature themes, even when the user is an adult writing fiction.

This service runs one open-weight model, uncensored, operated by an independent provider and tuned to answer without content refusals for lawful adult use. It is an OpenAI-compatible endpoint at https://api.nsfwllm.top/v1, so any client that lets you set a custom base URL can use it. It is text only: no images, no voice, no embeddings. If your companion app needs a voice or avatar, that comes from other services.

One rule is fixed and cannot be negotiated: no sexual content involving minors. Apps built on this API should state the same rule in their own terms and enforce an adult age gate for their users.

Connect a client

Most roleplay front ends have a chat-completion or OpenAI-compatible mode. SillyTavern, for example, lets you add an OpenAI-compatible custom endpoint. Fill in three values.

FieldValue
Base URLhttps://api.nsfwllm.top/v1
API keyYour key, sent as a Bearer token
Modeluncensored

If the client offers a model list, it calls GET /v1/models, which this API serves. If it asks you to type the ID, enter uncensored. Get a key from the API key page; new users can claim $0.50 of trial credit with one click, which is enough for a long test session.

Before you open the full client, check the connection from a terminal:

curl https://api.nsfwllm.top/v1/chat/completions   -H "Authorization: Bearer $NSFWLLM_API_KEY"   -H "Content-Type: application/json"   -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

Write the system prompt

The system message does most of the work. Keep it short, concrete and structured. A vague prompt gives vague, repetitive scenes; a prompt full of rules gets ignored halfway through a long session. Cover four things: the world, the character, the style and the boundaries.

You are Mara, the harbor-master of a rainy port city in a low-fantasy setting. The user plays a traveling courier who just arrived.

Style: third-person past tense, two to four short paragraphs per reply. Stay in character. Do not speak or act for the user's character. Do not summarize the scene or add a moral at the end.

Content: the story is adult fiction between adult characters. All characters are adults. Keep scenes non-graphic unless the user asks for more.

Three details earn their place. "Do not speak for the user" stops the most common roleplay failure, where the model writes your actions for you. A length instruction keeps replies from growing every turn. And a line that all characters are adults makes the intent explicit for you and for any moderation you run on top.

Settings that matter

  • temperature: 0.8 to 1.0 for lively dialogue, lower if the character drifts out of voice.
  • top_p: leave near 0.9 to 1.0 and change either temperature or top_p, not both at once.
  • frequency and presence penalties: small values, around 0.2 to 0.5, reduce repeated phrases in long sessions. These are passed through to the model.
  • stop: add a stop sequence such as your user-name prefix if the model starts writing your lines.
  • max_tokens: optional. Set it to 300 to 500 for chat-style replies so a single turn cannot run long.
  • seed: useful when you want to re-roll a scene and compare.

A minimal chat loop in Python

If you are building your own app, the loop is small. Keep the full message list, append each turn and stream the reply.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.nsfwllm.top/v1",
    api_key=os.environ["NSFWLLM_API_KEY"],
)

SYSTEM = (
    "You are Mara, harbor-master of a rainy port city. "
    "Stay in character, write two to four short paragraphs, "
    "never speak for the user. All characters are adults."
)
history = [{"role": "system", "content": SYSTEM}]

while True:
    user = input("> ")
    if not user:
        break
    history.append({"role": "user", "content": user})
    stream = client.chat.completions.create(
        model="uncensored",
        messages=history,
        temperature=0.9,
        frequency_penalty=0.3,
        max_tokens=400,
        stream=True,
    )
    reply = ""
    for chunk in stream:
        if chunk.choices and chunk.choices[0].delta.content:
            piece = chunk.choices[0].delta.content
            reply += piece
            print(piece, end="", flush=True)
    print()
    history.append({"role": "assistant", "content": reply})

The same code works with any OpenAI SDK. The quickstart has the Node and curl equivalents.

Memory and the 100,000-token window

The context window is 100,000 tokens, prompt plus completion. For roleplay that is a lot: a novel-length session of short turns can fit. Two things still go wrong in long chats.

First, cost grows with every turn, because the whole history is sent each time. Second, the model pays less attention to the middle of a very long prompt, so early facts about a character can slip. Both have the same fix: keep the system prompt and a rolling summary at the top, and only the most recent turns below it.

  1. Once the history passes a size you pick, say 20,000 tokens, ask the model to summarize the oldest half in a few hundred words.
  2. Replace those turns with the summary as a system or assistant note.
  3. Pin a short "facts" block with names, relationships and open plot threads, and update it by hand or with a second call.

Summaries lose detail, so keep the original transcript in your own storage. The model remembers nothing between requests; everything it knows is in the messages you send.

What a session costs

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. Take two stages of the same session.

Early in a chat, a turn sends about 4,000 input tokens and receives 300 output tokens. That is 4,000 x $0.15 / 1M = $0.0006 for input plus 300 x $0.50 / 1M = $0.00015 for output, so $0.00075 per turn. A thousand turns like that cost $0.75.

Later, with 30,000 tokens of history, a turn costs 30,000 x $0.15 / 1M = $0.0045 for input plus the same $0.00015 for output, so $0.00465. Two hundred turns at that size come to $0.93. With summarizing, you stay nearer the first number.

So an hour of heavy chatting costs well under a dollar. Top-ups start at $20 and go to $500, with a bonus of +5% from $50, +10% from $100 and +15% from $200, paid in USDT on TRC20 or USDC on Base. Credit does not expire, and failed or refused requests are not charged. See the pricing page for the details. If you run a companion app with many users, note the limits: 8 concurrent requests and 300 per minute per full key, and a streamed reply holds its slot until it ends.

Fixing common problems

Long sessions fail in predictable ways, and each has a cheap fix.

The character turns generic

After fifty turns, a vivid character often slides into a polite, neutral voice. The cause is usually that the system prompt describes traits ("sarcastic, guarded") without showing speech. Add two or three short sample lines in the character's own voice. Models copy examples more reliably than adjectives.

Replies keep getting longer

Each long reply becomes part of the history, and the model imitates its own earlier output. Set max_tokens, keep the length instruction in the system prompt, and trim any assistant turn that ran long before you store it.

The model repeats a phrase or a gesture

Raise frequency_penalty a little, or edit the offending phrase out of the stored history. Repetition feeds on itself, so removing the first few copies often ends it.

The model answers for the user

Add a stop sequence, for example a newline followed by your user name and a colon, and keep the "never speak for the user" line near the end of the system prompt. If you use a front end that builds the prompt for you, check that it labels the roles correctly.

Requests fail with 429

A burst of regenerations can hit the concurrency limit, since each streamed reply holds its slot until it ends. The error code concurrency means too many at once, and rate_limited means too many per minute. Wait for the Retry-After delay when one is sent, and cancel unused streams in your client.

Honest limits

This is one model, and its quality sets the ceiling. It will not match every large proprietary model on long-range plot consistency, and it can still repeat itself or forget a detail. Better prompts and summaries help; they do not change what the model is. There are no benchmark claims here, so test your own scenes on the trial before you commit credit.

The text-only limit is real, and so is the age rule. Prompts are not used for training, but you remain responsible for what your app does with user chats, including storage and consent. If you ship a public product, add your own age verification and terms for lawful adult use.

Questions and answers

Which client settings do I need?

Set the base URL to https://api.nsfwllm.top/v1, paste your key, and use the model ID uncensored. Any OpenAI-compatible chat client works.

Can the model remember a whole long story?

It sees up to 100,000 tokens per request, but nothing between requests. Send a system prompt, a rolling summary and recent turns to keep the story consistent.

Does it generate images or voice for characters?

No. The API is text only. Use other services for images or audio.

Is any content off limits?

Yes. Sexual content involving minors is never allowed. Use is limited to lawful adult content.

How much does a roleplay turn cost?

A turn with 4,000 input and 300 output tokens costs about $0.00075. Longer histories cost more, so summarize old turns.

Your key is one form away

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

Get API key