Integrate the Uncensored API
Integrate the uncensored API into your adult content applications with a single OpenAI-compatible endpoint. This quickstart guides you from key generation to handling streaming responses for a robust NSFW chatbot experience.
Prerequisites: SDK and Key
Obtain your API key from the dashboard before writing any code. You can sign up with Google or email, and the key appears immediately on the Get API key page. No phone number is required, and you receive $0.50 in trial credit for seven days. Keep this key secure, as it authenticates all requests to the base URL https://api.bestnsfwllm.com/v1.
Install your preferred SDK via your package manager. You will configure the base URL and API key in your client initialization. This setup ensures your application connects directly to our uncensored model without proxy overhead.
Making Your First Request
Send a chat completion request to generate text responses. Use the uncensored model ID for direct access to the open-weight model. The API accepts standard OpenAI parameters and returns JSON-formatted results.
curl https://api.bestnsfwllm.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "generate twenty test user profiles with diverse ages and genders"}]
}'Ensure your payload includes the system prompt to define the behavior. The model responds without content refusals for lawful adult use. You can verify the connection by checking the choices array in the response body.
Handling Streaming Responses
Enable real-time token delivery by setting stream: true in your request. The server sends Server-Sent Events (SSE) as tokens become available. This approach reduces perceived latency for users building interactive NSFW chatbot interfaces.
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)Parse each chunk to accumulate the final response. The last chunk contains the total token usage statistics. This method is ideal for applications requiring immediate feedback during roleplay or creative writing sessions.
Configuring Model Parameters
Adjust generation behavior using standard parameters like temperature and top_p. Set temperature to control randomness, with lower values producing more deterministic outputs. Use top_p for nucleus sampling to balance creativity and coherence.
from openai import OpenAI
client = OpenAI(base_url="https://api.bestnsfwllm.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)You can also enforce JSON mode by setting response_format to {"type": "json_object". This is useful for parsing structured data from the uncensored LLM. The model supports function calling tools for extended capabilities.
Integrating with Node.js
Use the official OpenAI SDK for Node.js to manage requests efficiently. Configure the client with the custom base URL and your API key. The SDK handles retries and error serialization automatically.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.bestnsfwllm.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);Call the chat.completions.create() method with your desired parameters. The SDK returns a promise that resolves to the completion object. This integration works seamlessly with existing OpenAI-compatible clients.
Error Handling and Rate Limits
Handle common HTTP status codes to manage client-side errors gracefully. A 401 error indicates an invalid or missing API key. A 402 error means your prepaid credit is exhausted; top up via crypto to resume service. A 429 error signals that you have exceeded the rate limit of 300 requests per minute.
The context window supports 100,000 tokens for both prompt and completion. Max output is 16,000 tokens per request. Monitor your usage via the dashboard to avoid unexpected interruptions during high-volume generation.
Frequently asked questions
Which is the best NSFW LLM for building a chat app?
Our uncensored model is optimized for lawful adult content with a 100k context window. It provides direct API access without the content refusals common in other models. Use the OpenAI-compatible endpoint to integrate it into your application.
What happens if I exceed the rate limit?
You will receive a 429 status code indicating too many requests. The limit is 300 requests per minute per key. You can monitor your usage in the dashboard and upgrade your prepaid credit to handle higher volumes.
How do I pay for the API service?
Payments are crypto-only using USDT (TRC20) or USDC (Base). You can top up with any whole amount from $20 to $500. Bonus credit is added for larger top-ups, and credits never expire.
Access your API key
Sign up, grab the key, and update your base URL. That’s it.