Get API key

NsfwAiApiDocs

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.

ItemValue
API formatOpenAI Chat Completions schema; official openai SDKs work unchanged
AuthenticationBearer token in the Authorization header
Modeluncensored
Base URLhttps://api.nsfwaiapi.com/v1
MethodsPOST /v1/chat/completions · GET /v1/models
Function callingYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
StreamingYes — server-sent events; the last chunk carries token usage
Structured outputJSON object mode via response_format json_object
Max output16,000 tokens max; 2,048 if max_tokens is not set
Context window100,000 tokens, input and output combined
Other parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Concurrency8 requests at the same time per key
Max body8 MB request body
Requests per minute300/min per key
How you payprepaid 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
Subscriptionno monthly fee; paid credit does not expire
Priceinput $0.25 / 1M tokens, output $1.00 / 1M tokens
Top-upUSDT (TRC20) or USDC (Base), any whole amount from $10 to $500
Content policyadult content allowed; sexual content involving minors is refused
Keysone key per account, regenerate any time (the old one stops working)
Sign-inGoogle 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.

HTTPTypeWhat to do
400bad_requestinvalid JSON, empty messages, bad parameter, or prompt + max_tokens over the window — fix and resend
401missing_key · invalid_key · key_revokedno key, wrong key, or a key replaced by a newer one
402no_creditout of credit; add credit and retry
403content_blockedrefused by the content policy
404not_foundonly /v1/chat/completions and /v1/models exist
413request_too_largebody over 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busymodel 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 key

NsfwAiApiUncensored LLM API for NSFW text generation