Get API key

NSFW API Quickstart Guide

Get your uncensored LLM API key and start sending text in seconds. This guide covers the base URL, authentication, and the chat-completions endpoint for your NSFW chatbot or roleplay app.

Authentication and Base URL

Our API is OpenAI-compatible, so you can use existing SDKs with minimal changes. The base URL is https://api.nsfwapihub.com/v1. You must include your API key in the Authorization header as a Bearer token. Get your key from the dashboard after signing up with just an email. The key is shown immediately and can be regenerated anytime, which revokes the old one.

There is no phone number or card required for the trial. We use pay-as-you-go prepaid credits that never expire. New accounts receive $0.50 in trial credit valid for 7 days. For higher volume, top-ups start at $10, with bonus credits available at higher tiers. Keep your key secure; anyone with it can spend your credits.

First Request

Send a standard chat completion request to test your setup. Use the model ID uncensored to access our open-weight model tuned for adult content. The API accepts text input and returns text output. It does not support embeddings, images, or audio. Ensure your request body stays under 8 MB. This is a pure text completion API optimized for narrative and roleplay contexts.

The model answers without content refusals for lawful adult use, though sexual content involving minors is always blocked. You can use this endpoint for uncensored roleplay, creative writing, or any text-based application. The response includes the generated text and token usage statistics.

curl https://api.nsfwapihub.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."}]
  }'

Python SDK Integration

Use the official OpenAI Python library to integrate quickly. Set the base_url and api_key in your client configuration. The rest of the syntax mirrors the standard OpenAI chat completions endpoint. This approach works for both synchronous and asynchronous applications. It is the most straightforward way to add an uncensored AI API to your Python backend.

Remember that the model ID is uncensored, not gpt-4 or similar. The API supports tool calling, so you can define functions in your system prompt or tools array. This allows for structured outputs or integration with external systems. The context window is 64,000 tokens, allowing for long conversations or large documents.

from openai import OpenAI

client = OpenAI(base_url="https://api.nsfwapihub.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)

Node SDK Integration

For JavaScript or TypeScript projects, the OpenAI Node SDK works directly. Configure the client with the base_url pointing to our API and provide your API key. This ensures compatibility with existing codebases that already use OpenAI-compatible services. You can switch between different providers easily by changing just these two configuration values.

The uncensored model handles standard chat messages. You can pass user and assistant messages to build a conversation history. The API returns completions that continue the narrative without unnecessary moralizing. This is ideal for character roleplay or adult-themed storytelling. Ensure you handle errors gracefully, especially rate limits and insufficient funds.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.nsfwapihub.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);

Streaming Responses

For a better user experience, use Server-Sent Events (SSE) to stream the response. This allows your application to display text as it is generated, reducing perceived latency. Set the stream parameter to true in your request. The API will return a stream of chunks, each containing a portion of the completion.

Process these chunks in your client-side code or backend proxy to build the final message. Streaming is supported by most OpenAI-compatible SDKs. This feature is essential for chat applications where users expect real-time interaction. The uncensored model generates text efficiently, making streaming a smooth experience for end-users.

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)

Rate Limits, Errors, and Context

You are limited to 300 requests per minute per API key. If you exceed this, you will receive a 429 Too Many Requests error. Requests are also limited to 8 MB in body size. If your key is invalid, you get a 401 Unauthorized error. If you run out of credits, you get a 402 Payment Required error. Refill your balance via the dashboard to continue using the service.

The context window is 64,000 tokens, including both the prompt and the completion. This allows for extensive conversation history or large input texts. The model is not GPT, Claude, or any other vendor's model; it is a distinct open-weight model. Ensure your application handles these limits and errors appropriately to maintain a smooth user experience.

Technical specifications

A quick checklist for developers: format, limits, features, billing.

SpecValue
CompatibilityOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
Base URLhttps://api.nsfwapihub.com/v1
MethodsPOST /v1/chat/completions · GET /v1/models
API keyBearer token in the Authorization header
Model IDuncensored
SSE streamingYes — server-sent events; the last chunk carries token usage
Function callingYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
JSON modeJSON object mode via response_format json_object
Context window64,000 tokens (prompt + completion together)
Completion lengthup to 16,000 tokens per request (default 2,048)
Other parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
Request size8 MB request body
Response headersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Rate limit300/min per key
Concurrency8 requests at the same time per key
Top-upcrypto: USDT on TRON or USDC on Base, $10–$500, any whole sum
Free trial$0.50 of credit valid 7 days, no card needed
How you payprepaid credit, charged by real token usage; errors and refusals are free
Volume bonus+5% from $50, +10% from $100
Price$0.25 per 1M input tokens · $1.00 per 1M output tokens
Credit expirypaid credit never expires, no subscription
Keysone key per account, regenerate any time (the old one stops working)
Content policyuncensored for adults; the only hard rule: no sexual content involving minors
Sign-insign in with Google or with e-mail + password

Errors and what to do

Every error is JSON with a type you can switch on. You are never charged for an error.

StatusTypeReason
400bad_requestmalformed request or too long for the context window
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_foundunknown endpoint
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busytemporary overload, retry shortly

Questions and answers

Is this API truly uncensored?

Yes, the model is tuned to answer without content refusals for lawful adult use, fictional scenarios, or controversial topics. It does not block adult themes unless they involve sexual content with minors, which is always blocked.

Do I need a credit card for the trial?

No. You only need an email and a password to sign up. You receive $0.50 in trial credit valid for 7 days without providing payment details.

What is the context window size?

The context window is 64,000 tokens, covering both the input prompt and the output completion. This allows for long conversations or large document processing.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key