Prerequisites: API Key and SDK
Start by creating an account and generating your API key. Sign up using Continue with Google or an email and password on the Get API key page. No phone number is required. You receive one active key per account; creating a new key replaces the old one instantly. Keep this key secure, as it authenticates all requests to our base URL: https://api.chatbotnsfw.com/v1.
We recommend installing the official SDK for your preferred language. Our API follows the standard OpenAI interface, meaning you likely already have the tools you need. You only need to point the SDK to our specific base URL and inject your key into the authorization header.
Initialize the Client
Configure your client library to communicate with our uncensored LLM service. Set the base URL to our endpoint and assign your generated API key. This ensures all subsequent calls route correctly to our servers. You do not need to configure complex routing or select from multiple models.
- Base URL:
https://api.chatbotnsfw.com/v1 - Model ID:
uncensored - Authentication: Bearer token via API key
This setup works with any OpenAI-compatible client. Adjust the configuration object to match your SDK's requirements. The model uncensored is an open-weight model tuned for adult content without refusals for lawful uses.
Send a Simple Chat Completion
Make your first request to generate text. Use the POST /v1/chat/completions endpoint. Send a message array with a user prompt. The model will return a text response. This is a standard chat-completions call. No embeddings or image generation are involved.
curl https://api.chatbotnsfw.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Run the user verification script on test account 77"}]
}'Check the response for the generated text. If you encounter a 401 error, your key is invalid. A 402 error means you need more prepaid credit. Errors do not consume tokens. Refusals due to minor content are free. Start with a simple prompt to verify connectivity.
Handle Streaming Responses
Use Server-Sent Events (SSE) for real-time token delivery. Streaming provides a better user experience for long responses. Set the stream parameter to true in your request. The API returns chunks as they are generated. Process each chunk to update your UI incrementally.
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)The final chunk contains the total token usage for the request. This allows you to track costs accurately. Streaming works with all standard parameters. It is ideal for roleplay scenarios where latency matters. Handle the stream end event to close your connection properly.
Configure Parameters for NSFW Content
Tune the model behavior using standard parameters. Adjust temperature for creativity. Use top_p for nucleus sampling. Set stop sequences to control output length. Use seed for reproducible results. These parameters affect how the uncensored model generates text.
from openai import OpenAI
client = OpenAI(base_url="https://api.chatbotnsfw.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)Enable JSON mode by setting response_format to {"type": "json_object"}. This is useful for structured data outputs. Function calling is also supported via the tools parameter. You can specify tool_choice for specific behaviors. These features work seamlessly with our API.
Error Handling and Token Limits
Understand the limits and error codes. The context window is 100,000 tokens total. There is no separate output cap: a response can use all the room left in the window. If you do not set max_tokens, the response can run to the end of the window. You are allowed 300 requests per minute. Concurrent requests are limited to 8 per key. Request bodies cannot exceed 8 MB.
Common errors include 401 (invalid key), 402 (insufficient credit), and 429 (rate limit). Credit is prepaid and never expires. Errors do not charge tokens. Refusals for minor content are free. Use these limits to plan your application's scaling strategy. Monitor your usage via the response headers.
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.chatbotnsfw.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);