Build an Unfiltered AI Chatbot on an LLM API
A chatbot that does not refuse every second prompt takes about forty lines of code and an API key. This walkthrough builds one with streaming, a persona prompt and a history that stays inside the 100,000-token window.
Updated

On this page
What you are building
An unfiltered ai chatbot, in practical terms, is a chat application whose language model does not stop to lecture, soften or decline requests that are legal and aimed at adults. Fiction writers, roleplay communities and companion apps run into refusals constantly with general-purpose assistants, and the usual fix is to put your own interface in front of a model that is tuned differently.
The model behind this API is one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official API of any big vendor and it is not a router across several models. There is one model ID, uncensored, and one main endpoint, POST /v1/chat/completions. That simplicity is useful: your bot has no model picker, no fallback chain and no per-vendor quirks to handle.
One hard limit applies and you should build it into your product as well: sexual content involving minors is never allowed. If your bot lets users define characters, add a check on your side that rejects any character described as a minor in a sexual setting. The API will not make that call for you in every case, and your users deserve a clear rule.
Set up the key and the client
Sign up on the API key page with Google or with an email and password. New accounts can claim $0.50 of trial credit with one click on that page. It lasts 7 days, needs no payment details and is limited to one per person. That is enough to run the code below many times over.
Because the API speaks the OpenAI wire format, you install the usual SDK and change two settings: the base URL and the key. Everything else, including message roles, temperature, top_p, stop, seed and the penalty parameters, behaves the way the SDK documentation says.
pip install openai
export API_KEY="your-key-here"
# quick check that the key works and the model is listed
curl https://api.unfilteredaichatbot.cc/v1/models \
-H "Authorization: Bearer $API_KEY"
# one chat completion with the model ID uncensored
curl https://api.unfilteredaichatbot.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "uncensored", "messages": [{"role": "user", "content": "Hello"}]}'The GET /v1/models call should list uncensored. If you get a 401, the key is wrong or the header is missing the word Bearer. The quickstart in the docs shows the same check with more detail.
A streaming chat loop in Python
The loop below is the whole core of a command-line bot. It keeps the conversation in a list, sends the list every turn, prints tokens as they arrive and appends the finished reply so the next turn has context. The model has no memory between requests, so this list is the memory.
import os
from openai import OpenAI
BASE_URL = "https://api.unfilteredaichatbot.cc/v1"
MODEL = "uncensored"
client = OpenAI(base_url=BASE_URL, api_key=os.environ["API_KEY"])
SYSTEM = (
"You are Mara, a dry-witted ship's navigator in an adult sci-fi story. "
"Stay in character. Write in short paragraphs. Never describe yourself as an AI."
)
history = [{"role": "system", "content": SYSTEM}]
while True:
user = input("you> ")
if not user:
break
history.append({"role": "user", "content": user})
stream = client.chat.completions.create(
model=MODEL,
messages=history,
stream=True,
temperature=0.8,
top_p=0.95,
)
reply = ""
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
piece = chunk.choices[0].delta.content
print(piece, end="", flush=True)
reply += piece
print()
history.append({"role": "assistant", "content": reply})Streaming runs over server-sent events when you pass stream: true, and the final chunk carries token usage. Log that number per user, because it is the cheapest way to see where your money goes. The response headers also help: X-Balance-USD shows what is left on the key and X-Request-Id is the value to quote if you ever contact support.
If you build for the web, the same call works from Node with the official SDK. Use the same two settings and read the stream with for await.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.unfilteredaichatbot.cc/v1",
apiKey: process.env.API_KEY,
});
const stream = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Introduce yourself in two sentences." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Write a system prompt that holds a character
Without refusals getting in the way, the quality of your bot depends on the system prompt. Vague prompts produce vague characters. A few habits make a visible difference.
- Give a role and a voice. "Dry-witted ship's navigator who answers in short paragraphs" beats "be a helpful character".
- State the format. Say whether replies include actions in asterisks, whether the bot writes in first person, and how long a reply should be.
- Put hard rules last and keep them short. Two or three lines on what the character never does are followed better than a page of them.
- Keep the minors rule on your side. Reject character definitions that make a minor part of adult content before the text ever reaches the model.
Sampling matters too. A temperature around 0.7 to 0.9 suits fiction and companion chat. Drop to 0.3 or lower when the bot needs to follow a strict format. If the bot repeats phrases across turns, raise frequency_penalty a little, for example to 0.3, rather than raising temperature until the replies get strange. Setting a seed makes tests repeatable.
For a longer treatment of adult-oriented use, including how this differs from trying to coax a mainstream assistant, see the page on uncensored models for adult content.
Keep the history inside the context window
The context window is 100,000 tokens, counting the prompt and the completion together. That is large, but a companion bot that talks daily will reach it eventually, and a bigger prompt also costs more on every turn because the whole history is billed as input each time.
A simple policy works for most bots: keep the system prompt, keep the most recent messages, and drop or summarise the middle. The function below estimates tokens as characters divided by four, which is rough but safe for English text, and trims from the oldest end.
from openai import OpenAI
BASE_URL = "https://api.unfilteredaichatbot.cc/v1"
MODEL = "uncensored"
client = OpenAI(base_url=BASE_URL, api_key="YOUR_KEY")
BUDGET = 60000 # tokens we allow for history, well under 100,000
def rough_tokens(msg):
return len(msg["content"]) // 4 + 4
def trim(history):
system, rest = history[0], history[1:]
while rest and sum(rough_tokens(m) for m in [system] + rest) > BUDGET:
rest.pop(0)
return [system] + rest
def summarise(old_messages):
text = "\n".join(m["role"] + ": " + m["content"] for m in old_messages)
r = client.chat.completions.create(
model=MODEL,
messages=[{"role": "user",
"content": "Summarise the key events and facts below in 150 words:\n" + text}],
temperature=0.2,
)
return r.choices[0].message.contentRun summarise on the messages you are about to drop and store the result as one extra system message. The bot then remembers that the captain was betrayed in chapter two without carrying fifty thousand tokens of dialogue. Leave headroom in the budget: the completion shares the window with the prompt, and max_tokens is optional, so a reply can use whatever is left.
Add tools and JSON output for real features
A chatbot gets more useful when it can do things. Tool calling follows the OpenAI format: you pass tools and optionally tool_choice, the model replies with tool_calls (also streamed), and you send results back as messages with role: "tool". Typical uses in a character bot are rolling dice, reading a stored character sheet, saving a fact to long-term memory or looking up the current time in the story world.
from openai import OpenAI
client = OpenAI(base_url="https://api.unfilteredaichatbot.cc/v1", api_key="YOUR_KEY")
tools = [{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll an n-sided die and return the result",
"parameters": {
"type": "object",
"properties": {"sides": {"type": "integer"}},
"required": ["sides"],
},
},
}]
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "I try to pick the lock. Roll a d20."}],
tools=tools,
tool_choice="auto",
)
print(resp.choices[0].message.tool_calls)JSON mode is the other building block. Pass response_format={"type": "json_object"} and tell the model in the prompt which keys you want. It is a good fit for a background job that extracts a memory such as {"fact": "...", "importance": 3} from each exchange, which you store and feed back into the system prompt later. Always parse with a try block anyway, since no model is perfect at following a schema.
Plan for rate limits when real users arrive
A single-user bot never meets a limit. A bot with a community does. A full key allows 8 concurrent requests and 300 requests per minute. The trial key allows 2 and 60. Going over returns HTTP 429 with the error code rate_limited for the per-minute limit or concurrency for too many requests at once. A temporary overload also returns 429, with a Retry-After: 5 header.
Streaming has one trap: a streamed request holds its concurrency slot until the stream ends. If your front end opens a stream and the user closes the tab, make sure your server closes the upstream connection too, or the slot stays busy. With 8 slots, a few abandoned streams hurt.
import time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.unfilteredaichatbot.cc/v1", api_key="YOUR_KEY", max_retries=0)
def ask(messages, tries=4):
for attempt in range(tries):
try:
return client.chat.completions.create(model="uncensored", messages=messages)
except RateLimitError:
time.sleep(5 * (attempt + 1))
raise RuntimeError("still rate limited after retries")For anything with more than a handful of simultaneous users, put a small queue in front of the API with a worker count of 8 or less, and show a typing indicator while a message waits. Requests that fail or are refused are not charged, so retries cost nothing extra.
What a chatbot costs to run
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit with no subscription. Credit never expires. Top-ups on this site are crypto only, USDT on TRC20 or USDC on Base, in any whole amount from $20 to $500, with a bonus of 5% from $50, 10% from $100 and 15% from $200. See the pricing page for the current table.
Take a 50-turn conversation with a 500-token system prompt. Each turn the user adds about 150 tokens and the bot answers with about 300. Input grows every turn because the whole history is resent. Adding up the 50 requests gives 583,750 input tokens and 15,000 output tokens. Input costs 583,750 x $0.15 / 1,000,000, about $0.0876. Output costs 15,000 x $0.50 / 1,000,000, which is $0.0075. The full conversation comes to about $0.095.
At that rate the $0.50 trial covers around five such conversations, and a $20 top-up covers over 200. Trimming or summarising history is the main lever: the input side dominates, so a shorter prompt saves more than a shorter reply.
More guides
Questions and answers
Does an unfiltered chatbot mean anything goes?
No. The model is tuned to avoid refusals for lawful adult use, but sexual content involving minors is a hard limit, and you are responsible for what your own app allows its users to do.
Can I use an existing OpenAI-based bot with this API?
Usually yes. Change the base URL and the key, set the model to uncensored, and test streaming and tool calls. Only the text chat completions features listed in the docs are available.
Does the bot remember earlier conversations?
Not by itself. Each request is independent, so your code must resend the history or a summary of it, within the 100,000-token window.
Are my users' messages used for training?
No. Prompts are not used for training.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Key points
- Point any OpenAI SDK at the base URL, use the model ID uncensored, and you have a working chat loop.
- Stream replies over SSE so the bot feels fast, and keep your own message history on the client.
- Plan for 8 concurrent requests and 300 requests per minute on a full key, and 2 and 60 on the trial key.
- A 50-turn conversation costs roughly a tenth of a dollar at $0.15 and $0.50 per 1M tokens.
Start with trial credit
Email and password, key on screen right away.