EN ▾
Get API key

NSFW Grok API for Roleplay: Settings That Work

Stage with floating masks and glowing speech bubbles representing character roleplay

Using an nsfw grok api roleplay setup well comes down to a good system prompt, sane sampling and disciplined history. This page covers each, with settings you can paste into a client or script.

Updated

Key points

Mistral models include built-in content filters that may block lawful adult content, requiring workarounds.

Token costs for long-context Mistral usage can exceed those of flat-rate uncensored alternatives.

A single API key works across all Mistral endpoints, debunking the need for separate NSFW keys.

For pure text generation without refusals, a dedicated uncensored API often provides better value and reliability.

On this page

What this setup is and is not

The model behind this endpoint is an open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. For fiction writers, roleplayers and companion-app builders, that means it will stay in character through mature themes instead of breaking the scene with a lecture. It is not xAI's Grok and not any other vendor's official API. The search term describes the behaviour people want.

It is also text only. There is no image generation, no voice and no video, so a roleplay front end that shows portraits or speaks aloud needs those pieces from elsewhere. There is one hard rule: no sexual content involving minors. Characters must be adults, and requests that cross that line are not served. Everything below is for adults writing fiction or running companion-style chat.

Billing is prepaid and per token, at $0.15 per 1M input tokens and $0.50 per 1M output tokens. Roleplay is a heavy-input workload because the history is re-sent every turn, so the cost section near the end is worth reading before you scale a bot.

Connect your client

Most roleplay front ends have a custom or OpenAI-compatible connection mode. SillyTavern, for example, lets you add an OpenAI-compatible endpoint; other clients have an equivalent field for a base URL. Enter these values:

If the client has a connect or test button, it will usually call GET /v1/models and should see uncensored in the list. Turn streaming on, because roleplay feels better when text appears as it is written. The exact menu names differ between clients, so use the client's own documentation for where these fields live.

If you are writing your own bot, the equivalent call is short:

import os
from openai import OpenAI

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

SYSTEM = (
    "You are Mara, a sardonic ship's navigator in a space-opera story. "
    "Stay in character. Write in third person, past tense, 2 to 4 paragraphs. "
    "Never speak or act for the user's character. All characters are adults."
)

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.9,
        top_p=0.95,
        frequency_penalty=0.3,
        max_tokens=500,
    )
    reply = r.choices[0].message.content
    history.append({"role": "assistant", "content": reply})
    return reply

print(turn("I lean on the console and ask Mara why we changed course."))

Write a system prompt that holds the character

The system message is where most of the quality comes from. Keep it in one place and keep it stable, because changing it mid-story shifts the voice. A good one covers five things, and none of them needs to be long.

  1. Who the character is. Name, role, speech habits, one or two flaws. Specific beats adjective lists: "answers questions with questions when nervous" is more useful than "witty and complex".
  2. The setting and its rules. Era, tech level, what the world allows. Two or three sentences.
  3. Point of view and tense. Say "third person, past tense" or "first person, present". Models drift without this.
  4. Length. "2 to 4 paragraphs" works better than "not too long".
  5. Boundaries of the roleplay itself. For example, never act for the user's character, and keep all characters adult.

Tell the model what to do rather than what to avoid where you can. "End each reply on a moment the user can respond to" produces better pacing than "don't ramble". If you want mature themes handled with some restraint, such as cutting away from a scene, say so in the system prompt; the model follows direction in both directions.

Use a lorebook sparingly

Many clients inject extra facts about the world when keywords appear. That is useful, but every injected entry is input you pay for on every turn. Keep entries short and scoped to the scenes where they matter.

Sampling settings to start from

The API passes through temperature, top_p, stop, seed and the penalty parameters. There is no single right setting, but these starting points work for fiction:

SettingStart atWhen to change it
temperature0.9Lower to 0.7 if the character wanders or contradicts facts; raise to 1.0 if replies feel flat.
top_p0.95Leave alone unless output gets odd; change temperature first.
frequency_penalty0.3Raise slightly if the model repeats phrases across turns.
presence_penalty0.0 to 0.3Raise to push the story toward new topics.
max_tokens400 to 700Match your wanted reply length and cap the cost of a bad turn.
stopa name tag such as "\nUser:"Use it to stop the model from writing the user's next line.

Change one setting at a time and give it several turns before judging. For testing a prompt change, fix seed so differences come from your edit and not from sampling noise.

Manage the 100,000-token window

The context window is 100,000 tokens, prompt and completion together. That fits a very long story, but long histories get slower to read and cost more per turn, and models pay less attention to details buried deep in a huge prompt. Treat the window as a ceiling, not a target.

Three techniques keep long sessions healthy:

def trim(history, keep_last=24):
    system, rest = history[0], history[1:]
    return [system] + rest[-keep_last:]

# call trim() before each request:
# r = client.chat.completions.create(model="uncensored", messages=trim(history), ...)
# client = OpenAI(base_url="https://api.nsfwgrok.top/v1", api_key=...)

A request that carries the full window is still cheap in absolute terms. At 90,000 input tokens and 800 output tokens, the cost is 90,000 x $0.15 / 1M = $0.0135 plus 800 x $0.50 / 1M = $0.0004, so $0.0139 per turn. Repeated over 100 turns that is $1.39, which is why trimming pays off for a busy bot even though a single turn looks tiny.

Cost and limits for a roleplay bot

Take a typical session of 60 turns where each request sends about 8,000 input tokens and receives 450 output tokens. Input: 60 x 8,000 = 480,000 tokens, which is 480,000 x $0.15 / 1M = $0.072. Output: 60 x 450 = 27,000 tokens, which is 27,000 x $0.50 / 1M = $0.0135. The session costs $0.0855, under nine cents. The $0.50 trial credit therefore covers around five such sessions, since 0.50 / 0.0855 is about 5.8.

For a public bot, the limits matter more than the price. A full key handles 8 concurrent requests and 300 per minute. Since streamed replies hold a slot until they finish, 8 simultaneous users each waiting on a long story reply will fill your concurrency. Queue requests, show a typing indicator, and retry on a 429 using the Retry-After header. The trial key is limited to 2 concurrent requests and 60 per minute, which is fine for solo use.

Top up any whole amount from $20 to $500 with crypto (USDT on TRC20 or USDC on Base), with a bonus of +5% from $50, +10% from $100 and +15% from $200. Credit never expires and prompts are not used for training. See the pricing page for details and the API docs for the full parameter list.

Questions and answers

Does this work with SillyTavern and similar clients?

Any client that accepts a custom OpenAI-compatible endpoint should work. Enter the base URL https://api.nsfwgrok.top/v1, your key and the model ID uncensored.

Can I do image or voice roleplay?

No. The service is text only, with no image, audio or video generation. Use separate tools for those parts.

Are there content rules?

The model is tuned to answer without content refusals for lawful adult use. The hard limit is no sexual content involving minors, and all characters must be adults.

How much does a long roleplay session cost?

A 60-turn session of 8,000 input and 450 output tokens per turn costs about $0.0855 at $0.15 and $0.50 per 1M tokens.

What happens when I hit a rate limit?

You get HTTP 429 with the code rate_limited or concurrency. Wait and retry, using the Retry-After header when it is present.

Your key is one form away

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