EN ▾
Claim trial key

Quickstart: Integrate uncensored API

Integrate our uncensored API in minutes using standard OpenAI SDKs. Send text, get text, and skip the content filters with a single base URL.

https://api.openrouternsfwmodel.com/v1uncensored

Install the standard OpenAI SDK

Start by installing the official client library for your preferred language. This ensures compatibility with our OpenAI-compatible endpoint. Use your package manager to add the dependency. For Python, run pip install openai. For Node.js, run npm install openai. This standardizes your integration code.

Configure your base URL and API key

Point your client to our dedicated endpoint. This replaces the default OpenAI URL in your configuration. Set the base_url to our domain. Use your API key from the dashboard. Our uncensored model responds to the ID uncensored. This setup works with any standard OpenAI SDK.

Send your first chat completion request

Make a POST request to the chat completions endpoint. Send your prompt as part of the messages array. The model returns a text response without content refusals. Use the model parameter set to uncensored. This confirms your integration is working correctly.

Enable streaming for real-time token output

Set stream to true for real-time token output. The API returns Server-Sent Events (SSE). Each chunk contains partial text. This is ideal for chat interfaces. Token usage data appears in the final chunk. Streaming reduces perceived latency significantly.

Use function calling and JSON mode

Enable structured outputs for your applications. Use response_format for strict JSON mode. You can also define tools for function calling. Set tool_choice to automate actions. This supports complex logic without parsing errors. The model handles structured data reliably.

Understand rate limits and concurrency

Each key allows 300 requests per minute. You can run 8 concurrent requests simultaneously. The request body must stay under 8 MB. If you exceed limits, you receive a 429 error. Invalid keys return 401. No credit means 402 errors. Errors are free, so retries cost nothing.

cURL

curl https://api.openrouternsfwmodel.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the top 5 HTTP status codes"}]
  }'

Python

from openai import OpenAI

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

import OpenAI from "openai";

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

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)

FAQ

What is the context window size?

The model supports a 100,000 token context window. This includes both prompt and completion tokens. You can send up to 16,000 tokens in a single response. If you do not set max_tokens, the default is 2,048 tokens.

How do I handle rate limits?

You are limited to 300 requests per minute per key. You can have 8 concurrent requests active at once. If you exceed these limits, the API returns a 429 status code. Implement exponential backoff in your client code for retries.

Is the API uncensored?

Yes, the model does not refuse lawful adult content. It is tuned for unrestricted roleplay and creative writing. The only hard limit is sexual content involving minors. Requests with that content are always refused.

Get your API key in one step

Sign up, copy the key, update the base URL. Done.

Claim trial key