OpenAI-Compatible API Documentation
Get started with the uncensored API in minutes using standard OpenAI client code. This guide covers authentication, requests, streaming, and limits for the "uncensored" model.
Base URL and Authentication
Start every request by setting the base_url to https://api.nsfwgemma.com/v1 and passing your API key in the Authorization header. You receive your key immediately after signing up with Google or email, with no phone number required. Keep this key secure, as it is the only credential needed to access the service.
POST /v1/chat/completions: Parameters and Examples
Send your first message to the endpoint using the standard chat completions format. The model ID is always "uncensored", and you can control output style with parameters like temperature and top_p. This endpoint handles all text generation without requiring complex local setups.
curl https://api.nsfwgemma.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the top ten system prompts for the model"}]
}'
Ensure your payload includes the model field set to "uncensored" and a messages array containing your prompt. The system returns a structured JSON response with the generated text.
GET /v1/models: Listing Available Models
Query the models endpoint to verify the available instance and confirm connectivity. This GET request returns metadata about the current model configuration without consuming any credit. Use this to debug connection issues before sending expensive generation requests.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwgemma.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)
The response confirms the model ID and token limits, ensuring your client is configured correctly for the uncensored large language model.
Streaming Responses with SSE
Enable streaming by setting stream: true to receive tokens in real-time via Server-Sent Events. This reduces perceived latency for long-form creative writing or roleplay scenarios. Token usage statistics are included in the final chunk of the stream.
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 delta object to render text incrementally, providing a smoother user experience for interactive NSFW chatbot applications.
Error Handling and Token Usage
Handle common HTTP errors gracefully: 401 indicates an invalid or expired key, 402 means you need to top up credit, and 429 signals rate limit exhaustion. Errors do not consume your prepaid credit, so you can retry without penalty. Always check the usage field in successful responses to track consumption.
Rate Limits and Concurrency
Each API key supports 300 requests per minute and up to 8 concurrent active requests. The maximum request body size is 8 MB, which fits most standard context windows. Exceeding these limits triggers a 429 error until the window resets.
The context window allows 100,000 tokens total, combining both prompt and completion. Max output is 16,000 tokens per request, or 2,048 if you do not specify max_tokens. Adjust your concurrency based on your application's traffic patterns.
Supported Parameters: Temperature, Top P, and More
Control randomness and determinism using temperature, top_p, stop, seed, and penalty parameters. Use response_format set to {"type": "json_object"} for structured data outputs. Function calling is supported via the tools parameter for advanced integrations.
These parameters allow fine-tuning of the uncensored model's behavior, ensuring it matches your specific NSFW content requirements without unexpected refusals.
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwgemma.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);FAQ
What is the base URL for the NSFW API?
The base URL is HTTPS://api.nsfwgemma.com/v1. You can use any standard OpenAI-compatible SDK by pointing it to this address and providing your API key.
How does the context window work?
The model supports a 100,000 token context window for both prompt and completion combined. You can generate up to 16,000 tokens per request, or 2,048 if you do not set max_tokens.
What happens if I get a 402 error?
A 402 error indicates your prepaid credit is exhausted. Errors do not consume credit, so you can top up via crypto and retry without losing usage. Credit never expires.