EN ▾
NSFW Hub
nsfwhub.cc›Developer docs
Get your key

Integrate the Uncensored LLM API

Drop our uncensored LLM API into your project with a single base URL change. Get text generation without content refusals using standard OpenAI-compatible endpoints.

Base URLhttps://api.nsfwhub.cc/v1
Modeluncensored

Base URL and Authentication

The base URL for all requests is https://api.nsfwhub.cc/v1. Authenticate by passing your API key in the Authorization header. Generate your key via the dashboard using Google or email. Use it immediately for requests.

curl https://api.nsfwhub.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Add error handling to the login endpoint"}]
  }'

Errors return standard HTTP codes. Invalid keys yield 401. Rate limits trigger 429. This endpoint handles text generation only.

POST /v1/chat/completions Endpoint

Send messages to generate text using the uncensored model. The endpoint accepts standard chat formats. Pass your system prompt for consistent behavior. Define user messages for context. The API returns generated text tokens. Configure parameters like temperature for creativity. Use JSON mode for structured output. Requests are processed instantly. No embeddings are supported here. Only text completion occurs.

GET /v1/models Endpoint

Query available models with a simple GET request. The response lists the uncensored model ID. Use this to verify connectivity quickly. Check model details before integration. The API serves one specific model. It does not route between vendors. Ensure your client handles the response correctly. This endpoint confirms your key works. No other models are available currently.

Supported Parameters and JSON Mode

Control generation with temperature, top_p, and seed. Set response_format to {"type": "json_object"} for strict JSON. This ensures parseable output for apps. Use stop sequences to halt generation. Adjust max_tokens to limit output length. The model supports tool calling for functions. Pass tools in the standard format. Frequency penalties help reduce repetition. These parameters work exactly like OpenAI.

Streaming Responses with SSE

Enable streaming by setting stream: true. The API sends Server-Sent Events (SSE). Receive tokens as they generate. This reduces perceived latency for users. Parse each chunk for real-time display. The final chunk contains usage stats. Handle incomplete JSON carefully. Streaming works with all parameters. Cancel requests by closing the connection. This method saves memory for long texts.

Handling Tokens and Errors

The context window is 100,000 tokens total. Output limits to 16,000 tokens per request. Errors like 402 indicate insufficient credit. Top up via crypto only. 429 errors mean you hit the 300 requests per minute limit. Wait before retrying. Unused credit never expires. Refusals for minor content are free. Track usage via the final SSE chunk. Errors do not consume tokens.

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.nsfwhub.cc/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.js

import OpenAI from "openai";

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

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)

Common questions

What is the base URL for the NSFW hub API?

The base URL is HTTPS://api.nsfwhub.cc/v1. It is fully compatible with OpenAI SDKs. Change the base URL in your client configuration.

How do I handle rate limits?

The limit is 300 requests per minute per key. A 429 status code indicates you exceeded this. Wait briefly before retrying your request.

Does the uncensored LLM support JSON mode?

Yes, set response_format to json_object. This ensures strict JSON output. It works with standard chat parameters. Parse the result directly in your code.

Get your API key

Sign up, grab the key, update the base URL. That is all.