Base URL and Authentication
The NSFW Writer API is an OpenAI-compatible service. You interact with it using standard HTTP requests. The base URL is https://api.nsfwwriter.top/v1. To authenticate, include your API key in the Authorization header as a Bearer token. This key is generated when you sign up via Google or email on the Get API key page. Ensure your client library is configured to use this base URL instead of the default OpenAI endpoint.
The /v1/chat/completions Endpoint
Send requests to POST /v1/chat/completions. The model identifier is uncensored. This endpoint accepts a list of messages and returns text completions. It supports parameters like temperature, top_p, stop, seed, presence_penalty, and frequency_penalty. The model does not refuse lawful adult, fictional, or controversial topics. Note that sexual content involving minors is always blocked. You can test the integration with a simple request:
curl https://api.nsfwwriter.top/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'
Ensure you replace YOUR_API_KEY with your actual key. The response will contain the generated text in the choices array.
Python SDK Integration
Use the official OpenAI Python SDK to interact with the API. Install the package via pip and configure the client with our base URL and API key. This allows you to leverage existing code patterns while benefiting from our uncensored model. The following snippet demonstrates a basic chat completion call:
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwwriter.top/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)
The context window is 100,000 tokens total. There is no separate output cap, and if max_tokens is not set, the response can run to the end of the window. Errors and refusals do not consume credit.
Node.js SDK Integration
For JavaScript and TypeScript developers, the OpenAI Node.js SDK works seamlessly. Set the baseURL to our endpoint and provide your API key. This approach is ideal for web servers or backend services requiring uncensored text generation. Configure the client as shown below:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwwriter.top/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);
Remember that the model ID is uncensored. You can pass system, user, and assistant messages to guide the response. The API returns JSON, making it easy to parse in Node environments.
Streaming Responses via SSE
Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE) for real-time token delivery. This is useful for chat applications where you want to display text as it is generated. The final chunk contains the full token usage statistics. Use this feature to reduce perceived latency for your users:
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)
Streaming does not change pricing. You are charged for the total input and output tokens generated, regardless of streaming.
Rate Limits, Errors, and Context
Your API key is limited to 300 requests per minute and 8 concurrent requests. The request body must not exceed 8 MB. If you create a new key, it replaces the old one. Errors such as invalid keys or insufficient funds are handled by the API, but specific HTTP status codes may vary by client. Refusals for minor sexual content are always enforced. The context window is 100,000 tokens, with no separate output cap. Prompt + completion tokens count against your 100k limit.