EN ▾
Get API key

Uncensored AI App Creator: Build a Streaming Chat App

If you want an uncensored ai app creator, the practical route is to write a small app yourself on top of a hosted text API. This walkthrough builds a streaming chat app with a Node server and a plain web page.

A server streaming glowing dots into a browser window of chat bubbles, showing a streaming chat app

Updated

No card needed. After sign-up, claim $0.50 of free test credit with one click (once per person).

Get API key

The plan in six steps

You do not need a framework to ship something useful. Here is what we will do, in order.

  1. Get an API key and test it from the terminal.
  2. Create a Node project with Express and the OpenAI SDK.
  3. Write a server route that accepts chat history and streams the model's reply.
  4. Write a browser page that reads the stream and shows text as it arrives.
  5. Add limits and error handling so one busy minute does not break the app.
  6. Estimate running costs and decide how to charge or cap your users.

The backend is a hosted, OpenAI-compatible text API with a single open-weight model, uncensored, tuned to answer without content refusals for lawful adult use. It has no image, audio or video generation and no embeddings, so the app we build is text in, text out. That is enough for roleplay companions, interactive fiction, writing assistants and private journaling bots.

Step 1: key and a first request

Sign up on the key page with Google or with email and password, then claim the one-click trial of $0.50. It lasts 7 days and no payment is needed. Copy the key and run:

curl https://api.uncensoredimagegenerator.cc/v1/models \
  -H "Authorization: Bearer YOUR_KEY"

curl https://api.uncensoredimagegenerator.cc/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Name a ship and its captain."}],"max_tokens":60}'

The first call lists the model. The second returns a completion. If either fails, fix it now: a 401 means a mistyped key, and a 404 usually means a mistyped path. The base URL ends with /v1.

Step 2: set up the project

mkdir chat-app && cd chat-app
npm init -y
npm install express openai
mkdir public

Set "type": "module" in package.json so the import syntax below works. Store the key in an environment variable called API_KEY. Do not paste it into a file you might commit, and never serve it to the browser.

Step 3: the streaming server

The server receives the conversation as JSON, adds a system prompt that defines your app's character, and relays the stream to the browser as server-sent events.

// server.js
import express from "express";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.uncensoredimagegenerator.cc/v1",
  apiKey: process.env.API_KEY,
});

const SYSTEM = "You are Mara, a dry-witted ship's navigator in a space adventure. Stay in character.";
const MAX_ACTIVE = 8;
let active = 0;

const app = express();
app.use(express.json({ limit: "1mb" }));
app.use(express.static("public"));

app.post("/chat", async (req, res) => {
  if (active >= MAX_ACTIVE) {
    return res.status(503).json({ error: "Busy, try again in a few seconds." });
  }
  active++;
  res.setHeader("Content-Type", "text/event-stream");
  res.setHeader("Cache-Control", "no-cache");

  const controller = new AbortController();
  req.on("close", () => controller.abort());

  try {
    const stream = await client.chat.completions.create(
      {
        model: "uncensored",
        messages: [{ role: "system", content: SYSTEM }, ...req.body.messages],
        temperature: 0.9,
        stream: true,
      },
      { signal: controller.signal }
    );
    for await (const chunk of stream) {
      const text = chunk.choices?.[0]?.delta?.content;
      if (text) res.write(`data: ${JSON.stringify(text)}\n\n`);
    }
    res.write("data: [DONE]\n\n");
  } catch (err) {
    if (controller.signal.aborted === false) {
      res.write(`event: problem\ndata: ${JSON.stringify(err.message)}\n\n`);
    }
  } finally {
    active--;
    res.end();
  }
});

app.listen(3000, () => console.log("http://localhost:3000"));

Three details matter here. The abort controller cancels the upstream request when the visitor closes the tab, which ends the stream and frees the slot. The counter stops the app from sending a ninth request at once, since a full key allows 8 concurrent requests and a streamed request holds its slot until the stream ends. And the system prompt lives on the server, so users cannot edit it.

Step 4: the browser page

The page posts the history and reads the response body as a stream. We use fetch because EventSource cannot send a POST body.

// public/app.js
const history = [];
const log = document.getElementById("log");
const form = document.getElementById("form");
const input = document.getElementById("input");

form.addEventListener("submit", async (e) => {
  e.preventDefault();
  const text = input.value.trim();
  if (text === "") return;
  input.value = "";
  history.push({ role: "user", content: text });
  log.insertAdjacentHTML("beforeend", "<p class='me'></p><p class='bot'></p>");
  const [me, bot] = Array.from(log.querySelectorAll("p")).slice(-2);
  me.textContent = text;

  const res = await fetch("/chat", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ messages: history }),
  });
  if (res.ok === false) { bot.textContent = "The server is busy. Try again."; return; }

  const reader = res.body.getReader();
  const decoder = new TextDecoder();
  let buffer = "";
  let reply = "";
  while (true) {
    const { value, done } = await reader.read();
    if (done) break;
    buffer += decoder.decode(value, { stream: true });
    const events = buffer.split("\n\n");
    buffer = events.pop();
    for (const ev of events) {
      if (ev.startsWith("data: ") === false || ev === "data: [DONE]") continue;
      reply += JSON.parse(ev.slice(6));
      bot.textContent = reply;
    }
  }
  history.push({ role: "assistant", content: reply });
});

