LibreChat multi-tenant isolation in one deployment

LibreChat can serve several tenants from one deployment through strict isolation settings in the open-source software, but the trusted proxy, tenant provisioning and verification are the operator's work.

On this page

Can one LibreChat deployment serve several tenants?

LibreChat documents tenant isolation settings in its open-source configuration, so one deployment can serve several organizations or business units, but only under a set of conditions. The researched material describes no separate paid tier for these controls, so confirm with the vendor that nothing needed for isolation sits behind a commercial edition before you commit. Treat this as a joint decision for the platform and security teams: they need to agree on who may assert a tenant, who administers each tenant, and how the boundary is tested before users arrive. The boundary also has to hold through upgrades, backups and incident response, so retest it after each change.

Strict isolation must be on in two places. Set TENANT_ISOLATION_STRICT=true in LibreChat and CODEAPI_TENANT_ISOLATION_STRICT=true in the Code Interpreter sandbox. With strict mode, a request without an authenticated tenant context fails instead of falling back to a single-tenant ID, and the upgrade guide says missing tenant context is rejected with 403 TENANT_CONTEXT_REQUIRED. The tenant itself must come from your proxy. TRUST_TENANT_HEADER is disabled by default and should be enabled only behind a reverse proxy that strips every incoming X-Tenant-Id header and sets the authoritative tenant itself. LibreChat's environment variable reference lists both flags. Any route that reaches LibreChat without that proxy lets a client claim a tenant, so the proxy's header handling belongs in the security test scope.

The operator builds the rest. Tenant-scoped deployments never promote their first user to admin, so tenant admins must be provisioned through a trusted administrative flow that you design and audit. LibreChat's docs publish no step-by-step procedure for creating a tenant, so onboarding is your own process: creating the tenant, assigning its first admin, scoping custom endpoints with tenantId in librechat.yaml, and deciding which credentials each tenant may use. A tenantId on a custom endpoint selects a scope only and does not create a tenant or grant membership. Before go-live, confirm that a tenant-scoped admin cannot reach another tenant through the Admin Panel, and if your database was created by v0.8.7 or earlier, check whether the tenant index migration has run. The access control docs are the starting point for that test.

Which tenant controls are built in and what the operator builds

This table compares each tenant control on the page with its edition and who delivers it: LibreChat itself, a component outside LibreChat, or your own team. Read the status column first, because a built-in setting still depends on a trusted proxy, a sandbox service or a provisioning process around it. The main takeaway is that LibreChat supplies the isolation switches, while tenant creation and tenant admin onboarding remain work for the operator.

CapabilityEdition or planStatus
Strict tenant isolation in LibreChatOpen-source configuration; no paid edition namedBuilt in. Set TENANT_ISOLATION_STRICT=true so requests without tenant context fail.
Strict isolation in the Code InterpreterOpen-source sandbox (Apache 2.0); no paid edition namedBuilt in as a setting. Operator deploys the sandbox and sets CODEAPI_TENANT_ISOLATION_STRICT=true.
TRUST_TENANT_HEADER settingOpen-source configuration; no paid edition namedNeeds an outside component. Enable only behind a reverse proxy that strips incoming X-Tenant-Id and sets the tenant itself.
Tenant-scoped custom endpoints with credentials and model specsOpen-source configuration; no paid edition namedBuilt in through the tenantId field in librechat.yaml. Operator writes the config. The field does not create a tenant.
Tenant-scoped Admin PanelOpen-source configuration; no paid edition namedBuilt in. A tenant-scoped caller cannot reach another tenant.
Tenant-scoped Admin InsightsConfirm with the vendor whether any part is a paid editionBuilt in. Each account sees only agents and data from its own tenant.
Tenant index uniquenessOpen-source configuration; no paid edition namedBuilt in. Databases created by v0.8.7 or earlier may need migrate:tenant-indexes, run with every writer stopped.
Tenant admin provisioningOpen-source configuration; no paid edition namedOperator builds it. Tenant-scoped deployments never promote the first user to admin, so use a trusted administrative flow.
Tenant creationOpen-source configuration; no paid edition namedNot documented. The vendor publishes no tenant creation procedure, so onboarding is your own process.

How strict isolation is enforced at the request boundary

