Quickstart with the uncensored api

Integrate our uncensored AI API in minutes using standard OpenAI SDKs. This guide covers authentication, requests, streaming, and cost tracking.

Prerequisites and SDK setup

Our API works with any OpenAI-compatible client. You only need an API key from our dashboard.

Install the standard SDK for your language. For Python, run pip install openai. For Node.js, run npm install openai. We use the standard OpenAI class.

Set your base URL to our endpoint. This ensures all requests route correctly to our uncensored LLM.

Authentication with your API key

Pass your API key in the Authorization header. We require this for every request.

Generate your key on the "Get API key" page. You can sign in with Google or use email and password.

Keep your key secure. A single key is active per account. If you lose it, generate a new one to replace the old one.

Sending your first chat completion

Send a POST request to /v1/chat/completions. Specify the model as uncensored.

Include your message in the messages array. The model will return a text response.

Here is a curl example:

curl https://api.llmsuncensored.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Set the timeout to 30 seconds for the request"}]
  }'

Handling streaming responses via SSE

Use streaming for real-time output. Set stream to true in your request.

The API sends Server-Sent Events. Each chunk contains partial text.

Collect all chunks to build the full response. This is ideal for chat interfaces.

Example in Python:

from openai import OpenAI

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

Configuring parameters like temperature

Adjust parameters to control creativity. Use temperature for randomness.

Set top_p for nucleus sampling. Use max_tokens to limit output length.

We support a context window of 100,000 tokens. This allows long conversations.

Node.js example:

import OpenAI from "openai";

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

Understanding token usage and costs

Pay only for what you use. Credit is prepaid and never expires.

Input tokens cost $0.15 per 1M. Output tokens cost $0.50 per 1M.

Errors and refusals are free. Check the last chunk for token usage.

Stream example:

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)

Frequently asked questions

What is the uncensored LLM API context window?

Our API supports a 100,000 token context window. This includes both prompt and completion tokens. You can send long documents or have extended conversations.

Why do I get a 401 error?

A 401 error means your API key is invalid or missing. Check your key in the dashboard. Ensure you are using the correct base URL.

How do I handle a 429 rate limit?

You hit the limit of 300 requests per minute. Wait and retry. You can also reduce concurrent requests to 8 per key.

Get your API key now

Sign up, grab your key, and point your API to the new base URL. Setup takes seconds.

Get your key