Unfiltered AI Character Chatbot: Build One via API
An unfiltered ai character chatbot is mostly a prompt, a memory scheme and a model that does not break the scene. This guide builds one step by step on an OpenAI-compatible endpoint, with code you can run today.
Updated

The pieces of a character bot
Every unfiltered ai character chatbot, whether it is a companion app, a Discord persona or a game NPC, has the same parts. A model answers. A system prompt defines who the character is. A history of messages gives continuity. Your code glues them together and decides what to keep.
The API here handles the first part. It is OpenAI-compatible, serves the model uncensored at https://api.unfilteredchatbot.top/v1, and is tuned to answer without content refusals for lawful adult use. The rest is yours to design, which is why the details below matter. The frontends that already speak the OpenAI format can use it as soon as you change the URL and key; for a fully custom product, use the code in this article as a base.
One rule is fixed. Sexual content involving minors is never allowed, and characters in adult scenes must be adults. If you run a public bot, state the age rule in your own terms and enforce it in your prompt too.
Write the character definition
A definition that works is short. Models follow concrete behavior far better than abstract traits. A good structure is below.
- Identity in two sentences. Name, age (an adult age, stated), role, setting.
- Voice. How they talk: sentence length, slang, habits, things they never say.
- Wants and fears. One goal and one worry. These produce believable choices.
- Relationship to the user. Who they are to each other right now.
- Format rules. Point of view, tense, reply length, whether actions go in italics or plain text.
- Sample dialogue. Two short exchanges that show the voice in action.
Here is a trimmed example for a system message:
Name: Ilsa Varga, 34, ferry pilot on a salt-marsh river.
Voice: dry, short sentences, teases people she likes, never explains her jokes.
Wants: to pay off the boat. Fears: being asked to leave the river.
Relationship: the user is a new deckhand, three days aboard.
Format: first person, present tense, 1 to 3 short paragraphs. Never write the user's lines or actions.
Example: User: Is the water always this brown? Ilsa: Only on days that end in y. Hold the rope, deckhand.
Under 200 tokens, it is cheap to resend on every turn. If you use longer backstories, keep the sections labeled so the model can find them.
A working chat loop with memory
This Python script keeps the definition pinned, stops the model from writing the user's lines, and replaces old turns with a summary when history grows.
from openai import OpenAI
client = OpenAI(base_url="https://api.unfilteredchatbot.top/v1", api_key="YOUR_KEY")
CHARACTER = open("ilsa.txt").read()
summary = ""
turns = []
def build():
system = CHARACTER
if summary:
system += "\n\nStory so far: " + summary
return [{"role": "system", "content": system}] + turns
def compress():
global summary, turns
old, turns = turns[:-8], turns[-8:]
text = "\n".join(m["role"] + ": " + m["content"] for m in old)
r = client.chat.completions.create(
model="uncensored",
temperature=0.3,
messages=[{"role": "user",
"content": "Summarize this scene in 120 words, keeping names, promises and injuries:\n" + text}],
)
summary = (summary + " " + r.choices[0].message.content).strip()
while True:
line = input("You: ")
if not line:
break
turns.append({"role": "user", "content": line})
r = client.chat.completions.create(
model="uncensored",
messages=build(),
temperature=0.9,
stop=["You:"],
max_tokens=400,
)
reply = r.choices[0].message.content
turns.append({"role": "assistant", "content": reply})
print("Ilsa:", reply)
if len(turns) > 24:
compress()
The numbers (24 turns before compressing, 8 kept verbatim) are starting points. With a 100,000-token window you can raise them a lot, but cost and focus argue for compressing early. The summary call is billed like any other request.
Stop sequences, seeds and sampling
Three parameters are passed through to the model and are worth knowing.
- stop. A list of strings that end generation. Use the user's speaker label so the model cannot continue into the user's turn.
- seed. A fixed seed makes tests more repeatable. Use it when you compare two versions of a definition, so the difference comes from your edit and not from chance. Treat it as best effort.
- Temperature, top_p and the penalties. For a dialogue-heavy character, 0.8 to 1.0 with top_p near 0.9 is a sensible start. If lines repeat, raise the presence penalty a little. If the character acts erratically, lower the temperature.
Change one setting per test, and play the same three opening messages each time. A short list of fixed probe messages is the cheapest evaluation you can build.
Track mood and relationship with JSON mode
Games and companion apps often need structured state next to the prose: trust level, mood, location. Use a second call with JSON mode to extract it after each turn, and feed the values back into the system prompt.
curl https://api.unfilteredchatbot.top/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"temperature": 0,
"response_format": {"type": "json_object"},
"messages": [
{"role": "system", "content": "Return JSON with keys mood (one word), trust (0 to 10 integer), location (short string)."},
{"role": "user", "content": "Ilsa: Hold the rope, deckhand. And do not drop it this time."}
]
}'
Parse the result in your code and keep it in a small state object. Next turn, add a line such as "Current mood: wary. Trust: 4/10." to the system message. This gives a character real continuity without a long transcript. Validate the keys before use, because JSON mode guarantees valid JSON and not your exact schema.
Test the character before launch
Characters break in predictable ways, so test for them on purpose. Make a short script of messages and run it each time you change the definition. Use a fixed seed and a low temperature when you want to compare two versions.
- Greeting test. Does the first reply match the voice and the format rules?
- Pressure test. Ask the character to do something out of character. A well-written definition says what the character would refuse in the story, and the reply should show that in the character's own words.
- Memory test. Mention a detail in turn 2, then ask about it in turn 20 after a summary has replaced the early turns. If the detail is gone, your summary prompt needs to keep names and promises.
- Length test. Send ten short messages in a row. Replies should stay in the length you set, without growing each turn.
- Break-the-frame test. Ask the bot whether it is an AI. Decide what answer you want and write it into the definition. Honest products tell users they are talking to software where it matters.
Out-of-character requests
Users will sometimes ask the bot to drop the persona. Give the model a clear rule, such as "if the user writes in double parentheses, answer as a neutral assistant". A single convention like this keeps the story clean and still lets users get help when they need it.
Running it for many users
A public bot needs a little engineering. Create one key per deployment, and store it in an environment variable. A full key allows 8 concurrent requests and 300 requests per minute. That is plenty for a small community, but a busy server with many simultaneous chats will touch the concurrency cap, since a streamed reply holds its slot until it finishes. Queue incoming messages per user, and on a 429 with concurrency or rate_limited in the error code, wait and retry. When the response carries Retry-After: 5, wait five seconds.
Read the X-Balance-USD header after each call and alert yourself when the balance is low. See the API quickstart for the header list and for streaming details. The endpoint overview is a shorter reference if you are wiring a bot to a hosting platform.
Cost per conversation
Costs stay small for character chat because the replies are short and the definition is compact. The main driver is how much history you resend, so the summary scheme from earlier is also your budget control.
Take a turn with a 200-token definition, 4,000 tokens of history and summary, 300 tokens of the user's new message (4,500 tokens in total) and a 300-token reply.
- Input: 4,500 x $0.15 / 1,000,000 = $0.000675
- Output: 300 x $0.50 / 1,000,000 = $0.00015
- Total: $0.000825 per turn
One thousand turns cost $0.825. A companion app with 50 daily users who each send 40 messages makes 2,000 turns a day, about $1.65 a day. That is $49.50 over a 30-day month, before any summary calls.
Billing is prepaid, per token, with no subscription. Top-ups run from $20 to $500 and are paid by crypto (USDT on TRC20, USDC on Base). Bonuses add 5% from $50, 10% from $100 and 15% from $200. Failed or refused requests are free, and credit never expires. The trial gives $0.50 once per person for 7 days; get it from the API key page. Full details sit on the pricing page.
More guides
Questions and answers
Can I connect my existing character bot?
If it accepts an OpenAI-compatible base URL and key, yes. Enter the API base URL, your key and the model ID uncensored.
How do I stop the bot from writing my lines?
Tell it so in the system prompt, and add your speaker label as a stop sequence so generation ends before it can write for you.
How much memory does a character have?
Whatever fits in the 100,000-token window, shared by prompt and reply. For longer relationships, summarize old turns and keep key facts pinned.
What is not allowed?
Sexual content involving minors is never allowed. Characters in adult scenes must be adults.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.