Bun
Bun and Bun.serve with an OpenAI-compatible uncensored API
Use Abliterator from Bun: the openai package with Bun's automatic .env loading, a Bun.serve route that streams tokens, and a CLI compiled to one binary.
Put ABL_API_KEY in .env (Bun loads it automatically), create new OpenAI({ baseURL: "https://abliterator.ai/v1", apiKey: Bun.env.ABL_API_KEY }), and return streams from Bun.serve routes as a Response.
Bun runs TypeScript directly, loads .env files on its own and ships an HTTP server, so an Abliterator integration is just the openai package plus Bun.serve. The examples were type-checked with tsc --strict against @types/bun and run on Bun 1.4.
Install
bun init -y
bun add openai
echo 'ABL_API_KEY=sk-abl-v1-...' >> .env
A script
Save as ask.ts and run bun ask.ts "your question":
import OpenAI from "openai";
const abliterator = new OpenAI({ baseURL: "https://abliterator.ai/v1", apiKey: Bun.env.ABL_API_KEY });
const question = Bun.argv[2] ?? "What does a reverse shell look like in network traffic, and how do IDS rules catch it?";
const completion = await abliterator.chat.completions.create({
model: "kimi-k3.1-pro-abliterated",
messages: [
{ role: "system", content: "You are a network detection engineer." },
{ role: "user", content: question },
],
});
console.log(completion.choices[0].message.content);
Stream from Bun.serve
Bun.serve routes return standard Response objects. Turn Abliterator's stream into a ReadableStream of text and return it:
import OpenAI from "openai";
const abliterator = new OpenAI({ baseURL: "https://abliterator.ai/v1", apiKey: Bun.env.ABL_API_KEY });
const server = Bun.serve({
port: 3000,
idleTimeout: 120,
routes: {
"/api/chat": {
POST: async (req) => {
const { prompt } = (await req.json()) as { prompt: string };
const stream = await abliterator.chat.completions.create({
model: "deepseek-v4.1-flash-abliterated",
messages: [{ role: "user", content: prompt }],
stream: true,
});
req.signal.addEventListener("abort", () => stream.controller.abort());
const body = new ReadableStream<string>({
async start(controller) {
try {
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content;
if (text) controller.enqueue(text);
}
} catch (err) {
if (!(err instanceof OpenAI.APIUserAbortError)) controller.error(err);
return;
}
controller.close();
},
});
return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
},
},
},
});
console.log(`listening on ${server.url}`);
curl -N localhost:3000/api/chat -d '{"prompt":"Give five indicators that a USB device is a keystroke injector."}'
idleTimeout is in seconds, 10 by default; a reasoning model that thinks before its first token can exceed that, so raise it for LLM routes.
Compile a CLI into one binary
Bun can bundle a script and its dependencies into a single executable, handy for handing a red-team helper to colleagues without a Node toolchain:
import OpenAI from "openai";
const abliterator = new OpenAI({ baseURL: "https://abliterator.ai/v1", apiKey: Bun.env.ABL_API_KEY });
const input = await Bun.stdin.text();
const stream = await abliterator.chat.completions.create({
model: "deepseek-v4.1-flash-abliterated",
messages: [
{ role: "system", content: "Summarize this scanner output: findings by severity, then recommended next steps." },
{ role: "user", content: input },
],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
process.stdout.write("\n");
bun build ./summarize.ts --compile --outfile summarize
nmap -sV 10.0.0.0/24 -oN - | ABL_API_KEY="$ABL_API_KEY" ./summarize
Only scan networks you are authorized to test.
Troubleshooting
Missing credentialsfrom the SDK. Bun did not findABL_API_KEY..envis read from the current working directory; run from the project root or pass--env-file.- Requests close after 10 seconds with no data. That is
Bun.serve's defaultidleTimeout. Raise it for routes that call the model. - The compiled binary reports
Missing credentialson another machine. Your.envis not bundled into it. ExportABL_API_KEYthere. bun build --compiletargets the wrong OS. Add--target=bun-linux-x64(or another target) when building for a different platform.- Responses API calls.
abliterator.responses.createreturns 404; Abliterator serves Chat Completions only.
Frequently asked questions
Do I need dotenv with Bun?
No. Bun reads .env, .env.local and .env.<NODE_ENV> on startup, so Bun.env.ABL_API_KEY and process.env.ABL_API_KEY are set without any import.
Does the openai package run on Bun without changes?
Yes. It uses fetch and web streams, which Bun implements natively. The same baseURL and apiKey options apply.
Is a compiled binary safe to share if the key is in .env?
bun build --compile does not embed your .env file; the binary reads ABL_API_KEY from the environment where it runs. Do not hard-code the key in source you compile.