Build Your Own Chat Frontend on an Uncensored LLM API
An uncensored chat api gives you the model behind a chat, while you build the part people actually see. This guide shows a working path from a ten-line terminal chat to a streaming web frontend, with conversation memory and sensible limits.
Updated

Key points
- The API is OpenAI-compatible, so the standard SDKs work with a new base URL, key and the model ID uncensored.
- Chat memory is your job: send the message history with every request and trim it before it gets long.
- Keep the key on a server, never in browser code.
- Streaming holds a concurrency slot until the stream ends, so cancel old streams.
What you are building
A chat product has two halves. One half is the model that writes the replies. The other half is everything around it: the message box, the history, the streaming text, the character or persona, the login. When people ask for an uncensored chat api, they usually want the first half to be a capable text model that does not refuse lawful adult requests, and the second half to be theirs to design.
This service covers the first half. It is a hosted, OpenAI-compatible endpoint with one model, ID uncensored, run by an independent provider. It accepts POST /v1/chat/completions and GET /v1/models, supports streaming, tool calling and JSON mode, and has a context window of 100,000 tokens. It is text only. You get the base URL https://api.uncensoredchat.cc/v1 and a bearer key from the key page.
The plan below has three stages: a terminal chat to prove the loop, a small server that streams to a browser, and a short list of production details.
Stage 1: a streaming chat loop in Python
The API is stateless. It does not remember earlier requests, so your code keeps a list of messages and sends the full list each time. That list is the whole memory of the chat.
pip install openai
export UNC_KEY="paste-your-key-here"
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.uncensoredchat.cc/v1",
api_key=os.environ["UNC_KEY"],
)
history = [
{"role": "system", "content": "You are a witty, direct conversation partner. Keep replies under 150 words."}
]
while True:
user_text = input("you> ")
if user_text.strip() in ("quit", "exit"):
break
history.append({"role": "user", "content": user_text})
stream = client.chat.completions.create(
model="uncensored",
messages=history,
stream=True,
temperature=0.9,
)
reply = ""
print("bot> ", end="", flush=True)
for chunk in stream:
piece = chunk.choices[0].delta.content or ""
reply += piece
print(piece, end="", flush=True)
print()
history.append({"role": "assistant", "content": reply})
Run it, type a few messages, and watch the text appear word by word. If it works, your key, base URL and model ID are all correct, and everything after this stage is ordinary web development. Try changing the system message to a different persona and see how much the voice shifts; most of what makes one chat product feel different from another is that single paragraph of instructions plus your sampling settings.
Two points about this loop. The assistant reply is appended to history after streaming ends, so the next turn sees it. And the system message sits first and stays there, which is where you put the persona, tone and rules for your chat.
Stage 2: serve the stream to a browser
Never call the API from browser JavaScript with your key in it. Anyone can open the developer tools and copy it. Put a thin server in between. This Node example receives the message list from your page, forwards it with the key kept in an environment variable, and relays tokens as server-sent events.
import express from "express";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.uncensoredchat.cc/v1",
apiKey: process.env.UNC_KEY,
});
const app = express();
app.use(express.json({ limit: "1mb" }));
app.use(express.static("public"));
app.post("/chat", async (req, res) => {
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: req.body.messages,
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) {
res.write("data: " + JSON.stringify("[error]") + "\n\n");
}
res.end();
});
app.listen(3000);
The req.on("close") hook matters. When a visitor closes the tab or presses stop, the server aborts the upstream request. A streamed request occupies its concurrency slot until the stream ends, and a full key has 8 slots, so abandoned streams would otherwise starve other users.
The browser side reads the response body as a stream and appends text to the page:
async function send(messages, onText) {
const res = await fetch("/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ messages }),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
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) {
const data = ev.replace("data: ", "");
if (data === "[DONE]") return;
onText(JSON.parse(data));
}
}
}
A few interface details make a large difference to how the chat feels. Scroll to the bottom only when the user is already near it, so reading older messages is not interrupted by new text. Add a stop button that calls the abort on the fetch, a regenerate button that removes the last assistant message before resending, and a visible error line when the server writes the error event. None of this needs a framework; plain DOM code is enough for a first release.
For a real product, keep the history on the server or in a database tied to a logged-in user, and build the messages array there instead of trusting what the page sends. Otherwise any visitor can swap your system prompt for their own.
Memory: what to send and what to cut
A 100,000-token window is large, but chats grow without limit. Each turn resends everything, so cost and delay both rise as the conversation lengthens. Plan a trimming rule from the start.
- Pin the system prompt. Always keep it first.
- Keep a sliding window. Send the last 10 to 20 exchanges in full.
- Summarize the rest. Ask the model for a short summary of older turns, store it, and insert it as a message after the system prompt. This is one extra request now and then, and it saves many tokens later.
- Stay under the ceiling. Prompt plus completion must fit in 100,000 tokens. Estimate tokens before you send, and cut old turns if you are near it.
Summaries deserve a word of caution. A model-written summary can drop a detail that later matters, such as a promise a character made or the name of a place. Keep a small list of pinned facts that you or the user can edit, and always send it with the system prompt. Users forgive a chat that forgets a mood, but they notice quickly when it forgets a name, and a short editable memory panel fixes most of those complaints without any extra requests.
A concrete sense of cost: a request with a 4,000-token history and a 300-token reply costs 4,000 x $0.15 / 1,000,000 + 300 x $0.50 / 1,000,000 = $0.0006 + $0.00015 = $0.00075. A thousand such turns cost $0.75. Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens, and the pricing page has the details.
Personas, JSON mode and tools
The system message is where a chat gets its identity. Write it as plain instructions: who the assistant is, how it talks, what it should avoid, and the length of its replies. Test with temperature between 0.7 and 1.0 for lively dialogue. The seed parameter helps when you want repeatable outputs while debugging a prompt. The penalty parameters help against repeated phrases in long chats.
Two extras are worth knowing. JSON mode, enabled with response_format: {"type":"json_object"}, is handy for side tasks such as extracting a mood tag or a memory note from each turn. Tool calling lets the chat do things like look up a saved note or set a reminder. If you add tools, validate every call in your own code, and check the docs for the request format.
Production details that bite later
- Rate limits. A full key allows 300 requests per minute and 8 concurrent. A trial key allows 60 and 2. Beyond that you receive HTTP 429 with the code
rate_limitedorconcurrency. If you see a 429 with aRetry-After: 5header, wait five seconds and try again. Queue requests on your server rather than letting browsers hammer the endpoint. - Balance. Each response includes
X-Balance-USD. Read it on the server and warn yourself before credit runs out. - Tracing. Store the
X-Request-Idheader with each message. It makes support questions easy to answer. - Body size. The maximum body is 8 MB, which is far more than any chat needs.
- Errors. Failed or refused requests are not charged, but your interface should still show a retry button.
- Your users. The model is tuned for lawful adult use and there is a hard limit against sexual content involving minors. If you open your frontend to the public, add your own age gate, terms and reporting tools.
If you are comparing providers, you may also like the page on the Grok API alternative. This service is not the official API of any model vendor.
Try it with trial credit
Sign up with Google, or with an email and password, and claim the $0.50 trial on the key page. It is valid for 7 days, needs no card, and is limited to one per person.
When you move to real traffic, top up with any whole amount from $20 to $500, by crypto (USDT on TRC20, USDC on Base). A $50 top-up gets 5% extra, $100 gets 10%, and $200 gets 15%. Credit never expires and there is no subscription. Prompts are not used for training.
More guides
Questions and answers
Does the API remember my previous messages?
No. Each request is independent. Your application stores the conversation and sends the message list with every call.
Can I put the key in front-end JavaScript?
You should not. Anyone can read it in the browser. Keep the key on a server and have your page talk to that server.
Which model do I select?
Use the model ID uncensored. You can confirm it by calling GET /v1/models with your key.
Is there a free tier?
There is no free tier. New users can claim $0.50 of trial credit, valid for 7 days, without a card. After that you pay as you go from prepaid credit starting at $20.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.