NSFW Writer: Uncensored API Quickstart
Start building with the NSFW Writer API using standard OpenAI-compatible endpoints. This guide covers authentication, chat completions, streaming, and error handling for your uncensored LLM integration.
Base URL and Authentication
The NSFW Writer API uses the standard OpenAI chat-completions endpoint structure. To begin, you need an API key. Sign up on the Get API key page using your Google account or an email and password. Your key is displayed immediately upon creation.
All requests must include your API key in the authorization header. The base URL for all requests is https://api.nsfwwriter.cc/v1. This ensures compatibility with existing OpenAI SDKs and clients by simply swapping the base URL.
We do not offer embeddings, image generation, or fine-tuning. This is a text-only API serving one uncensored model. Your prompts are not used for training, and the service requires no phone number for setup.
Send a Chat Completion
Send a standard chat request to generate text. Use the model ID uncensored to access our open-weight model tuned for adult and uncensored content. The API accepts standard parameters like temperature, top_p, and stop.
Requests are charged based on token usage. Errors and refusals are free. The context window supports up to 100,000 tokens total, with no separate output cap.
curl https://api.nsfwwriter.cc/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 your request body includes the messages array. If you do not specify max_tokens, the response can run to the end of the window. This simplicity allows you to integrate quickly into existing chat applications without learning a new protocol.
Python SDK Integration
Use the official OpenAI Python library to interact with the NSFW Writer API. Configure the client with your API key and the custom base URL. This approach works seamlessly with existing codebases designed for OpenAI.
Set the model parameter to uncensored. You can adjust parameters like temperature to control randomness or seed for reproducibility. The SDK handles tokenization and response parsing automatically.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwwriter.cc/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)This method is ideal for backend services or scripts. Since we do not support embeddings or vision, ensure your data pipeline only passes text. The API key is sent securely in the header, keeping your credentials separate from your application logic.
Node SDK Integration
Integrate the API into Node.js applications using the OpenAI Node SDK. Initialize the client with your credentials and the specific base URL for the NSFW Writer service.
Call the chat completions endpoint with the uncensored model ID. This allows you to build chatbots, content generators, or research tools that require uncensored responses. The SDK manages the HTTP requests and response streams.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwwriter.cc/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 this is a prepaid token model. Your credits are charged based on actual input and output tokens. No monthly fees apply, and your credit never expires. This makes it cost-effective for sporadic or variable usage patterns common in indie projects.
Streaming Responses
Enable streaming by setting the stream parameter to true in your request. The API returns Server-Sent Events (SSE) with incremental token updates. This provides a better user experience for chat interfaces by showing text as it is generated.
The final chunk in the stream contains the total token usage for the request, allowing you to track costs in real-time. Streaming works with all standard parameters, including function calling and JSON mode.
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)Handle the stream events in your client code to update the UI. This is particularly useful for long-form content generation where users might want to see progress. Note that streaming does not change the pricing model; you are still charged per token used.
Limits, Errors, and Context
Understand the operational limits to avoid service interruptions. You are limited to 300 requests per minute and 8 concurrent requests per API key. The request body size must not exceed 8 MB. If you need a new key, generating one replaces the old active key.
Common errors include 401 for an invalid key, 402 for insufficient credit, and 429 for rate limits. Credit is prepaid and never expires, so a 402 error simply means you need to top up. Top-ups are accepted via crypto (USDT on TRC20 or USDC on Base) from $20 to $500, with bonus credits for larger amounts.
The model refuses sexual content involving minors, which is a hard limit. For other lawful adult or controversial topics, the uncensored model will respond. Always handle errors gracefully in your application logic.
Questions and answers
What is the context window size?
The context window is 100,000 tokens, combining both the prompt and the completion. There is no separate output cap, and if you do not specify a max_tokens value, the response can run to the end of the window.
How do I top up my credit?
Top-ups are accepted via crypto only: USDT (TRC20) or USDC (Base). You can top up any whole amount from $20 to $500. Credits never expire, and you receive bonus credit for larger top-ups.
Is there a free trial?
Yes, new users get $0.50 of trial credit, one per person, valid for 7 days. Claim this credit with one click on your API key page. No card is needed to start.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Read the docsAPI facts in one table
One table with every limit, feature and price that applies to your key.
| Parameter | Details |
|---|---|
| Compatibility | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Base URL | https://api.nsfwwriter.cc/v1 |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Authentication | Authorization: Bearer YOUR_KEY |
| Model | uncensored |
| Tools / tool calls | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| Other parameters | temperature, top_p, stop, seed and the two penalties are passed through |
| Context window | 100,000 tokens, input and output combined |
| JSON mode | response_format: {"type": "json_object"} |
| Streaming | Supported (stream: true), usage included at the end |
| Max output | prompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap |
| Max body | 8 MB request body |
| Parallel requests | 8 requests at the same time per key |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Requests per minute | 300/min per key |
| Credit expiry | paid credit never expires, no subscription |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| How you pay | pay as you go from prepaid credit; nothing is charged for failed or refused requests |
| Token prices | input $0.15 / 1M tokens, output $0.50 / 1M tokens |
| Trial credit | $0.50 of credit valid 7 days, no card needed · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Bonus credit | +5% on $50+, +10% on $100+, +15% on $200+ |
| Content | adult content allowed; sexual content involving minors is refused |
| Sign-in | Google or e-mail and password |
| Key management | one key per account, regenerate any time (the old one stops working) |
Errors and what to do
Every error is JSON with a type you can switch on. You are never charged for an error.
| HTTP | Type | What to do |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | no key, wrong key, or a key replaced by a newer one |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | sexual content involving minors — refused, not billed |
404 | not_found | unknown endpoint |
413 | request_too_large | request body larger than 8 MB |
429 | rate_limited · concurrency | over 300/min or 8 parallel — back off and retry |
503 | upstream_busy | temporary overload, retry shortly |
On this page
- Base URL and Authentication
- Send a Chat Completion
- Python SDK Integration
- Node SDK Integration
- Streaming Responses
- Limits, Errors, and Context
Start with trial credit
Email and password, key on screen right away.