The reverse proxy in front of LibreChat decides which tenant a request belongs to, and the application should trust nothing else. Configure the proxy to strip any inbound X-Tenant-Id header from clients and to set that header itself, based on the hostname, path or upstream identity service your organization already uses. Confirm this in your own environment by sending a request with a forged tenant header from outside the network and checking that LibreChat never receives the attacker's value. Because the header is the only tenant signal LibreChat reads before a user is known, a proxy that passes client headers through turns tenant selection into a client-controlled choice. Treat the proxy rule set as security configuration, under change control and reviewed like an access policy.

Set TENANT_ISOLATION_STRICT to true in LibreChat and CODEAPI_TENANT_ISOLATION_STRICT to true in the Code Interpreter for any deployment that serves more than one tenant. With strict mode on, authentication and account routes require a valid, non-system tenant before LibreChat looks up a user, and a request without tenant context is refused with a 403 and the error code TENANT_CONTEXT_REQUIRED. Without the flag, the deployment can fall back to a single-tenant identifier, which is the wrong default for a shared instance. Make the refusal path part of acceptance testing: send a sign-in request with no tenant context, confirm the 403, then confirm that a request carrying a valid tenant reaches the sign-in flow. Also plan for the operational effect. Internal tools and scripts that call these routes will fail until they send tenant context.

TRUST_TENANT_HEADER is the exception you need to understand, and it is off by default. When it is on, LibreChat accepts an X-Tenant-Id header before authentication on the /oauth, /api/auth, /api/share and admin authentication routes, so sign-in and shared links can resolve a tenant before a session exists. Enable it only behind a proxy that strips every incoming X-Tenant-Id and sets the authoritative value itself, and keep it off if your proxy cannot guarantee that. Tenant-scoped compound indexes then enforce uniqueness per tenant for users, roles, conversations and messages, so the same username or email can exist in two tenants without a collision. Databases created by v0.8.7 or earlier may need the tenant index migration, which must run with every writer stopped. Read the tenant index migration notes and schedule that window with your database team before upgrading.

The tenant is set at the proxy and checked before any data is reached

The request starts in the user's browser and reaches a trusted reverse proxy, which must strip any inbound X-Tenant-Id header and set the tenant itself. LibreChat's auth and API routes run with TENANT_ISOLATION_STRICT=true, so a request without an authenticated tenant context fails with a 403 (TENANT_CONTEXT_REQUIRED). Accepted requests reach MongoDB, where tenant-scoped compound indexes enforce uniqueness per tenant. Code execution goes to the Code Interpreter, which needs its own CODEAPI_TENANT_ISOLATION_STRICT=true. Treat the Meilisearch and RAG API boxes as open questions and confirm their tenant handling with the vendors, since the supplied documentation does not describe it.

Tenant context is set at the proxy and checked before any data is reached.

Decisions to make before tenants go live

Each card is a decision that sets how far one tenant can reach into another. Together they decide the trust boundary, who owns the rules that enforce it, and which services and logs are shared. Settle them before any tenant signs in, because changing them later touches users, data and routing.

One deployment or several

Choose between one deployment shared by several business units and separate deployments for each legal entity. A shared deployment means one MongoDB, Meilisearch, RAG API and upgrade schedule serves every tenant, so isolation depends on software and configuration controls. Separate deployments add infrastructure, backup and upgrade work for each entity but keep data, keys and administrators apart at the infrastructure level. Ask legal and security which boundary your contracts and regulators expect before you provision anything.

Proxy owns the tenant rule

With TRUST_TENANT_HEADER enabled, LibreChat accepts an X-Tenant-Id header before authentication on sign-in and admin routes. Enable it only behind a reverse proxy that strips every incoming X-Tenant-Id and sets the tenant itself. Name one team as owner of the proxy rule, because a missing strip lets a client choose its own tenant. Pair it with TENANT_ISOLATION_STRICT=true so that requests without tenant context fail with a rejection instead of falling back to a default tenant.

Environment variables

Provision tenant admins deliberately

Tenant-scoped deployments never promote the first user to admin, unlike single-tenant instances, so the first sign-in grants no administrative rights. Each tenant admin must come through a trusted administrative flow that your team designs and runs. LibreChat's docs publish no step-by-step tenant creation procedure, so onboarding is your own process. Decide who approves an admin, how each grant is recorded and how access is revoked before the first tenant goes live.

