NSFW LLM API Documentation
Get your uncensored LLM API key in seconds and send your first prompt. This guide covers the OpenAI-compatible endpoint, streaming, and token pricing.
Quickstart: First request
Send a chat completion request to our OpenAI-compatible endpoint immediately after signing up. Your API key authenticates every call to the base URL HTTPS://api.nsfwplayrole.com/v1. Use the model id "uncensored" to access the open-weight model tuned for adult content without refusals.
Start with a simple curl command to verify connectivity. The endpoint accepts standard JSON payloads with a messages array. You will receive a text response containing the model's reply.
Our API is designed for direct integration. No proxy layers are required. You can integrate this NSFW chatbot into your existing stack using standard HTTP clients.
Verify your key works before building complex logic. The response includes token usage statistics for billing transparency.
Authentication and Headers
Include your API key in the Authorization header for every request. The format is "Bearer ". This standard header ensures secure access to the uncensored AI model.
You can generate a key via the "Get API key" page using Google or email. The key is displayed once, so copy it immediately. Each account supports one active key; generating a new one replaces the old.
Keep your key private. If exposed, revoke it by generating a replacement. The API key is the sole credential needed for token consumption.
Invalid keys return a 401 error. Ensure you copy the exact string without extra spaces. Our server validates the key against the prepaid credit balance.
Chat Completions Endpoint
Post JSON to POST /v1/chat/completions to receive text responses. The endpoint accepts a model field set to "uncensored". You can also list available models via GET /v1/models.
The payload requires a messages array. Each message has a role (user, assistant, system) and content. The model generates a response based on your prompt history.
Our uncensored LLM handles context up to 100,000 tokens. This includes both the input prompt and the output completion. Requests exceeding this limit are rejected.
Use the endpoint for role play scenarios or creative writing. The model responds to lawful adult content without standard refusals. You control the narrative direction.
Streaming and SSE
Enable streaming by setting stream to true in your request. The API returns Server-Sent Events (SSE) instead of a single JSON object. Each chunk contains partial text and usage data.
Parse the SSE stream to display text in real time. The final chunk includes the total token usage for the request. This allows accurate billing tracking without waiting for the full response.
Streaming reduces perceived latency for users. It is ideal for NSFW role play where long descriptions are generated. Handle connection drops gracefully by retrying if needed.
Use the official OpenAI SDKs for automatic stream handling. They parse the SSE format correctly. Our API is fully compatible with these libraries.
Function Calling and JSON Mode
Use function calling to structure model outputs. Define tools in the request with name, description, and parameters. The model returns a function call object instead of plain text.
Enable JSON mode with response_format set to json_object. The model returns strictly valid JSON. This is useful for parsing structured data or game states.
Combine function calling with streaming for dynamic interactions. The model can decide actions based on user input. Use tool_choice to force specific functions.
Validate the JSON output before processing. The model aims for strict compliance but may occasionally return invalid syntax. Our uncensored model maintains structure even in creative contexts.
Rate Limits and Pricing
Pay per token with no monthly fees. Input tokens cost $0.15 per 1M; output tokens cost $0.50 per 1M. Errors and refusals are free. Credit never expires.
Top up with crypto only: USDT (TRC20) or USDC (Base). Amounts range from $20 to $500. Bonus credit applies: +5% from $50, +10% from $100, +15% from $200.
Rate limits are 300 requests per minute and 8 concurrent requests per key. The request body limit is 8 MB. Exceeding limits returns a 429 error.
A 402 error indicates insufficient credit. Top up immediately to resume service. The trial credit is $0.50 for 7 days.
cURL
curl https://api.nsfwplayrole.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set temperature to 0.7 for consistent output."}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwplayrole.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwplayrole.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);Streaming
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Frequently asked questions
What is the context window size?
The context window is 100,000 tokens, including both prompt and completion. You can send long role play histories without losing earlier context. The max output per request is 16,000 tokens.
How do I handle errors like 401 or 429?
A 401 error means your API key is invalid or revoked. Check your key in the dashboard. A 429 error indicates you have exceeded the rate limit of 300 requests per minute. Wait and retry, or reduce concurrency.
Does the model refuse NSFW content?
The uncensored model does not refuse lawful adult, fictional, or controversial topics. It is tuned for role play and erotic content. The only hard limit is sexual content involving minors, which is always refused.
Get your API key
Sign up, copy your key, and update your base URL. Setup takes seconds.