EN ▾
Get API key

Unfiltered LLM Chat: Build a Simple Client

An unfiltered llm chat is easy to build once you have an OpenAI-compatible endpoint: a loop, a message list and a streaming reader. Below are two minimal clients, one for the terminal and one for the browser, that you can run in minutes.

Updated

Glass chat bubbles above a terminal with streaming particles flowing between them, representing a streaming chat client
Isometric illustration of a local GPU tower linked to a cloud server by a glowing cable, comparing local and hosted LLMs

Key points

  1. A chat client is a message list plus a streaming loop; the API is stateless, so you resend history each turn.
  2. The terminal version is 25 lines of Python with the OpenAI SDK.
  3. For the web, keep the API key on a small server and stream the response to the browser.
  4. Trim old messages before you reach the 100,000-token window, and handle 429 with a retry.

Start with trial credit

Email and password, key on screen right away.

Get API key

What you are building

Two small programs. The first is a terminal chat that streams tokens as they arrive. The second is a web page with a tiny Node server in front of it. Both talk to the same endpoint, https://api.uncensoredllmonline.com/v1, using model uncensored.

This is an unfiltered llm chat in the sense that the model is tuned to answer without content refusals for lawful adult use. It is one open-weight model run by an independent provider, not an official product of any big vendor. Sexual content involving minors is not allowed and is never answered. It is text only.

You need a key. After signing up, claim the $0.50 trial on the API key page; that is plenty for everything in this article. If you would rather use a ready-made app than write one, see the guide to the API client options.

How chat state works

The API does not remember conversations. Every request must carry the whole history as a list of messages: a system message first, then alternating user and assistant messages. The model sees only what you send. Your client owns the memory.

That has a direct effect on cost. At $0.15 per 1M input tokens, a chat that has grown to 8,000 tokens of history costs $0.0012 of input on the next turn (8,000 x $0.15 / 1M). A 300-token reply adds $0.00015. So a turn is about $0.00135, and the trial credit still covers several hundred of them. Output is billed at $0.50 per 1M.

The context window is 100,000 tokens, prompt and completion combined. A normal chat never gets near it, but a long roleplay or document chat can, so plan for trimming (see below).

Terminal client in Python

Install the SDK with pip install openai, set your key and run this:

from openai import OpenAI

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

history = [{"role": "system", "content": "You are a direct, friendly assistant."}]

while True:
    try:
        user = input("\nyou> ").strip()
    except (EOFError, KeyboardInterrupt):
        break
    if not user:
        continue
    history.append({"role": "user", "content": user})

    reply = ""
    stream = client.chat.completions.create(
        model="uncensored", messages=history, stream=True
    )
    print("bot> ", end="", flush=True)
    for chunk in stream:
        if chunk.choices and chunk.choices[0].delta.content:
            piece = chunk.choices[0].delta.content
            reply += piece
            print(piece, end="", flush=True)
    history.append({"role": "assistant", "content": reply})

Notes on the code. stream=True returns chunks; each has a small piece of text in delta.content. The check for chunk.choices matters because the final usage chunk can arrive without choices. The reply is collected into one string and added to history as an assistant message, which is what makes the next turn aware of the last one. Ctrl+C or Ctrl+D ends the session cleanly.

Web client: key on the server, stream to the page

Never put the API key in browser JavaScript. Anyone can read it and spend your credit. Instead, run a small server that adds the key and forwards the stream. This one needs Node 18 or newer and no packages:

import http from "node:http";
import { readFileSync } from "node:fs";

const BASE = "https://api.uncensoredllmonline.com/v1";
const KEY = process.env.API_KEY;

http.createServer(async (req, res) => {
  if (req.method === "GET") {
    res.setHeader("Content-Type", "text/html");
    return res.end(readFileSync("index.html"));
  }
  if (req.method === "POST" && req.url === "/chat") {
    let body = "";
    for await (const c of req) body += c;
    const { messages } = JSON.parse(body);
    const up = await fetch(BASE + "/chat/completions", {
      method: "POST",
      headers: { Authorization: "Bearer " + KEY, "Content-Type": "application/json" },
      body: JSON.stringify({ model: "uncensored", messages, stream: true }),
    });
    res.writeHead(up.status, { "Content-Type": "text/event-stream" });
    for await (const chunk of up.body) res.write(chunk);
    return res.end();
  }
  res.statusCode = 404;
  res.end();
}).listen(3000);

Start it with API_KEY=your_key node server.mjs. In index.html, a text box and a div are enough. The part that matters is reading the server-sent events:

async function send(messages, onText) {
  const r = await fetch("/chat", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ messages }),
  });
  const reader = r.body.getReader();
  const dec = new TextDecoder();
  let buf = "";
  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    buf += dec.decode(value, { stream: true });
    const lines = buf.split("\n");
    buf = lines.pop();
    for (const line of lines) {
      if (line.startsWith("data: ") === false) continue;
      const data = line.slice(6).trim();
      if (data === "[DONE]") return;
      const delta = JSON.parse(data).choices?.[0]?.delta?.content;
      if (delta) onText(delta);
    }
  }
}

Call send(history, text => out.textContent += text), then push the finished reply into your history array. Server-sent events split chunks at arbitrary byte positions, which is why the code keeps a buffer and only parses complete lines.

Keeping long chats healthy

Three things go wrong in longer sessions, and all have simple fixes.

History grows without end

Keep the system message and the most recent N messages, or summarize the oldest part into one message. Counting characters divided by four is a good enough guess for tokens. Aim to stay far below 100,000.

429 errors

A full key allows 8 concurrent requests and 300 per minute; a trial key allows 2 and 60. If you see HTTP 429 with code rate_limited or concurrency, wait a moment and retry. A temporary overload also returns 429 with Retry-After: 5. A streamed request holds its concurrency slot until the stream ends, so a user who closes the tab should have the connection aborted on the server.

Tone drifts

The system message sets behavior. Keep it short and specific, lower temperature for consistency and raise it for creative writing. Parameters such as top_p, stop and seed are passed through.

From prototype to something you share

If other people will use your chat, add per-user rate limits on your server so one person cannot drain the balance. Show a clear message when a request fails, and remember that failed or refused requests are not charged. You can read the remaining balance from the X-Balance-USD response header, or call GET /v1/balance.

When the trial runs out, top up any whole amount from $20 to $500. Bigger top-ups carry a bonus of +5% from $50, +10% from $100 and +15% from $200, and credit never expires. You can pay with crypto. The pricing page has the details, and the docs list every endpoint, including /v1/responses if you prefer that format.

Questions and answers

Do I need to send the full history on every request?

Yes. The API is stateless, so your client sends the system message and earlier turns each time.

Can the browser call the API directly?

Technically possible, but it would expose your key. Keep the key on a server and stream the response through it.

How do I get streaming output?

Set stream to true. The response arrives as server-sent events, with token usage reported at the end.

What happens if I hit a rate limit?

You get HTTP 429 with the code rate_limited or concurrency. Wait and retry; if the header Retry-After: 5 is present, wait that many seconds.

Your key is one form away

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

Get API keyRead the docs