Access control docs

Scope endpoints and credentials

A custom endpoint in librechat.yaml can carry a tenantId that limits the endpoint, its deployment-managed credentials and its model specs to one tenant. The field only selects a scope, so it does not create the tenant or grant anyone membership. Decide whether each tenant brings its own provider keys, which spreads cost tracking and rotation work across tenants, or whether central keys serve several tenants, which concentrates spend and blast radius. Confirm that another tenant cannot see the endpoint.

Custom endpoint structure

Audit and log destinations

Decide where audit and log data is sent, who can read it and whether one tenant's administrators can see another tenant's records. Admin Insights limits each account to agents and data from its own tenant, so confirm that log exports and log aggregation keep the same boundary. A central log store simplifies operations for the platform team but becomes a shared readable pool unless access is split by tenant. Agree retention and reader lists with each tenant's security owner before go-live.

Admin Insights docs

Share or separate the Code Interpreter

The Code Interpreter runs code in a separate sandbox service that you deploy beside LibreChat. When tenants share one sandbox, set CODEAPI_TENANT_ISOLATION_STRICT=true in that service so requests without tenant context fail. A shared sandbox means fewer services to run and patch, while a separate sandbox per tenant keeps execution, temporary files and resource use apart, at the cost of more hosting and upgrade effort. Test that files generated by one tenant cannot be reached from another.

Code Interpreter configuration

How the answer changes by tenant situation

When each organization is a separate legal entity, the tenant boundary often has to match the boundary that a customer, auditor or regulator will ask about. Each entity needs its own administrators, its own tenant-scoped endpoints and credentials, and a clear account of where its data sits. Whether one shared deployment is acceptable is a decision for each entity's legal and security owners.

  • Tenant admins: Tenant-scoped deployments never promote the first user to admin, so each entity's administrators must be provisioned through a trusted administrative flow that you define.
  • Credentials: Set tenantId on custom endpoints so deployment-managed credentials and model specs are visible only inside the tenant that owns them.
  • Tenant creation: LibreChat's docs publish no step-by-step procedure for creating a tenant, so onboarding each entity is a process you design and document.
  • Data partitioning: Confirm how tenant data is separated inside the shared databases, including conversations, files and search indexes.
  • Contract terms: Confirm that sharing one deployment matches the data handling terms each entity has agreed to.

Confirm with each entity's legal and security owners that shared hosting is acceptable before you provision the first tenant.

Where LibreChat leaves tenant work to the operator

LibreChat provides isolation settings and tenant-scoped configuration for a shared deployment, but several steps stay with the operator. The cards below list the gaps platform teams should plan for, with the usual way to close each one: a runbook, a test plan or a written question to the project.

No documented tenant creation procedure

LibreChat's docs cover isolation settings, tenant-scoped configuration and provisioning tenant admins through a trusted administrative flow, but they do not give a step-by-step procedure for creating a tenant. Tenant onboarding is your own process. Write an operator runbook that covers the tenant identifier, the tenant admin hand-off, endpoint and credential setup, the first login test and the rollback path. Have a second operator follow it on a staging deployment before production.

Access control docs

tenantId selects scope only

A tenantId on a custom endpoint in librechat.yaml limits that endpoint, its deployment-managed credentials and its model specs to one tenant. It does not create the tenant or grant anyone membership in it. Membership is a separate step you must perform. Build a test plan that confirms a user in one tenant cannot see the endpoint in another, and that a tenant admin exists before users are told the endpoint is available.

Custom endpoint docs

Forged tenant headers at the proxy

TRUST_TENANT_HEADER is disabled by default. When enabled, LibreChat accepts an X-Tenant-Id header before authentication on the /oauth, /api/auth, /api/share and admin authentication routes. Enable it only behind a reverse proxy that strips every inbound X-Tenant-Id and sets the tenant itself. If the proxy passes the header through, a client can choose its own tenant. Test with a request carrying a forged header from outside the network, and confirm the proxy overwrites it on every route.

Environment variables docs

Tenant index migration on upgrade

