EN ▾
Get API key

No Filter AI Chatbot: Build One Without Refusals

A no filter ai chatbot is a normal chatbot built on a model that does not decline ordinary adult requests. This guide builds one in Python with a system prompt, a rolling memory and a saved history, and shows what each part costs.

Updated

Glass chat bubble linked to stacked memory tiles and a scroll, showing chatbot memory design

Key points

  • A chatbot is a loop: keep a message list, send it each turn, append the reply.
  • The system prompt sets persona and rules; memory is what you keep from older turns.
  • Trim or summarize history before it grows, since you pay input price for all of it every turn.
  • The code works with the OpenAI SDK against model uncensored; a 20-turn chat costs under a cent.

How a chatbot works under the hood

The chat API has no memory. Every request must contain everything the model should know: instructions, earlier messages and the new message. A chatbot is therefore a loop around one list of messages.

  1. Start the list with a system message that defines the persona and the rules.
  2. Append the user's message with role user.
  3. Send the whole list to POST /v1/chat/completions.
  4. Append the reply with role assistant, and show it.
  5. Repeat.

"No filter" describes the model, not the loop. 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 model vendor. The hard limit that remains: no sexual content involving minors.

Step 1: a minimal bot

First, get a key from the API key page. New accounts can claim $0.50 of trial credit there with no card. Then install the SDK with pip install openai and run this.

from openai import OpenAI

client = OpenAI(base_url="https://api.nofilterai.cc/v1", api_key="YOUR_KEY")

messages = [{"role": "system", "content": "You are Rook, a dry-witted companion. Keep replies under 120 words."}]

while True:
    user = input("you> ")
    if user.strip() in {"/quit", ""}:
        break
    messages.append({"role": "user", "content": user})
    resp = client.chat.completions.create(model="uncensored", messages=messages, temperature=0.8)
    reply = resp.choices[0].message.content
    messages.append({"role": "assistant", "content": reply})
    print("bot>", reply)

That is a complete chatbot. It forgets everything when you close the terminal, and its prompt grows each turn. The next steps fix both.

Step 2: write a system prompt that holds up

The system prompt does more for the quality of a chatbot than any sampling setting. A good one has four parts:

  • Identity. Who the bot is, in one or two sentences.
  • Voice. Sentence length, humor, formality. Give an example line if the voice is unusual.
  • Boundaries. What the bot should do when a topic is out of scope. State your own rules; an uncensored model follows the rules you write, because it has fewer built-in ones.
  • Format. Plain text, no lists, a word limit.

Because the model will not refuse on its own, you are responsible for the rules of your product. If your bot serves the public, add them to the prompt and add a moderation step in your code. Your terms of use and local laws apply; this service is for lawful adult use only. For longer prose-oriented bots, no filter AI for writing covers prompt patterns that suit fiction.

Step 3: add memory that does not explode

Memory means choosing what to put back in the prompt. Three layers work well together.

  1. Recent turns verbatim, for example the last 12 messages.
  2. A running summary of everything older, written by the model itself.
  3. Pinned facts such as the user's name or preferences, stored in a small dict and placed in the system prompt.
import json, os
from openai import OpenAI

client = OpenAI(base_url="https://api.nofilterai.cc/v1", api_key="YOUR_KEY")
PATH = "chat.json"
KEEP = 12

state = json.load(open(PATH)) if os.path.exists(PATH) else {"summary": "", "facts": {}, "turns": []}

def system_prompt():
    facts = "; ".join(f"{k}: {v}" for k, v in state["facts"].items())
    return ("You are Rook, a dry-witted companion. Keep replies under 120 words.\n"
            f"Known facts: {facts or 'none'}\n"
            f"Summary of earlier conversation: {state['summary'] or 'none yet'}")

def compress():
    if len(state["turns"]) <= KEEP:
        return
    old, state["turns"] = state["turns"][:-KEEP], state["turns"][-KEEP:]
    text = "\n".join(f"{m['role']}: {m['content']}" for m in old)
    r = client.chat.completions.create(model="uncensored", temperature=0.2, messages=[
        {"role": "system", "content": "Update the summary. Keep names, facts and open threads. Max 150 words."},
        {"role": "user", "content": f"Current summary: {state['summary']}\n\nNew messages:\n{text}"}])
    state["summary"] = r.choices[0].message.content

while True:
    user = input("you> ")
    if not user.strip():
        break
    state["turns"].append({"role": "user", "content": user})
    msgs = [{"role": "system", "content": system_prompt()}] + state["turns"]
    r = client.chat.completions.create(model="uncensored", messages=msgs, temperature=0.8)
    reply = r.choices[0].message.content
    state["turns"].append({"role": "assistant", "content": reply})
    print("bot>", reply)
    compress()
    json.dump(state, open(PATH, "w"))

The chat file survives restarts, the prompt stays at a roughly constant size, and the summary call uses a low temperature so it does not invent details. To fill state["facts"], ask the model to return JSON with response_format={"type": "json_object"} once in a while and merge the result.

Step 4: stream replies and handle errors

A chatbot feels faster when text appears as it is written. Pass stream=True and print each chunk. Remember that a streamed request holds one of your concurrent slots (8 on a full key, 2 on a trial key) until it ends, so do not start a second reply before the first finishes.

Handle HTTP 429 with a short wait. A Retry-After: 5 header means temporary overload, and the error codes rate_limited and concurrency mean you went over a limit. The API docs list the limits and headers.

Fixing common chatbot problems

  • The bot repeats phrases. Raise frequency_penalty or presence_penalty slightly, for example to 0.3. Both are passed through to the model.
  • Replies ramble. Put a word limit in the system prompt and set max_tokens as a hard cap. Completion length is otherwise limited only by the window.
  • The persona drifts after many turns. Repeat the key lines of the persona at the end of the system prompt, since recent text carries more weight than distant text.
  • The summary loses details. Add "keep names, dates and open threads" to the summary prompt and read a few summaries by hand to check them.
  • Results differ between runs. Set seed and a low temperature while you test, then loosen both for production.

Test with a script of 15 to 20 user messages that you replay after every prompt change. It takes a minute and catches regressions you would otherwise find in production.

What a chatbot costs to run

Price is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Say the system prompt with summary is 400 tokens, each turn adds 200 tokens of history, and each reply is 150 tokens. A 20-turn chat sends 20 x 400 + 200 x (0 + 1 + ... + 19) = 8,000 + 38,000 = 46,000 input tokens, plus 3,000 output tokens.

That is $0.0069 for input and $0.0015 for output, a total of $0.0084. A thousand such chats cost $8.40. The rolling window in step 3 keeps long chats from growing past that ceiling. See the pricing page for top-ups from $20 to $500 and the volume bonuses.

If your goal is a character with a defined personality, the Character AI API page covers persona design in more depth.

Questions and answers

Do I need a database for chatbot memory?

Not to start. A JSON file works for one user. Move to a database when several users share the bot, and keep one state record per user.

Will the bot refuse requests?

The model is tuned to answer without content refusals for lawful adult use. It still follows the rules in your system prompt, and sexual content involving minors is never allowed.

How long can the chat history be?

The context window is 100,000 tokens for prompt plus reply. Trimming and summarizing keep cost and latency down long before you reach it.

Can the bot call tools?

Yes. The API supports tool calling with tools and tool_choice, and tool results go back as role tool messages.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.