Lewisia Chat
One deployment, many agencies. Each agency gets an isolated workspace, its own administrator, a monthly token budget, and an audit log that cannot be edited after the fact.
- Node.js
- React
- MongoDB
- OpenRouter
One instance, many clients, no mixing.
Small studios and agencies want an AI assistant for their teams without paying per seat to a SaaS vendor or running one server per client. Lewisia Chat lets one self-hosted instance serve several agencies side by side.
Each agency only ever sees its own people, conversations, files and prompts. The platform owner sees usage and costs across all of them, and every sensitive action is written to a log that can be verified later.
Built for the people who have to run it.
- 01
Sign-in with Google or Microsoft
People sign in with Google, Microsoft or an email address.
- 02
AI-interaction notice
A configurable line under every chat tells users they are talking to an AI, per deployment or per agency, with custom wording.
- 03
Files and clean deletion
A file can be attached to a message and the model answers from it. When the work is done, the conversation is deleted from the sidebar.
- 04
Agency-wide prompts
An agency admin can save a prompt with variables such as {{client}} and share it with the whole agency; a globe marks shared prompts in the list.
- 05
Two levels of administration
Each agency has its own admin, who sees the agency’s members, conversations, messages and token spend, manages its members, settings and audit log, and nothing outside it. The platform admin manages agencies, users and usage from one console.
- 06
Audit log with a hash chain
Sign-ins and sign-outs, model calls, file uploads and sharing changes are recorded in a per-agency chain. A “Verify chain” button checks that no entry was altered or removed. Exports to CSV.
- 07
Agencies as first-class tenants
An agency is registered with its email domains and optional directory groups. Anyone signing up with a matching address lands in the right agency automatically; addresses from unknown domains can be refused.
- 08
Monthly token budget per agency
The platform admin can set a cap in token credits per calendar month and a warning threshold, and sees token spend per agency on the usage page.
Also included, not shown in the walkthrough: directory sign-in that maps users to their agency without manual onboarding, the agency’s allowance on its overview and a clear notice refusing new messages once the cap is reached, removal of uploaded files when their conversation is deleted, prompt sharing limited to the agency, and audit entries for failed sign-ins, role and agency changes, file deletions and quota events.
5 parts, end to end.
The agency is decided once, at sign-in, and every query after that is scoped to it. Token usage and audit entries are written as each call happens, not reconstructed afterwards.
Part 01
Serve
The model runs through OpenRouter, so the provider and model are a configuration choice, not a code change.
Part 02
Record
Every auditable event is appended to the agency’s hash chain with the actor, target, outcome and metadata.
Part 03
Register
An agency is created with a slug, display name, email domains, optional directory groups and an identity provider.
Part 04
Meter
Each model call records its token usage in a transaction ledger; spend is totalled per agency, and an optional monthly cap can be set for each agency.
Part 05
Route
On sign-up or SSO sign-in, the email domain or directory group decides the agency; every database query is scoped to that tenant.
Open-source base, focused additions.
LibreChat as the base
The open-source chat platform (Node.js, Express, React, MongoDB). The multi-agency layer, roles, quota, audit chain, AI notice and file lifecycle are Lewisia Labs additions on top of it.
OpenRouter for model access
The demo runs on Z.ai’s GLM 5.3 Flash; any model available through OpenRouter, or a self-hosted one, can be configured instead.
Google and Microsoft OAuth
For sign-in, next to email and password.
Built and running. Shown on request.
The instance is private for now. Request a live walkthrough on a scenario that matches your own setup: your agencies, your sign-in provider, your budget rules.
Notes
- Lewisia Chat is built on LibreChat, an open-source project released under the MIT License, © LibreChat contributors. The source of the base project is at github.com/danny-avila/LibreChat. Lewisia Labs is not affiliated with, sponsored by or endorsed by the LibreChat project.
- Google, Microsoft, OpenRouter, Z.ai and GLM are trademarks of their respective owners and are named only to identify the services shown. No partnership or endorsement is implied.
- All names in the walkthrough are invented: the agencies (Atlas Media, Agency 1, Agency 2, North PR, SSO Demo Agency, SSO Demo Agency (Microsoft)), the people (Atlas Admin, Test Admin, Verif Sync, David Martin, Claire Rousseau, Bob Dupont, Sam Example), the email addresses and domains (lead@atlasmedia.example, admin@lewisia-test.example, verif.sync@agency1.com, bob@agency1.com, david@agency2.com, claire@agency2.com, atlasmedia.example, lewisia-test.example, northpr.example, north-pr.example, agency1.com, agency2.com), the prompts and the conversations. They were created for the demo only. Any resemblance to a real company, person or address, past or present, is coincidental and unintended. The narration and captions were generated with a synthetic voice.
- The project is shown for information purposes. It is not offered as a hosted service on this site, and nothing on this page is a contractual offer. Where the tool is deployed for a client, data is processed on the client’s own infrastructure and with the model provider the client chooses, under that client’s agreements.