Tenant-scoped compound indexes enforce uniqueness for users, roles, conversations, messages and other collections. Databases created by v0.8.7 or earlier may need the migrate:tenant-indexes command, which must run with every writer stopped. Plan it as a maintenance window with all writers stopped. Your runbook should stop the API and any other writers, take a backup, run the command, confirm the indexes, then restart. Rehearse the migration on a copy of production data first.

Tenant index migration docs

Admin Panel needs v0.8.5

The Admin Panel is a separate web app for managing users, groups, roles, permissions and configuration. It requires LibreChat v0.8.5 or later and ships as the admin-panel service in the official Docker Compose files. Any LibreChat release before v0.8.5 cannot run it. Record the version of every component in your deployment manifest, and add a check to the upgrade test so the Admin Panel starts before a change moves to production.

Admin Panel docs

Tenant scope in search and RAG

Message and conversation search runs on Meilisearch, and file search runs through the RAG API, which stores vectors in PostgreSQL with pgvector. Confirm with the LibreChat project how Meilisearch indexes and RAG API file collections are scoped per tenant before you assume a boundary exists. Until that answer is in writing, treat search and file retrieval as shared. Run a two-tenant test that searches for a unique phrase and retrieves an uploaded file from each side.

RAG API docs

Order of work to bring a tenant into production

This sequence brings a new tenant into a shared LibreChat deployment in an order where each step relies on the one before it. The proxy must be trusted before tenant headers are accepted, strict isolation must be on before tenants are relied on, and cross-tenant tests must confirm the boundaries hold before production use.

  1. Decide the tenant boundary and test on a copy

    Your team, or a partner, writes down which organizations or business units become tenants, who administers each one, and which data and endpoints each tenant may see. Restore a non-production copy of the MongoDB database and the configuration files, then run the planned settings there before touching production data. Keep the tenant map as the reference for every later check. This step is done when the data owners for each organization have reviewed the map, and the copy starts and runs with the intended settings without errors.

  2. Confirm the proxy strips and sets tenant

    Your reverse proxy must remove any incoming X-Tenant-Id header and set the authoritative tenant itself. LibreChat's TRUST_TENANT_HEADER setting is disabled by default, and the docs say to enable it only behind a proxy that does this. Send requests from outside the network with a forged X-Tenant-Id value, and confirm LibreChat never receives it on the /oauth, /api/auth, /api/share and admin authentication routes. Enable TRUST_TENANT_HEADER only after this passes. This step is done when forged headers are dropped on every route tested.

  3. Enable strict isolation in LibreChat and Code Interpreter

    Set TENANT_ISOLATION_STRICT=true in LibreChat and CODEAPI_TENANT_ISOLATION_STRICT=true in the Code Interpreter sandbox, then restart both services. With strict mode on, requests without an authenticated tenant context fail instead of falling back to a single-tenant ID. Send a request with no tenant context to an authentication route and confirm it returns a 403 with the TENANT_CONTEXT_REQUIRED code. Then run a code execution from a tenant user and confirm it carries that tenant's context. This step is done when both settings are active and the rejection is observed.

  4. Run tenant index migration on older databases

    If the database was created by v0.8.7 or earlier, run the migrate:tenant-indexes command with every writer stopped. The tenant-scoped compound indexes enforce uniqueness for users, roles, conversations, messages and other collections, so read the migration notes on how existing records are handled before you start. Stop the API, scheduled jobs and any other process that writes to MongoDB, and take a verified backup first. Check the command output for errors, confirm the indexes exist in MongoDB, then restart services. If the database came from a later version, confirm with the migration docs whether the step applies and record that decision.

  5. Provision tenant admins through the trusted flow

    Create the first administrator for each tenant through the trusted administrative flow your team defines. LibreChat's access control docs say tenant-scoped deployments never promote their first user to admin, so this step cannot rely on the first sign-in. Create a standard test user in the same tenant and confirm that neither account gained admin rights automatically. The docs do not publish a step-by-step tenant creation procedure, so write and approve your own runbook. This step is done when each tenant has an admin, the first registered user has no admin role, and the runbook is signed off.

  6. Scope endpoints with tenantId and check visibility

    Add tenantId to each custom endpoint in librechat.yaml that should be available to one tenant only. The field makes the endpoint, its deployment-managed credentials and model specs available only in that tenant, but it does not create a tenant or grant membership, so the membership from the previous step must already be correct. Sign in as a user from each tenant and check that the endpoints, agents and Admin Insights data are limited to that tenant. Confirm that a tenant admin cannot reach another tenant's settings in the Admin Panel. This step is done when each tenant sees only its own scoped items.

  7. Run cross-tenant tests and confirm 403 responses

    Create at least one test account in each tenant and try to reach another tenant's conversations, files, endpoints and admin functions, including by sending another tenant's identifier in a request. Record the request, the response and the account used for every attempt. Cross-tenant attempts should be refused with the 403 behavior LibreChat documents, and any other response should be investigated before go-live. Repeat the full set after any change to the proxy, configuration, database or Code Interpreter. This step is done when every attempt in the test plan is refused and the results are filed with the runbook.

