NsfwAiApi/Docs
NSFW AI API Documentation
Get started with the uncensored LLM API in minutes using standard OpenAI-compatible libraries. This guide covers authentication, basic requests, streaming, and key limits for rapid integration.
- Base URL
- https://api.nsfwaiapi.com/v1
- Model
- uncensored
Base URL and Authentication
Interact with the nsfw ai api using the standard OpenAI SDK format. Your base URL is https://api.nsfwaiapi.com/v1. Authentication is handled via a Bearer token in the Authorization header. Generate your key on the dashboard; it is displayed immediately after signup. No card or phone number is required for the initial trial.
Ensure your client library points to our base URL. The API serves a single uncensored model, so you do not need to select a model version for most requests. If you switch keys, the old one becomes invalid immediately.
First Request
Send a simple text completion to verify connectivity. The endpoint POST /v1/chat/completions accepts standard chat messages. Use the model ID uncensored to ensure you are routed to our open-weight model tuned for adult content.
This request demonstrates the core capability: text in, text out. The model will respond without standard content filters for lawful adult topics.
- Endpoint:
POST /v1/chat/completions - Model:
uncensored - Format: JSON
curl https://api.nsfwaiapi.com/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."}]
}'If you receive a 401, check your API key. A 402 indicates your prepaid credit is exhausted.
Python SDK Integration
Use the official OpenAI Python library to integrate quickly. Set the base_url and api_key to match our service. This approach works for both synchronous and asynchronous workflows.
The model ID remains uncensored. Context window supports up to 100,000 tokens combined for prompt and completion. This allows for long-form roleplay or detailed analysis without cutting off early.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwaiapi.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)This method is ideal for backend services that process text sequentially. Remember that prompts are not used for training, preserving your data privacy.
Node.js SDK Integration
For JavaScript or TypeScript projects, use the OpenAI Node.js SDK. Configure the client with our base URL and your API key. This enables seamless integration into web servers or Node.js scripts.
Ensure you handle errors appropriately, such as rate limits or insufficient credits. The API supports tool calling, allowing you to define functions the model can invoke.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwaiapi.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);This setup is perfect for real-time chatbots or content generation pipelines. The pay-as-you-go model means you only pay for what you use, with no monthly fees.
Streaming Responses
For chatbots, streaming reduces perceived latency. Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE) with incremental chunks.
This is critical for user experience in roleplay scenarios. The model generates tokens sequentially, sending them as they are ready.
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 in your client to display text in real-time. This works with any OpenAI-compatible streaming parser.
Limits, Errors, and Quotas
Monitor your usage to avoid service interruption. The API enforces a limit of 300 requests per minute per key. The maximum request body size is 8 MB.
Common errors include 401 (invalid key), 402 (no credit), and 429 (rate limit). Credit never expires, so top up when convenient. Prepaid credits start at $10, with bonuses for larger amounts.
The context window is 100,000 tokens. Ensure your prompts fit within this limit. The uncensored model blocks sexual content involving minors, which is a hard limit.
Under the hood: specs
If your tool speaks the OpenAI API, these are the details that matter.
| Item | Value |
|---|---|
| API format | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Authentication | Bearer token in the Authorization header |
| Model | uncensored |
| Base URL | https://api.nsfwaiapi.com/v1 |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Function calling | Yes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool |
| Streaming | Yes — server-sent events; the last chunk carries token usage |
| Structured output | JSON object mode via response_format json_object |
| Max output | 16,000 tokens max; 2,048 if max_tokens is not set |
| Context window | 100,000 tokens, input and output combined |
| Other parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Concurrency | 8 requests at the same time per key |
| Max body | 8 MB request body |
| Requests per minute | 300/min per key |
| How you pay | prepaid credit, charged by real token usage; errors and refusals are free |
| Bonus credit | +5% from $50, +10% from $100 |
| Free trial | $0.50 of credit valid 7 days, no card needed |
| Subscription | no monthly fee; paid credit does not expire |
| Price | input $0.25 / 1M tokens, output $1.00 / 1M tokens |
| Top-up | USDT (TRC20) or USDC (Base), any whole amount from $10 to $500 |
| Content policy | adult content allowed; sexual content involving minors is refused |
| Keys | one key per account, regenerate any time (the old one stops working) |
| Sign-in | Google or e-mail and password |
Error codes
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 | invalid JSON, empty messages, bad parameter, or prompt + max_tokens over the window — fix and resend |
401 | missing_key · invalid_key · key_revoked | no key, wrong key, or a key replaced by a newer one |
402 | no_credit | out of credit; add credit and retry |
403 | content_blocked | refused by the content policy |
404 | not_found | only /v1/chat/completions and /v1/models exist |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | model busy — retry in a few seconds |
Questions and answers
Is this API suitable for character AI bots?
Yes, the uncensored model is optimized for roleplay and character interactions. It responds to adult themes without standard refusals, making it ideal for immersive chatbots.
Do prompts get used for training?
No. Your prompts and completions are not used to train the model. This ensures privacy for your unique content and character data.
What happens if I hit the rate limit?
You will receive a 429 status code. You must wait for the window to reset or reduce your request frequency. You can regenerate your API key if needed, but the limit applies per key.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Get API keyNsfwAiApiUncensored LLM API for NSFW text generation