Quickstart: integrate in minutes
Integrate our uncensored LLM into your project using standard OpenAI-compatible endpoints. This guide walks you through authentication, requests, and streaming with concrete code examples.
1. Install your SDK
Start by installing the official library for your language. Most developers prefer the standard package because it matches the interface they already know. Run pip install openai for Python or npm install openai for Node.js. You only need one SDK to handle all requests.
2. Set your base URL
Configure your client to point to our specific endpoint. You must override the default base URL to route traffic correctly. Use https://api.unsencoredai.com/v1 as your base URL. Pass your API key in the Authorization header. This setup works with any standard OpenAI-compatible client.
from openai import OpenAI
client = OpenAI(base_url="https://api.unsencoredai.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)
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unsencoredai.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);
3. Send your first request
Send a standard chat completion request to generate text. The model ID is uncensored. You can send system prompts to guide the behavior. The API returns a direct text response. Use the curl command below to test connectivity immediately. Check your response for the choices array.
curl https://api.unsencoredai.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "what is the version number"}]
}'
4. Handle streaming responses
Enable streaming for lower latency and real-time output. Set stream: true in your request. The API sends chunks via Server-Sent Events. You can process each token as it arrives. This is ideal for chat interfaces or roleplay scenarios. The final chunk contains usage statistics.
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)
5. Configure parameters
Adjust temperature, top_p, and stop sequences. These controls influence creativity and output length. You can also use response_format for JSON mode. The context window supports 100,000 tokens total. Max output is 16,000 tokens per request. Fine-tune these settings for your specific use case.
6. Limits, errors, and context
Handle errors gracefully using standard HTTP status codes. A 401 error means your API key is invalid. A 402 error indicates insufficient prepaid credit. A 429 error signals you hit the 300 requests per minute limit. Your context window is 100,000 tokens. Requests over 8 MB may fail. Refunds are not issued for credit, but errors are free.
Frequently asked questions
Is Unsencored AI an official OpenAI service?
No, we are an independent provider of an uncensored LLM. We use the OpenAI protocol for compatibility, but our model is not GPT-4 or any other vendor's model. You must set the base URL to our endpoint.
What happens if I exceed the rate limit?
You will receive a 429 Too Many Requests error. The limit is 300 requests per minute per key. You can upgrade your prepaid credit to ensure consistent performance during high traffic.
Can I use this for NSFW content?
Yes, the model is uncensored and does not refuse lawful adult content. It only blocks sexual content involving minors. You can generate unrestricted fictional or roleplay text freely.
Generate your API key
Sign up, copy the key, and update your base URL. That is all you need to do.