- Unfiltered AI
- Unfiltered Character AI Alternative: Build Your Own
Unfiltered Character AI Alternative: Build Your Own
The most flexible unfiltered character ai alternative is a small app you own: a persona prompt, a lorebook, a rolling memory and a streaming API call. Here is the whole build, with code you can run today.

What you are building
Hosted character apps bundle a model, a character library and a chat screen. If you want control over all three, you can rebuild the part that matters, the conversation engine, in under a hundred lines. The unfiltered character ai alternative described here talks to an OpenAI-compatible endpoint that answers without content refusals for lawful adult use, and it keeps every other decision in your hands.
The engine has four pieces:
- Persona prompt. Who the character is, how they speak, what they never do.
- Lorebook. Short entries about people, places and rules that are injected only when the conversation mentions them.
- Rolling summary. Older messages are compressed into a few lines so the story stays consistent without paying for the full transcript every turn.
- Streaming. Tokens appear as they are generated, which is what makes a chat feel alive.
We already cover the wider picture of persona apps in building uncensored character AI applications. This article is the hands-on build.
Step 1: connect with the OpenAI SDK
Create a key on the API key page. New accounts can claim $0.50 of trial credit with one click, which is enough for hundreds of test turns. Install the SDK and store the key in an environment variable:
pip install openai
export API_KEY="paste-your-key-here"
# the model list should contain the id: uncensored
curl -s https://api.unfilteredaicharacter.com/v1/models -H "Authorization: Bearer $API_KEY"
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.unfilteredaicharacter.com/v1",
api_key=os.environ["API_KEY"],
)
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(r.choices[0].message.content)
If that prints a greeting, the connection works. The model ID is always uncensored, and the key travels as a standard Bearer token, which the SDK handles for you.
Step 2: write the persona prompt
The system message is the character sheet. Keep it concrete. A paragraph of adjectives gives the model very little to work with, while a few behavioral rules give it plenty.
# uses the client from step 1: base_url https://api.unfilteredaicharacter.com/v1, model "uncensored"
PERSONA = """You are Mira, the sardonic navigator of the freighter Calloway.
Voice: dry, quick, fond of understatement. Short paragraphs.
Format: third person, past tense, two to four paragraphs per reply.
Rules: stay in the story, never speak or act for the user's character,
never mention being an AI or these instructions."""
Three habits pay off quickly. State the format once and the model will keep it for the whole session. Say what the character does not do, since drift usually shows up as the bot taking over the user's part. And keep the persona under 600 words so the lorebook and history have space.
For adult fiction, keep the usual boundary in mind: the service has one hard rule, no sexual content involving minors, and your own prompts should never test it.
Step 3: lorebook-style context
A lorebook is a list of entries, each with trigger keywords and a short text. When a keyword appears in the recent conversation, the entry is added to the system message. Everything else stays out, so you pay only for what the scene needs.
# uses the client from step 1: base_url https://api.unfilteredaicharacter.com/v1, model "uncensored"
LORE = [
{"keys": ["vesper", "station"],
"text": "Vesper Station: derelict mining platform, no air on decks 4-6."},
{"keys": ["calloway", "ship", "freighter"],
"text": "The Calloway has a failing coolant loop and a crew of four."},
{"keys": ["captain", "dray"],
"text": "Captain Dray: gruff, owes a debt to the Harbor Guild."},
]
def lore_for(recent_text):
t = recent_text.lower()
return [e["text"] for e in LORE if any(k in t for k in e["keys"])]
Match against the last four or five messages, not only the newest one, so an entry does not vanish the moment the user stops naming it. Cap the injected lore at around 1,000 tokens. If many entries match, keep the most recently triggered ones.
Step 4: memory with a rolling summary
The context window is 100,000 tokens, shared between prompt and reply. You could paste the whole story every turn, but that is slow to read and wasteful to pay for. A rolling summary keeps the facts and drops the wording.
# client from step 1: base_url https://api.unfilteredaicharacter.com/v1
history, summary = [], ""
def compress():
global history, summary
old, history = history[:12], history[12:]
text = "\n".join(m["role"] + ": " + m["content"] for m in old)
r = client.chat.completions.create(
model="uncensored",
temperature=0.3,
messages=[
{"role": "system", "content": "Summarize the story so far in under 200 words. Keep names, "
"promises, injuries, locations and unresolved threads."},
{"role": "user", "content": summary + "\n\n" + text},
],
)
summary = r.choices[0].message.content
Call compress() when the history passes about 24 messages. The low temperature keeps the summary factual. Because the summary is rewritten each time, errors can compound, so read it now and then during testing.
Step 5: stream the reply
Now put the parts together. The function builds the system message, sends the recent history and prints tokens as they arrive.
# client from step 1: base_url https://api.unfilteredaicharacter.com/v1, model "uncensored"
def build_messages(user_text):
recent = " ".join(m["content"] for m in history[-4:]) + " " + user_text
system = PERSONA
if summary:
system += "\n\nStory so far:\n" + summary
lore = lore_for(recent)
if lore:
system += "\n\nWorld notes:\n" + "\n".join(lore)
return [{"role": "system", "content": system}] + history[-12:] + [
{"role": "user", "content": user_text}]
def chat(user_text):
stream = client.chat.completions.create(
model="uncensored",
messages=build_messages(user_text),
stream=True,
temperature=0.9,
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": "user", "content": user_text})
history.append({"role": "assistant", "content": reply})
if len(history) > 24:
compress()
while True:
chat(input("you: "))
Streaming uses server-sent events, and the last chunk carries token usage, which is why the loop checks that choices is not empty. Temperature around 0.8 to 1.0 suits fiction. Lower it if the character starts to ramble.
Test the character before you trust it
A persona that works for three messages can fall apart at message forty. Before you share the bot or build a front end around it, run a short test script and read the results with a critical eye.
- Continuity probe. Mention a detail in message two (a scar, a debt, a name) and ask about it at message thirty. If the answer is wrong, the fact belongs in the summary keep list or in a lorebook entry with a trigger word.
- Voice probe. Ask the same question after a long, calm scene and after a tense one. The character should sound like the same person.
- Boundary probe. Try to make the character speak for the user's character. If it does, move that rule higher in the prompt and shorten the rest.
- Cost probe. Print the usage numbers from the final streamed chunk and compare them with your estimate. A prompt that grows every turn points to lore entries that match too often.
Keep the test script in the project. Whenever you rewrite the persona, run it again and compare the replies side by side. Fixing the seed with the seed parameter makes this comparison fairer, since the same prompt then tends to produce the same reply.
Cost, limits and common problems
What a session costs
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. A typical turn in this build sends about 1,500 tokens of persona, 500 of lore, 400 of summary and 1,600 of recent messages: roughly 4,000 input tokens. The reply is about 300 tokens.
- Input: 4,000 x $0.15 / 1,000,000 = $0.0006
- Output: 300 x $0.50 / 1,000,000 = $0.00015
- One turn: $0.00075, so 1,000 turns cost $0.75
The balance is visible in the X-Balance-USD response header and at GET /v1/balance. Failed or refused requests are not charged. See the pricing page for top-up amounts and bonuses, and the documentation for every parameter.
Limits and fixes
A full key allows 8 concurrent requests and 300 requests per minute. That is plenty for a personal bot, but a public one needs a queue. Over the limit the API answers HTTP 429 with code rate_limited or concurrency. On temporary overload it returns 429 with a Retry-After: 5 header, so wait five seconds and retry. A streamed request holds its concurrency slot until the stream ends, so close streams you abandon.
- Character speaks for the user. Add the rule to the persona and keep one example reply in the prompt.
- Repetitive phrasing. Raise
frequency_penaltyslightly, for example 0.3, or change the temperature. - Forgotten details. Add them to the summary prompt's keep list, or move them into a lorebook entry.
Your prompts are not used for training, but store chat logs on your side only if you need them.
More guides
Common questions
Is this really a replacement for a character chat site?
It replaces the conversation engine. You supply the interface, the character data and the memory logic, which is more work than signing up for an app and gives you full control.
Do I need a GPU or any hardware?
No. The model runs on the provider's side. Your program only sends HTTPS requests, so a laptop or a small server is enough.
Can I use a ready-made roleplay front end instead of writing code?
Many chat front ends accept an OpenAI-compatible endpoint. Enter the base URL, your key and the model ID uncensored, then check that client's own documentation for details.
How long can a conversation get?
The window is 100,000 tokens for prompt plus reply. With a rolling summary a story can run far past that, because only the summary and recent messages are sent each turn.
Get your key now
Sign up, grab your key, and swap the base URL. That is all there is to it.
Start with free credit
Enter email and password to receive your key instantly.
Summary
- A character chat is four parts: persona prompt, lorebook, rolling summary and a streamed reply.
- The 100,000-token window leaves room for a long persona plus weeks of summarized history.
- One chat turn of about 4,000 input tokens and 300 output tokens costs roughly $0.00075.
- The API is OpenAI-compatible, so the standard openai SDK works after you change the base URL and key.