What a security reviewer asks to see for tenant isolation

This table lists the questions a security reviewer usually asks about tenant isolation in one LibreChat deployment, the evidence to produce for each, and the file, setting or record where that evidence comes from. Read each row as a check you can run yourself before the review, and keep the outputs with the deployment's configuration. The strongest answers point to settings and test records that the reviewer can inspect directly.

Reviewer questionEvidence to produceWhere it comes from
How does a request get its tenant?The trusted proxy rule set and one sample authenticated request showing the tenant resolved at the proxy or authentication boundaryReverse proxy configuration, plus the upgrade guide's guidance on verifying tenant routing at that boundary
Are inbound tenant headers stripped?A proxy rule that removes every incoming X-Tenant-Id and sets the tenant itself, with the TRUST_TENANT_HEADER value shownProxy configuration file and the LibreChat .env file; TRUST_TENANT_HEADER is disabled by default
Is strict isolation on in LibreChat and the Code Interpreter?Both settings set to true in the running containers, plus a request without tenant context returning 403 TENANT_CONTEXT_REQUIREDEnvironment files for the LibreChat API and Code Interpreter, and the container environment read at runtime
How are tenant admins created?The written trusted administrative flow and a dated record of each admin grant, including who approved itYour own runbook; LibreChat does not promote a tenant's first user to admin, so the flow is yours to define
Was cross-tenant access tested?Test records showing a user in one tenant unable to read another tenant's users, conversations, files or endpointsYour test plan, test accounts, request logs and results from a dated run against this deployment
How do indexes enforce uniqueness per tenant?A MongoDB index listing for users, roles, conversations and messages, plus migrate:tenant-indexes output if the database predates v0.8.8The tenant index migration docs, with the index listing taken directly from the production MongoDB database
Which version is running?The image tags or commits of LibreChat and the Code Interpreter, matched to their release recordsRunning container image tags, and the GitHub releases page for the release each tag corresponds to

Questions buyers ask before approving tenant isolation

What drives the cost of a multi-tenant LibreChat setup?

The cost comes mainly from people and infrastructure around LibreChat, because the software is MIT-licensed and free to use. Four components drive it:

  • Engineering time to design the tenant model, configure the trusted proxy and build the provisioning flow, which is mostly one-time work.
  • Hosting for the LibreChat API, MongoDB, Meilisearch, the RAG API and pgvector, sized for the number of tenants and active users.
  • Model provider and embedding usage, which grows with each tenant's traffic and file search.
  • Ongoing operations: upgrades, backups, index migrations and onboarding each new tenant.

Costs rise with tenant count, the number of identity providers and any separate endpoints or credentials per tenant. In a quote, ask which items are one-time and which recur, and which tenant count the estimate assumes.

What must our operator team do itself for tenant isolation?

The operator owns the tenant design and every control that enforces it. Your team must:

  • Set TENANT_ISOLATION_STRICT=true in LibreChat and CODEAPI_TENANT_ISOLATION_STRICT=true in the Code Interpreter, so requests without a tenant context fail.
  • Run a reverse proxy that strips every incoming X-Tenant-Id header and sets the authoritative tenant itself. Enable TRUST_TENANT_HEADER only behind that proxy.
  • Provision tenant admins through a trusted administrative flow, because tenant-scoped deployments never promote the first user to admin.
  • Scope custom endpoints with tenantId where a tenant needs its own endpoint or credentials.
  • Build and run tenant onboarding, which LibreChat's docs do not script, and verify tenant routing at the proxy.
  • Run the migrate:tenant-indexes command with every writer stopped if the database was created by v0.8.7 or earlier.
