nl ▾
Get API key

API Documentation

Integrate our uncensored LLM API into your application with just a few lines of code. This guide covers authentication, request structures, and handling responses for your NSFW chatbot or content generation workflow.

Authentication and Base URL

The base URL for all requests is https://api.localnsfwllm.com/v1. You must include your API key in the Authorization header as a Bearer token. Obtain your key immediately after signing up via Google or email; it is displayed once on the dashboard. If you lose it, generate a new one, which replaces the previous key. There is no complex setup required. Just pass the string directly in your HTTP headers.

curl https://api.localnsfwllm.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Send message to channel 42 confirming deployment status"}]
  }'

First Chat Request

Send a POST request to /v1/chat/completions with your prompt. The model ID is always uncensored. This endpoint accepts standard OpenAI-compatible JSON payloads. You can specify parameters like temperature or top_p to control creativity. The API returns a text response directly. No additional configuration is needed for basic text generation.

from openai import OpenAI

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

Streaming Responses

Use Server-Sent Events (SSE) for real-time token delivery. Set stream: true in your request body. The API sends partial chunks as they are generated. Token usage details appear in the final chunk. This approach reduces perceived latency for end-users. It is ideal for chat interfaces where instant feedback matters. Handle the stream events carefully in your client code.

import OpenAI from "openai";

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

Function Calling and Tools

Define tools in your request to enable function calling. The model returns structured arguments for these tools. You can specify tool_choice to force or allow automatic selection. This feature works seamlessly with standard OpenAI SDKs. Use it to extract data or trigger actions within your NSFW application. Ensure your tool definitions match the expected JSON schema.

JSON Mode

Force the model to output valid JSON by setting response_format to {"type": "json_object"}. This guarantees structured output for programmatic parsing. It is useful for extracting entities or generating configuration files. The uncensored model respects this constraint reliably. Combine it with temperature settings for predictable results. Avoid mixing JSON mode with high randomness.

Rate Limits and Errors

You are limited to 300 requests per minute and 8 concurrent requests per key. The maximum request body size is 8 MB. Errors like 401 indicate an invalid key, while 402 means you need more credit. Rate limits trigger a 429 response. Your prepaid credit never expires, so you can use it at your own pace. The context window supports 100,000 tokens total.

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

How does the prepaid credit system work?

Credit is charged only for tokens actually used in requests. Errors and refusals do not consume credit. You can top up with USDT or USDC, and bonuses apply for larger amounts. Credit never expires, so you can use it whenever you need it.

Is this API compatible with OpenAI SDKs?

Yes, it is fully OpenAI-compatible. You only need to change the base URL and API key in your existing code. The endpoint structure and response format match the standard OpenAI chat completions interface.

What is the context window size?

The context window is 100,000 tokens for the combined prompt and completion. You can request up to 16,000 tokens in a single output. If you do not specify <code>max_tokens</code>, the default output limit is 2,048 tokens.

Get your API key

Register, copy the key, update your base URL. That is all.