Hosting Mewlith for other people (multi-user mode)¶
Mewlith normally runs single-user on your own computer (python -m mewlith serve). Nothing in this
guide changes that. Hosted mode is an opt-in second way to run it: one server, many accounts, each with
its own sandbox and a usage limit (1 hour a day by default) that you control as the admin.
MEWLITH_MODE=multiuser python -m mewlith serve --hosted # or: docker run ... (below)
What people get (and don't get)¶
| Local mode (default) | Hosted mode | |
|---|---|---|
| Who | you | anyone with an account |
| Sign-in | one-time link / token | username + password (scrypt), session cookie |
| Tools | everything, incl. shell, local apps, desktop, connectors | web research, memory, skills, Office / archive / WordPress / data files, chat |
| Files | sandbox + folders you allow | the user's own workspace only (<data>/users/<id>/) |
| Approvals | your policy | always ask |
| AI keys | yours (BYOK) | the server's keys; users can't add their own |
| Usage limit | none | per user, per period (default 60 min / day) |
Not available to hosted users (admins included): shell commands, running apps, desktop control, your folders, MCP / connector secrets, routines, settings. Those routes return 404 in hosted mode — the server uses an allow-list, so a new endpoint is closed until it's reviewed for hosted use.
How usage is counted¶
- Active usage = wall-clock time the server spends on model calls (agent steps, chat replies, run summaries) plus tool run time. Time spent waiting for the user to approve, or idle, doesn't count.
- The limit is checked before every model call. A call that's already running finishes; the next one is refused with "You've reached your usage limit… resets at X". The GUI shows a meter in the sidebar.
- Period: a day starting at
MEWLITH_QUOTA_RESET_HOUR(UTC, default 0). SetMEWLITH_QUOTA_PERIOD_DAYS=7for weekly. - Optional caps per period: AI requests (
MEWLITH_DEFAULT_REQUEST_CAP) and estimated tokens (MEWLITH_DEFAULT_TOKEN_CAP, ~4 characters per token). - Admins are unlimited. Suspended users can't sign in.
First login on any host¶
There is no default password and no shared admin / admin account. On Render, Railway, Fly, Oracle, a VPS or Docker you do not need a shell.
- Start the server the way that host starts it (Deploy,
docker run,mewlith serve --hosted). - Open the host's logs.
- Copy the setup code (it looks like
k7Qx-m2Lp-9aZd-b3Nc-e8Rf-q1Ws). - Open
/setupon that server (for examplehttps://your-server/setup). - Paste the code. Choose a username and a password (12 characters or more, not a common password).
- Sign in at
/.
The code works once, expires after 60 minutes, and a restart prints a new one. Only its hash is stored. Wrong tries are limited per IP.
You can set MEWLITH_SETUP_CODE yourself if you would rather not read a generated code from the logs. It is not printed.
Env admin (optional). MEWLITH_ADMIN_USER and MEWLITH_ADMIN_PASSWORD still create the first admin when none exists. That password is temporary: the first sign-in asks you to choose a new one. If an admin is already in the database, those variables do not overwrite it.
Disks that get wiped (Render's free plan deletes data on sleep or redeploy): the env admin is created again after each wipe and must change the password again. Use a persistent disk, or leave the env password unset and use the setup code on a disk that keeps accounts.db.
Lost the admin password and there is no shell:
- Set
MEWLITH_ADMIN_RESET=1and restart. - Copy the reset code from the logs and open
/setup. - Set a temporary password, sign in, and choose a different one.
- Remove
MEWLITH_ADMIN_RESETand restart.
A shell can still do python -m mewlith admin reset-password <name> (or admin passwd). That password is temporary too.
Admin guide¶
If you have a shell, you can still create the admin there. The password you type yourself is yours. A password passed in from an environment variable is temporary:
python -m mewlith admin create yasin # prompts for a password (10+ chars)
# or: MEWLITH_ADMIN_USER=yasin MEWLITH_ADMIN_PASSWORD='…' (only when no admin exists; must change it at first sign-in)
Then sign in to the web page → Admin. Everything there also exists on the CLI:
| Task | GUI (Admin page) | CLI |
|---|---|---|
| List users and usage | Users table | mewlith admin list |
| Give someone more time today | + Bonus (minutes, expires at the next reset by default) | mewlith admin bonus ben 30 |
| Change someone's limit | Quota → minutes, or blank for unlimited | mewlith admin quota ben --minutes 120 / --unlimited / --default |
| Start their period over | Reset | mewlith admin reset ben |
| Suspend / unsuspend | Suspend | mewlith admin suspend ben / unsuspend |
| Delete (and their files) | Delete | mewlith admin delete ben --yes |
| Change the default for everyone | Defaults → Default minutes / period | mewlith admin settings --default-minutes 60 |
| Open sign-up / invite-only / closed | Defaults → Sign-up | mewlith admin settings --signup invite |
| Invite codes | Invite codes → link /?invite=am-… |
mewlith admin invite --uses 5 --days 7 |
| Usage and audit logs | bottom of the page | mewlith admin usage / mewlith admin audit |
Every admin action goes to the audit log. Admins can't suspend, demote or delete themselves, and the last admin can't be removed.
Environment variables¶
| Variable | Default | Meaning |
|---|---|---|
MEWLITH_MODE |
(local) | multiuser turns hosted mode on (the Docker image sets it) |
MEWLITH_DATA_DIR |
~/.mewlith |
all data: accounts.db, users/<id>/… (/data in Docker) |
NVIDIA_API_KEY (or other provider keys) |
— | the AI keys all users share — set as a secret, never in the repo |
MEWLITH_ADMIN_USER / MEWLITH_ADMIN_PASSWORD |
— | optional. Create the first admin on start if none exists. The password is temporary (change it at first sign-in). An existing admin is not overwritten. On a wiped disk this admin is created again |
MEWLITH_SETUP_CODE |
random, printed once | optional. The one-time /setup code, instead of a generated one. Not printed. At least 12 characters |
MEWLITH_ADMIN_RESET |
off | set to 1 and restart to print a one-time code that resets an admin password. Remove it afterwards |
MEWLITH_ALLOWED_HOSTS |
localhost | your public host name(s), comma-separated. Render / Koyeb / HF host names are added automatically |
MEWLITH_SIGNUP |
invite |
open, invite or closed (admin can change it later) |
MEWLITH_DEFAULT_QUOTA_MINUTES |
60 |
minutes per period for new and default users |
MEWLITH_QUOTA_PERIOD_DAYS / MEWLITH_QUOTA_RESET_HOUR |
1 / 0 |
period length and the UTC hour it starts |
MEWLITH_DEFAULT_REQUEST_CAP / MEWLITH_DEFAULT_TOKEN_CAP |
0 (off) |
extra caps per period |
MEWLITH_USER_MAX_TASKS |
2 |
agent runs at once per user |
MEWLITH_USER_STORAGE_MB / MEWLITH_HOSTED_MAX_UPLOAD_MB |
200 / 20 |
per-user storage and upload size |
MEWLITH_SESSION_DAYS |
7 |
sign-in lifetime |
MEWLITH_COOKIE_SECURE |
auto (https) | force the Secure cookie flag (the Docker image sets 1; use HTTPS) |
MEWLITH_FORWARDED_ALLOW_IPS |
127.0.0.1 |
proxies whose X-Forwarded-For is trusted (for per-IP sign-in limits). * only when the app is reachable only through the platform's proxy (Render, Koyeb, HF) |
PORT / MEWLITH_PORT |
8765 |
listen port (PORT is set by most hosts) |
MEWLITH_SOURCE_URL |
the GitHub repo | where the Source code link in the web interface points. Mewlith is AGPL-3.0: if you run a changed copy for other people, set this to where they can get your changed source (or get a commercial licence) |
Do not set MEWLITH_NET_ALLOW_CIDRS on a public server — it would let users' web tools reach private networks.
Apps and devices (one account everywhere)¶
The same server is the account server for every client: the web GUI, phones' browsers and the
Windows app (apps/desktop). A user's chats, files, memory, usage limit and bonus time live on the server,
so every device signed in to that account sees the same things.
How the app signs in:
- The app sends the username and password once to
POST /api/auth/device/loginand gets a device token (amd_…). The server keeps only its SHA-256 hash; the app stores the token in the OS credential store (Windows Credential Manager), never in a file. - To open the window, the app asks
POST /api/auth/device/launch(token inAuthorization: Bearer …) for a one-time code valid for 60 seconds, then opens/?device_launch=<code>. That becomes a normal browser session tied to the device, so the GUI works exactly as in a browser. - Device tokens expire after
MEWLITH_DEVICE_DAYSwithout use (each use extends it). A user can have at most 20; the oldest is dropped.
Revoking:
- The user: Account → My devices → Sign out (also lists browser sessions), or Mewlith → Sign out of this device in the app.
- The admin: Admin → Signed-in apps → Sign out, for any user.
- Changing a password, suspending or deleting a user signs out every device at once.
Security rules the server enforces:
- Device tokens are accepted only over HTTPS (or from the same machine). Put the server behind Caddy or
Cloudflare Tunnel (below) — the app also refuses
http://addresses that aren'tlocalhost. - Bearer requests can't be made by a web page in a browser (it would need the token), so they skip the CSRF check;
cookie requests still need the CSRF token and a same-origin
Origin. - CORS is answered only for the app's own origins (
tauri://localhost,http(s)://tauri.localhost) on the device endpoints, without credentials. App sign-in has the same per-IP and per-user limits as the web sign-in; launch codes are rate-limited per IP.
| Variable | Default | Meaning |
|---|---|---|
MEWLITH_DEVICE_DAYS |
90 |
a device token expires after this many days without use |
MEWLITH_APP_ORIGINS |
— | extra app origins allowed by CORS, comma-separated (only if you build your own client) |
MEWLITH_ALLOW_HTTP_DEVICES |
off | 1 accepts device tokens over plain HTTP — testing only |
Building the app with your server pre-filled: set the repository variable MEWLITH_DEFAULT_SERVER
(Settings → Secrets and variables → Actions → Variables) to e.g. https://mewlith.example.org. The Windows app
workflow bakes it in as the default server address; users can still change it on the sign-in screen.
Free hosting — what's actually free (checked October 2026)¶
Free tiers change often; check the provider's page before you rely on one. The big catch for Mewlith is
persistent storage: accounts, usage and users' files live in /data. Without a persistent disk they
vanish on every restart.
| Option | Free? | Keeps data? | Notes |
|---|---|---|---|
| Your own PC + Cloudflare Tunnel | Yes | Yes | Best free choice if your PC can stay on. Tunnel is free; a quick tunnel gives a random trycloudflare.com URL, a named tunnel needs a domain on Cloudflare. |
| Oracle Cloud Always Free VM | Yes (card needed for identity check) | Yes (up to 200 GB block storage) | Ampere A1 Arm VM (2 OCPU / 12 GB in total since Aug 2026). Popular regions sometimes say "out of capacity". Best free always-on option. |
| Render (free web service) | Yes | No | Sleeps after 15 min idle (~1 min to wake), 750 h / month. No disks on the free plan, so all accounts and files are wiped on every sleep / redeploy. Demo only — use /setup from the logs, or an env admin that is created again (and must change password again) after each wipe. |
| Koyeb (free instance) | Yes | No | 1 service, 0.1 vCPU / 512 MB, sleeps when idle, no volumes on free. Demo only. |
| Hugging Face Spaces (Docker) | No | No (paid storage) | Docker / Gradio Spaces on free CPU now need a PRO subscription; only static Spaces are free. |
| Fly.io | No | Yes (paid volumes) | No free tier for new accounts (short trial only); a small always-on machine is a few dollars a month. |
Option A — your PC + Cloudflare Tunnel (free, persistent)¶
pip install "mewlith[office,data]" # or clone the repo and pip install -e .
export MEWLITH_MODE=multiuser NVIDIA_API_KEY=… MEWLITH_COOKIE_SECURE=1
python -m mewlith serve --hosted
# the log prints a setup code — open http://127.0.0.1:8765/setup
# (a shell can still run: python -m mewlith admin create yasin)
# quick tunnel (random URL, no account needed):
cloudflared tunnel --url http://127.0.0.1:8765
# put the printed host name in MEWLITH_ALLOWED_HOSTS, then restart the server
cloudflared connects from your PC to localhost, so leave MEWLITH_FORWARDED_ALLOW_IPS at its default.
For a stable URL, add a domain to Cloudflare and create a named tunnel (cloudflared tunnel create mewlith).
Option B — Oracle Cloud Always Free VM (free, persistent)¶
- Sign up at cloud.oracle.com (card used for verification; stay on Always Free shapes).
- Create a VM: Ampere A1 Flex, Ubuntu, up to 2 OCPU / 12 GB. Open port 443 (or use a Cloudflare Tunnel and open nothing).
- On the VM:
sudo apt-get update && sudo apt-get install -y docker.io git clone https://github.com/ymmiah/AutoMotoAI && cd AutoMotoAI && sudo docker build -t mewlith . sudo docker run -d --restart unless-stopped --name mewlith -p 127.0.0.1:8765:8765 -v mewlith-data:/data \ -e NVIDIA_API_KEY=… -e MEWLITH_ADMIN_USER=yasin -e MEWLITH_ADMIN_PASSWORD='…' \ -e MEWLITH_ALLOWED_HOSTS=your.domain -e MEWLITH_FORWARDED_ALLOW_IPS='*' mewlith - Put HTTPS in front: Caddy (
your.domain { reverse_proxy 127.0.0.1:8765 }) orcloudflared. Because the port is published on127.0.0.1only, the proxy is the only way in, soMEWLITH_FORWARDED_ALLOW_IPS='*'is safe and lets the per-IP sign-in limits see real visitors (Docker shows every proxied request as coming from its bridge IP). Step-by-step with Docker Compose, Oracle's firewall rules and a Caddyfile: INSTALL.md § 7B. - Back up the
mewlith-datavolume now and then (accounts.dbandusers/).
Option C — Render free (demo only, data is wiped)¶
Fork the repo → Render → New → Blueprint → pick the repo (uses render.yaml). Set NVIDIA_API_KEY.
You do not have to set an admin password: open the logs, copy the setup code, open /setup.
If you do set MEWLITH_ADMIN_USER and MEWLITH_ADMIN_PASSWORD, that password is temporary and, because the
free plan has no disk, the admin is created again on every restart and must change it again. Other accounts and
all files do not come back. Prefer a persistent disk for anything but a demo.
Docker¶
docker build -t mewlith . # add --build-arg WITH_OFFICE=1 for LibreOffice (PDF export)
docker run -d -p 127.0.0.1:8765:8765 -v mewlith-data:/data -e NVIDIA_API_KEY=… \
-e MEWLITH_ALLOWED_HOSTS=your.domain mewlith
docker logs <container> # copy the setup code, then open http://127.0.0.1:8765/setup
# optional, instead of the setup code:
# -e MEWLITH_ADMIN_USER=yasin -e MEWLITH_ADMIN_PASSWORD='…' (temporary; change it at first sign-in)
docker exec -it <container> python -m mewlith admin list
The image runs as a non-root user (uid 10001), stores everything in /data, and includes poppler, PHP (for
php -l checks) and 7-Zip. CI builds it and smoke-tests the login page and admin bootstrap.
Limits of hosted mode (be honest with your users)¶
- Single process: rate limits, lockouts and running tasks are in memory — run one instance, not several.
- No e-mail: no verification and no "forgot password" — the admin resets passwords (
mewlith admin passwd). - Token caps are estimates (characters ÷ 4), not provider-billed tokens.
- All users share the server's AI keys and provider rate limits; set the quotas with that in mind.
- Users' files are isolated by folder on one machine, not by container. Don't host people you don't trust with a server you care about; keep the host free of other secrets.