How long does tenant isolation setup take?

The duration depends on factors you can size in your own environment, so ask for one tied to a written scope. The biggest drivers are the number of tenants and whether each one needs its own endpoints, credentials or model specs; how many identity providers and tenant admins must be wired; the state of your reverse proxy and how it handles headers; whether an existing database needs index migration, which requires a planned stop for every writer; and how long your approval process takes for each new tenant. A pilot with two tenants (illustrative) will show more about your timeline than any general estimate. Ask the partner to list tenant count and environment access as assumptions in the quote.

Does tenant isolation in LibreChat require a paid edition?

The LibreChat documentation for tenant isolation covers settings, tenant-scoped configuration and admin provisioning in the self-hosted software, and it does not describe a separate paid tier for those features. Confirm this with the vendor in writing before approval, including whether any tenant feature, admin capability or support channel sits behind a commercial offer. Also review the licenses of the components that run beside LibreChat, such as the Admin Panel, Code Interpreter, RAG API, MongoDB and Meilisearch, because they can carry terms that differ from the MIT core. Your legal or procurement team should own that review, and the vendor's answer should be recorded in the design approval file.

Can DeployOpen build the trusted proxy rule and provisioning flow?

Yes, DeployOpen can plan, implement and document both as part of a fixed-scope engagement in infrastructure you control. The written scope would cover the proxy rule that removes any client-supplied X-Tenant-Id header and sets the authoritative tenant, the provisioning flow for tenant admins through your trusted administrative process, tenant scoping for custom endpoints, and operator documentation for onboarding. Your side covers the identity decisions, who approves each tenant, and access to the proxy platform you run. Deliverables and timelines are agreed in writing before work starts, and a quote follows from that scope. Ask for acceptance criteria in the scope so the proxy and provisioning work can be checked against them.

Can we test the tenant design before production goes live?

Yes. Test the design in a staging deployment that matches production's proxy, identity and tenant layout before any tenant data moves. Useful checks include: a request with no tenant context should fail with 403 TENANT_CONTEXT_REQUIRED under strict mode; a client-supplied X-Tenant-Id must be removed or overwritten at the proxy; a tenant admin should see no users, agents or conversations from another tenant; a custom endpoint with a tenantId should appear only in its own tenant; and tenant-scoped uniqueness should hold after any index migration. Security testing of the tenant boundary can be scoped separately, including application and API testing. Ask the partner to provide these test cases in writing before work starts.

How DeployOpen sets up and tests tenant isolation

DeployOpen treats tenant isolation as a design and test problem before it is a configuration problem. We scope the tenant model, the trusted proxy path and the admin provisioning flow in writing, then build and test them inside your infrastructure. The result is a deployment your security and compliance teams can review against specific settings and evidence.

How we scope

  • The written scope names each tenant, its admins, and the endpoints and credentials scoped to it.
  • We agree how the trusted proxy resolves the tenant and which routes may accept an X-Tenant-Id header.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we build

  • Set TENANT_ISOLATION_STRICT=true in LibreChat and CODEAPI_TENANT_ISOLATION_STRICT=true in the Code Interpreter.
  • Configure the reverse proxy to strip every incoming X-Tenant-Id and set the authoritative tenant itself.
  • Set tenantId on tenant-specific custom endpoints in librechat.yaml, then confirm membership is granted separately.

How we hand over

  • Test cross-tenant access through the admin panel, insights and API routes, using accounts in each tenant.
  • Check tenant-scoped indexes, and for databases created by v0.8.7 or earlier, run migrate:tenant-indexes with every writer stopped.
  • Document the tenant onboarding runbook, since LibreChat publishes no step-by-step tenant creation procedure.

How we support

  • Confirm tenant admins stay on the trusted provisioning flow, because tenant-scoped deployments never promote the first user to admin.
  • Upgrades are planned against LibreChat's upgrade guide, with isolation settings rechecked after each change.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.