Pair it with a short public/index.html that has a div id="log", a form with id form and a text input with id input, and loads the script. Run API_KEY=your_key node server.js and open the local address. You should see words appear as they are generated.

Step 5: limits, errors and safety

The model is willing to write fiction for lawful adult use, which makes your own guardrails more important, not less. Decide who may use the app and tell them what it is. If it is for adults, say so on the first screen. Sexual content involving minors is a hard limit of the service, and your app should never invite it.

On the technical side, add these before real users arrive:

  • Retry on 429. The API answers 429 with code rate_limited past 300 requests per minute (60 on trial) and with code concurrency past 8 requests at once (2 on trial). During short overload it also sends Retry-After: 5. Wait that long and try once more before showing an error.
  • Trim the history. The window is 100,000 tokens for prompt and completion together. Keep the last N messages or summarize older ones, otherwise cost per message grows with every turn.
  • Cap your users. A simple per-user daily message limit protects your credit from one enthusiastic visitor.
  • Log request IDs. The X-Request-Id response header identifies a call, which helps when you ask support about a single failure. Parameter details are in the API documentation.
  • Watch the balance. X-Balance-USD comes back on responses, so a nightly check can warn you before credit runs out.

Keeping conversations and users in order

The tutorial keeps history in the browser tab, so refreshing the page loses the chat. For a real product, store each conversation on the server under a user ID and send only the trimmed history to the API. A small SQLite file is enough for a first version. Keep the stored text as private as you can: prompts sent to the API are not used for training, but what you save on your own server is your responsibility, including deletion when a user asks.

Identity can stay simple at first. A session cookie and a per-session message counter give you the daily cap mentioned above. When you add accounts, rate limit by account and not by IP address alone, since several people can share one address.

Think about the system prompt as part of the product. Put persona, tone and boundaries there, and keep it under a few hundred words. Because it is resent with each call, a long prompt raises the cost of every message. If users can pick between characters, store each persona as a separate short prompt and pick one on the server.

Step 6: what running it costs

Billing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit with no subscription. For the chat above, assume a message sends 1,200 tokens of system prompt and trimmed history and gets back 400 tokens.

  • Input: 1,200 tokens × $0.15 per 1M = $0.00018.
  • Output: 400 tokens × $0.50 per 1M = $0.0002.
  • Per message: $0.00038.

Ten thousand messages come to $3.80. A $20 top-up covers more than 52,000 messages at that size. Failed or refused requests are not charged, and credit never expires, so a slow month costs you nothing. 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. The pricing page has the details.

If your visitors pay you, charge a margin over this number and keep the per-user cap in place. If the app is free, the cap is your budget. Either way, the trial credit is enough to run the whole tutorial many times over before you spend anything.

When something goes wrong

The page shows nothing while the server logs a reply

Some proxies buffer responses. If you deploy behind one, disable buffering for the chat route or the text will arrive in one lump at the end. Locally, the code above streams as written.

Replies cut off in the middle

The browser reads each chunk as a UTF-8 stream, so the decoder must be called with the stream option, as the code does. If text still breaks, check that your own limit on the reply length is not set too small. max_tokens is optional on this API and the completion may use whatever is left of the 100,000 token window.

Every second request returns busy

Your counter was incremented and never released. Make sure the decrement sits in a finally block, as shown, so errors and closed tabs both free the slot.

Costs higher than the estimate

History grows with every turn. Log the usage numbers that arrive with the stream, and trim to the last 20 messages or so. Doubling the history roughly doubles the input cost of each later message.

Where to go next

Once the basic app works, tool calling lets the model trigger actions in your code, and JSON mode lets it return structured data. Both are covered in the API documentation. The two additions need no change to the server structure above, only new fields in the request.

Questions and answers

Do I need a framework or a database to start?

No. The Express server and one HTML page above are enough. Add a database only when you want to save conversations between visits.

Can I put the API key in the browser code?

No. Anyone could copy it and spend your credit. Keep it in a server environment variable and let the browser call your own server.

Why does the app need a concurrency counter?

A full key allows 8 concurrent requests, and streams keep their slot until they end. The counter lets you answer a ninth visitor politely instead of sending a request that returns a concurrency error.

Can the app create images or voice?

Not through this API. It is text only, so images, audio and video need separate services.

What does a typical message cost?

With 1,200 input and 400 output tokens, one message costs $0.00038, so 10,000 messages cost $3.80.

Your key is one form away

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

Key points

  • The finished app is one Node server file and one HTML page, with the API key kept on the server.
  • Replies stream token by token through server-sent events, using model ID uncensored.
  • Account for the 8 concurrent request limit with a simple counter so users get a clear message instead of a failure.
  • At 1,200 input and 400 output tokens per message, 10,000 messages cost about $3.80.