Another Tutorial While I Finish Some Bots (Updated With Script)

Another Tutorial While I Finish Some Bots (Updated With Script)

55

62

FREE JANITORAI AI PROXY · STEP-BY-STEP CLOUDFLARE GUIDE

☁ MEL'S FREE PROXY LABGUIDE / OCTOBER 2026 · COMMUNITY EDITION
FREE TIER · SELF-HOSTED WORKER · MULTI-MODEL YOUR OWN AI PROXY Cloudflare Workers AI × JanitorAI
One Worker. Five models. No monthly subscription needed for usage within eligible free limits.
BEGINNER FRIENDLYNO LOCAL GPU10,000 NEURONS / DAYMODEL SWITCHINGHai hai, everyone! 🌸 I made this so you can build and understand your own proxy rather than depend on somebody else's.
BEFORE YOU BEGIN — WHAT THIS TUTORIAL DOES
We will create a free Cloudflare Worker, keep your private Cloudflare token in Secrets, add a protected OpenAI-compatible proxy, pick a model, and connect it to JanitorAI. Images illustrate the steps, and the actual Worker script is included below so you can copy it.

It is free within the account's daily allowance, not unlimited or guaranteed to support every model on every account. Never publish API tokens or your proxy password.
SECTION 01 // CLOUD MANUAL What you need Your setup checklist
A free Cloudflare account
Create one at dash.cloudflare.com. Your Worker runs online; your PC does not have to stay running.
A JanitorAI account
Use a chat/character where custom proxies are supported.
A secure private password
You create this yourself. It becomes the PROXY_KEY, which is separate from the Cloudflare API token.
Free allowance: Cloudflare Workers AI currently documents 10,000 free Neurons/day, resetting at 00:00 UTC. Input/output lengths and model choice change consumption. At the limit you will receive an error until the allowance resets or you change plans.
SECTION 02 // CLOUD MANUAL Deploy your Cloudflare Worker Create the little server that will forward requests
SCREENSHOT 01 · CLOUDFLARE DASHBOARDVISUAL REFERENCE
Use this screenshot as a visual orientation for the dashboard. The labels can change over time.
Go to the Cloudflare dashboard → Workers & Pages → Create. Create a Worker with the starter template, name it something like janitor-free-proxy and press Deploy.
SCREENSHOT 02 · WORKER SETUPVISUAL REFERENCE
Follow the current Worker creation prompts until Cloudflare gives you a *.workers.dev address.
https://janitor-free-proxy.YOUR-SUBDOMAIN.workers.dev
SECTION 03 // CLOUD MANUAL Get your Workers AI token This token is private; it never belongs in JanitorAI
SCREENSHOT 03 · WORKERS AI / TOKENVISUAL REFERENCE
Find Workers AI and the REST API / token creation area in your dashboard.
Open AI → Workers AI and look for Use REST API or an API token creation action. Create a token with access to Workers AI, and copy your Cloudflare Account ID.
SECURITY RULE
The Cloudflare API token is a server secret. Do NOT paste it in JanitorAI, Discord or public code. JanitorAI will only receive a different private password (PROXY_KEY).
SECTION 04 // CLOUD MANUAL Add 3 Worker settings A Cloudflare Account ID plus two Secrets
SCREENSHOT 04 · VARIABLES & SECRETSVISUAL REFERENCE
Inside your Worker, open Settings → Variables and Secrets.
CLOUDFLARE_ACCOUNT_ID — Text: your account ID
CLOUDFLARE_API_TOKEN — Secret: the Cloudflare token
PROXY_KEY — Secret: a unique strong password you choose
Save the variables, and redeploy if Cloudflare asks. Do not use your account login password as PROXY_KEY.
Your three Worker settings — exact names CLOUDFLARE_ACCOUNT_ID · Text · Your Account ID, obtained from your own Cloudflare dashboard. This is not the Worker name or URL.
CLOUDFLARE_API_TOKEN · Secret · The Workers AI API token you generated in Cloudflare. Never put it in the public Worker code or in Janitor's API Key field.
PROXY_KEY · Secret · A long unique password you create yourself. You'll paste the SAME password in Janitor's API Key field.
EXAMPLE STRUCTURE ONLY (not real keys)
CLOUDFLARE_ACCOUNT_ID = [your own account ID]
CLOUDFLARE_API_TOKEN = [your own secret AI token]
PROXY_KEY = [your own private random password]
SECTION 05 // CLOUD MANUAL Paste the complete proxy code This is the actual working Worker source, not a placeholder
SCREENSHOT 05 · WORKER CODE EDITORVISUAL REFERENCE
Click Edit code on your Worker and replace the starter code.
Open Edit code, remove the existing starter source, paste the entire JavaScript below, then press Deploy. The script supports /v1/chat/completions and /chat/completions, streaming, your chosen model and a personal password.
☁ This script is the actual bridge — what does it do? 1 · CORS + OPTIONS: lets browser-based clients make the preflight request safely. 2 · POST endpoints: accepts requests at /v1/chat/completions or /chat/completions. 3 · Personal password: compares the API Key Janitor sends with your PROXY_KEY secret. Without this, anybody who discovers the URL could consume your free quota. 4 · Full RP conversation: keeps Janitor's messages array instead of reducing your story to the last message. 5 · Model selection: starts with Gemma 4 but also accepts the five supported model IDs listed in this tutorial. The original code always forced Gemma; this version lets you switch from Janitor's Model Name field. 6 · Streaming + settings: enables streaming and uses temperature 0.9, top_p 0.95, and max_tokens 2048 only if Janitor has not supplied valid values. 7 · Cloudflare API: uses your Cloudflare Account ID and its separate API token to call Workers AI. Your Cloudflare token never has to be pasted into Janitor. 8 · Direct passthrough: forwards the response stream back to Janitor without rebuilding individual tokens or chunks.
Copy the WHOLE block below into Cloudflare's Worker code editor. Do not paste it in the Janitor proxy URL field. You do not replace anything inside the script with your secrets: add them under Settings → Variables and Secrets. Keep their exact names, including underscores. After pasting, hit Deploy.
</> FULL CLOUDFLARE WORKER SCRIPT — JAVASCRIPT · OPEN / COPY ↓
// JANITORAI + CLOUDFLARE WORKERS AI PROXY // Adapted from Mel's working streaming passthrough. // STEP 1: Settings > Variables and Secrets // CLOUDFLARE_ACCOUNT_ID = your own Cloudflare Account ID (Text) // CLOUDFLARE_API_TOKEN = your own Workers AI API token (Secret) // PROXY_KEY = a strong password YOU create (Secret) // STEP 2: paste this ENTIRE script in Edit code and Deploy. // STEP 3: in JanitorAI set Proxy URL to: // https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/v1/chat/completions // and API Key to the SAME value as your PROXY_KEY. const MODELS = new Set([ "@cf/google/gemma-4-26b-a4b-it", "@cf/zai-org/glm-4.7-flash", "@cf/qwen/qwen3-30b-a3b-fp8", "@cf/mistralai/mistral-small-3.1-24b-instruct", "@cf/meta/llama-3.3-70b-instruct-fp8-fast", ]); const DEFAULT_MODEL = "@cf/google/gemma-4-26b-a4b-it"; export default { async fetch(request, env) { const origin = request.headers.get("Origin") || "*"; const corsHeaders = { "Access-Control-Allow-Origin": origin, "Access-Control-Allow-Methods": "GET, POST, OPTIONS", "Access-Control-Allow-Headers": request.headers.get("Access-Control-Request-Headers") || "Content-Type, Authorization, X-API-Key", "Access-Control-Max-Age": "86400", "Vary": "Origin", }; const json = (data, status = 200) => Response.json(data, { status, headers: corsHeaders }); if (request.method === "OPTIONS") { return new Response(null, { status: 204, headers: corsHeaders }); } const path = new URL(request.url).pathname; if (request.method === "GET" && path === "/") { return json({ status: "ok", service: "Private Workers AI proxy" }); } if (request.method !== "POST" || (path !== "/v1/chat/completions" && path !== "/chat/completions")) { return json({ error: { message: "Not found" } }, 404); } // IMPORTANT ADDITION: prevent strangers from using your quota. if (!env.PROXY_KEY || !env.CLOUDFLARE_ACCOUNT_ID || !env.CLOUDFLARE_API_TOKEN) { return json({ error: { message: "Missing Worker secrets" } }, 500); } const auth = request.headers.get("Authorization") || ""; const suppliedKey = auth.replace(/^Bearer\s+/i, "").trim() || request.headers.get("X-API-Key") || ""; if (suppliedKey !== env.PROXY_KEY) { return json({ error: { message: "Invalid PROXY_KEY" } }, 401); } try { const raw = await request.text(); if (raw.length > 500000) { return json({ error: { message: "Request too large" } }, 413); } const body = JSON.parse(raw); if (!Array.isArray(body.messages) || !body.messages.length) { return json({ error: { message: "Missing messages array" } }, 400); } // Preserve Janitor's conversation. The original fixed Gemma here: // body.model = "@cf/google/gemma-4-26b-a4b-it"; // This updated version also supports switching models in Janitor. body.model = body.model || DEFAULT_MODEL; if (!MODELS.has(body.model)) { return json({ error: { message: "Model not in tutorial allowlist" } }, 400); } body.stream = true; // Keep Janitor's settings, with sensible defaults. if (typeof body.temperature !== "number") body.temperature = 0.9; if (typeof body.top_p !== "number" || body.top_p <= 0) body.top_p = 0.95; if (!body.max_tokens || body.max_tokens <= 0) body.max_tokens = 2048; const upstream = await fetch( `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(env.CLOUDFLARE_ACCOUNT_ID)}/ai/v1/chat/completions`, { method: "POST", headers: { "Authorization": `Bearer ${env.CLOUDFLARE_API_TOKEN}`, "Content-Type": "application/json", "Accept": "text/event-stream", }, body: JSON.stringify(body), } ); // DIRECT PASSTHROUGH: no rebuilding the model's streamed text. if (!upstream.ok) { const errorText = await upstream.text(); return new Response(errorText, { status: upstream.status, headers: { ...corsHeaders, "Content-Type": upstream.headers.get("Content-Type") || "application/json", }, }); } return new Response(upstream.body, { status: upstream.status, headers: { ...corsHeaders, "Content-Type": upstream.headers.get("Content-Type") || "text/event-stream; charset=utf-8", "Cache-Control": "no-cache, no-transform", }, }); } catch (error) { return json({ error: { message: error?.message || String(error) } }, 500); } }, };
Why use 3 settings?
Cloudflare Account ID identifies your account; Cloudflare API Token grants model access; PROXY_KEY stops other people from sending requests through your public Worker URL.
Do not expect an automatic jailbreak
This is a transport proxy, not a model fine-tune. All model policies and Cloudflare restrictions still apply.
SECTION 06 // CLOUD MANUAL Pick one of five AI models Model IDs you can copy into JanitorAI
SCREENSHOT 06 · WORKERS AI MODELSVISUAL REFERENCE
Use Cloudflare model pages to compare capabilities, current eligibility and usage pricing.
MODEL 01 GEMMA 4 · START HERE
@cf/google/gemma-4-26b-a4b-it
General storytelling and a large context window of 256K tokens. Good first model to experiment with.
MODEL 02 GLM-4.7 FLASH · DIALOGUE
@cf/zai-org/glm-4.7-flash
Multilingual, dialogue-oriented option with a 131K context window.
MODEL 03 QWEN3 30B A3B · DETAIL
@cf/qwen/qwen3-30b-a3b-fp8
Instruction-following and complex scenes. 32K context; reasoning behavior can affect token usage.
MODEL 04 MISTRAL SMALL 3.1 · PROSE
@cf/mistralai/mistral-small-3.1-24b-instruct
A different writing style to compare for creative prose. Up to 128K context.
MODEL 05 LLAMA 3.3 70B · ALTERNATIVE
@cf/meta/llama-3.3-70b-instruct-fp8-fast
A larger model with a 24K context window, which can use free allowance relatively quickly.
These are suggestions for testing, not verified roleplay rankings. Availability and paid-only restrictions can vary. If a model returns 403, inspect Cloudflare access and model eligibility instead of assuming the proxy is broken.
SECTION 07 // CLOUD MANUAL Connect the Worker to JanitorAI Use the Worker URL and PROXY_KEY — not your Cloudflare API token
SCREENSHOT 07 · JANITORAI PROXY SETTINGSVISUAL REFERENCE
Open JanitorAI chat settings → Proxy → Add or configure a proxy.
Configuration name
Cloudflare Free AI
Model name
@cf/google/gemma-4-26b-a4b-it
Proxy URL
https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/v1/chat/completions
API Key
Your private PROXY_KEY secret — NOT Cloudflare API token.
Save the settings, select the configuration and send a short test message. When it works, model replies should come back from Cloudflare through your Worker. If the proxy does not connect, check both Worker logs and Janitor chat settings.
🔗 What should your Proxy URL actually look like? MEL'S REAL URL — EXAMPLE FORMAT ONLY https://janitor-ai-proxy.melancholux.workers.dev/v1/chat/completions YOUR OWN URL — REPLACE THIS PART https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/v1/chat/completions Example: Cloudflare says your Worker address is https://my-rp-proxy.abc123.workers.dev. Your Janitor Proxy URL is that exact address plus /v1/chat/completions: https://my-rp-proxy.abc123.workers.dev/v1/chat/completions Don't use Mel's URL as your own. Your account's Worker domain will be different. Do not type the words YOUR-WORKER literally, and don't paste your Cloudflare API token into Janitor: use PROXY_KEY in its API Key field.
SECTION 08 // CLOUD MANUAL Switch models without redeploying Five models, one Worker, one free allocation
SCREENSHOT 08 · FINAL CHECK / TESTVISUAL REFERENCE
Use the final screenshot as reference while verifying your chat and chosen model.
In JanitorAI, change only Model Name to any ID listed above. The Worker URL and PROXY_KEY stay unchanged. You can save separate configs per model, but they all spend the same account allowance.
From: @cf/google/gemma-4-26b-a4b-it To: @cf/zai-org/glm-4.7-flash
SECTION 09 // CLOUD MANUAL Suggested RP settings Optional starting points, not universal best settings
Temperature
0.8–1.0 to experiment with more variety; lower it if characters drift.
Top P
0.90–0.95 if the selected model supports it.
Max output tokens
1024–2048; shorter replies cost fewer Neurons.
Streaming
On, if your current Janitor interface and the chosen model both support it.
Long conversation histories can consume many tokens. A model supporting huge context does not mean the whole context fits within your daily free budget.
SECTION 10 // CLOUD MANUAL FAQ & troubleshooting The stuff that usually goes wrong
Does my PC need to stay on? ↓
No. Your Cloudflare Worker runs on Cloudflare infrastructure.
Is it unlimited? ↓
No. The free allowance currently covers 10,000 Neurons per day across the account.
Is NSFW guaranteed? ↓
No. Safety and moderation behavior depend on the model and service policies.
Can friends use my proxy? ↓
Do not share your PROXY_KEY casually. Anyone with the URL and key could consume your allowance.
401 Unauthorized ↓
The JanitorAI API Key must match PROXY_KEY exactly.
403 Forbidden ↓
Review Cloudflare token permissions, model eligibility and whether a paid plan is required.
404 Not Found ↓
Double-check the workers.dev URL and /v1/chat/completions path.
400 Invalid model ↓
Check that you copied a supported model ID exactly.
429 Too many requests ↓
You may have exhausted free Neurons or hit temporary capacity limits.
Replies not showing ↓
Check Worker deployment, logs, your secrets and the chat/proxy settings; try a shorter prompt.
Switching models deletes chats? ↓
Changing the selected model does not itself remove saved Janitor conversations. Each model may handle available context differently.
SECTION 11 // CLOUD MANUAL Final words & official resources Make it yours — and keep your keys private
And there you have it, darlings! 🌸
One personal proxy, five models to compare, and a little more freedom to experiment. This tutorial isn't an unlimited free premium service, just a way to learn and explore within the available allowance.

I share this because creating things should be fun, and I know that not everyone can pay for premium models.
Stay fluffy. 🤍
Community-made tutorial by Melancholux. Not affiliated with JanitorAI, Cloudflare or any listed model provider.
Private keys should never appear in a public post.

Created 2 days ago

Updated 2 days ago

Published 2 days ago

Published chats