Self-hosting
Running your deployment
Agents
Agents run on an OpenClaw Gateway. A deployment can run one of its own, offered to one workspace (Settings → Gateway); other workspaces connect their own Gateway.
With Docker Compose, add the agents profile (or install with --agents), put your model provider's key in .env (ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY or GEMINI_API_KEY) or point it at models on your own server, and run docker compose up -d.
Models
Agents use the models of the providers your Gateways have keys for: each provider you add a key for puts its models in the agents' model picker (Settings → Agents → the agent → Model).
- The default model. An agent that doesn't choose one uses the Gateway's default. Set
AGENTS_DEFAULT_MODELon the API (provider/model, for exampleanthropic/claude-sonnet-5-5,openai/gpt-6-lunaoropenrouter/google/gemini-3.6-flash) to choose it for every Gateway your deployment runs, shared and per workspace, at once. A workspace's own Gateway keeps its own default. - Workspaces' own keys. On a Gateway your deployment runs for one workspace alone (a Gateway Manager's), owners can add their own keys for Anthropic, OpenAI, OpenRouter and Google (Settings → Gateway → Models). Each is checked with its provider before it's kept, sealed, and never shown again. It takes the place of your key for that provider on that workspace's Gateway, at its next start (at once if it's idle); the owner can also choose to use only the workspace's own keys. Turns on a workspace's own key aren't on its AI meter, so you don't bill them. On your shared Gateway, only the Anthropic key is used (by Claude Code), unless a deployment admin gives the shared Gateway's workspace what a Gateway of its own has (Deployment settings) and the API can restart it: on Fly.io, set
SHARED_GATEWAY_FLY_APPandSHARED_GATEWAY_FLY_TOKEN(a deploy token for that app) on the API. Saving a key then restarts the shared Gateway with it, and agents pause for about a minute; OpenClaw only takes a provider's key from its environment, so it can't be given to a running Gateway. A deploy of the shared Gateway sets its environment again, so the API puts the keys back within 10 minutes.
Models on your own server (Ollama)
Agents can run on models on a machine of yours, through Ollama: nothing leaves your network, and there's no provider to pay. Set OLLAMA_BASE_URL on the Gateway to Ollama's address, and every model pulled there that can use tools joins the model picker, under Ollama · on your own server, as ollama/<model> (for example ollama/mistral-nemo:latest).
- On the same machine, with Docker Compose: add the
ollamaprofile and setOLLAMA_BASE_URL=http://ollama:11434in.env, thendocker compose --profile agents --profile ollama up -dand pull a model:docker compose exec ollama ollama pull mistral-small3.2. Only the Gateway can reach it. With an NVIDIA GPU, give theollamaservice the GPU (adeploy.resources.reservations.devicesentry, as in Docker's GPU guide); without one it runs on the CPU, slowly. - Ollama already running on the machine (the Mac app, or
ollama serve):OLLAMA_BASE_URL=http://host.docker.internal:11434. On Linux, start Ollama withOLLAMA_HOST=0.0.0.0so containers can reach it, and keep port 11434 closed to the internet. - On another machine on your network: its address, e.g.
http://gpu-box.local:11434. Ollama has no sign-in of its own: reach it over your private network (or a VPN such as Tailscale), never the open internet. Behind a proxy that asks for a key, setOLLAMA_API_KEYtoo.
Use Ollama's own address, not its OpenAI-style /v1 one (OpenClaw needs the native API for tools; a /v1 on the end is taken off). Agents use tools for nearly everything, so models that can't (Ollama's library marks those that can tools) aren't offered. To make it the default for every agent, set AGENTS_DEFAULT_MODEL=ollama/<model> on the API.
| Model (Mistral's, to start with) | Size | Good for |
|---|---|---|
mistral-small3.2 | 24B | The best of them for agents: tools and pictures. About 15 GB; a machine with 32 GB or a GPU |
mistral-nemo | 12B | Tools and a long context in about 7 GB: a 16 GB laptop |
mistral | 7B | Small machines; weaker at work with many steps |
Local models are slower than the providers' and less sure-footed in long, many-step work (approvals, cards, several tools in a row): try yours on real work first, and consider them for the agents where keeping data at home matters most. The first answer after a while waits for the model to load (the Gateway allows five minutes). Turns on Ollama are on the AI meter like any other model's, under ollama/<model>; with no price set for it, they aren't billed.
Workspaces' own computers. On a Gateway your deployment runs for one workspace alone (a Gateway Manager's), its owners can link Ollama on a computer of theirs: Settings → Gateway → Models on your computer gives a code for tands ollama, which connects out to your API (the same /api your web app serves, so nothing extra to open) and passes on only chats and the model list. The workspace's Gateway is told to find its Ollama at your API (AGENT_UPLOAD_URL, or PUBLIC_URL, then /api/ollama/<workspace>), with a key for that link alone: at once if it's running (OpenClaw reloads its model providers without a restart), and every time it starts. Its models take the place of the deployment's Ollama on that Gateway. While the computer isn't connected, agents on its models say so at once rather than failing after a wait. One API instance holds each computer's connection, so run a single API instance while workspaces use it.
Agents' tools run in sandbox containers, which the Gateway starts through the host's Docker. So:
- The Gateway container has the Docker socket, which amounts to root on the host. Run it only on a machine dedicated to this deployment.
- Its state lives in
TAS_DATA_DIR/openclaw(by defaultdeploy/data/openclaw), at the same absolute path inside and outside the container, because sandboxes mount it by host path.
Agents' computers
Each agent works on a computer of its own: a sandbox with Python 3 (python-pptx, python-docx, openpyxl, reportlab, matplotlib, pandas), Node.js 24, Claude Code, fonts and the kit for building tabs, so agents can make decks, documents, spreadsheets, PDFs, charts and tabs. The image (openclaw-sandbox:bookworm-slim, about 1.6 GB) is built by the gateway-sandbox-image service. A workspace's own Gateway uses its own sandbox image: build deploy/openclaw/Dockerfile.sandbox there for the same tools, or let agents install the kit. Setup scripts, system installs, Claude Code and terminals, and what each kind of Gateway offers, are on Agents' computers.
A sandbox nobody has used for 30 minutes, with nothing left running in it, is stopped to give its memory back, and started again when it's next needed (its folder and installs stay). Set TAS_SANDBOX_IDLE_MINUTES on the Gateway to change that, or 0 to keep sandboxes running. Agents' browsers stop sooner, after 10 minutes without their agent working (TAS_BROWSER_IDLE_MINUTES).
Agents save what they make to a space's Files through a one-time upload link, which needs:
| Setting | What it does |
|---|---|
AGENT_SANDBOX_INTERNET | true (the default) gives sandboxes network access. false keeps every agent offline; owners can also turn it off per workspace (Settings → Gateway → Computers). Offline agents can still write text files |
AGENT_UPLOAD_URL | The address sandboxes reach the API at (default PUBLIC_URL). Set it when sandboxes can't use the public address, e.g. http://host.docker.internal:4400 on a single Docker host |
Host access: on a workspace's own Gateway only (never the deployment's), an owner can let an agent they made run some listed programs on the Gateway's machine instead of its sandbox (Settings → Agents → the agent → Host access). Anything not listed is refused.
The web
Agents search the web and read public pages when it helps, and their answers show what they searched for and which pages they read. Both run on the API, not on agents' computers: pages are fetched only from public addresses (never your private network, checked on every redirect), with size and time limits, and nothing on them runs. What a page says reaches the agent marked as untrusted, never as instructions. Workspace owners and admins turn it off for their workspace in Settings → Agents.
| Setting | What it does |
|---|---|
AGENTS_WEB | true (the default) offers agents the web where a workspace allows it. false turns it off for every workspace |
BRAVE_API_KEY | Brave Search's key for agents' searches. A workspace can add its own key instead (Settings → Agents → Web search). Without either, agents read the pages they're given but don't search |
Connectors that need your own app
Most connectors' servers let a deployment register itself the first time someone signs in. GitHub's doesn't: to let people sign in to GitHub's MCP server with their GitHub account, register a GitHub OAuth app once and give the deployment its client.
- In GitHub, Settings → Developer settings → OAuth Apps → New OAuth App (your organisation's settings, or your own). Its Authorization callback URL is
https://<your address>/api/mcp-connectors/oauth/callback. - Create a client secret, and set both:
| Setting | What it does |
|---|---|
GITHUB_CLIENT_ID | The app's client ID. |
GITHUB_CLIENT_SECRET | Its client secret (set both, or neither). |
People then add GitHub from Add a connector → GitHub, each signing in as themselves; the sign-in asks for repo read:org read:user user:email notifications. Without the app, the same button adds GitHub with each person's own personal access token (Bearer github_pat_…). Organisations that restrict OAuth apps approve yours once in their settings.
Connectors' views
Connectors whose tools come with a view (MCP Apps) show it under the agent's answer. The view's page is served from your own address, sandboxed: it runs in an origin of its own (no cookies, storage or page of yours), reaches only the domains its server declares, and may call only its own server's tools that only read and are turned on, as whoever is looking. Nothing to set up; what a server needs to show one is on Cards and views. A connector on your own machine (localhost, in development) needs CONNECTORS_PRIVATE_NETWORKS=true, as for any connector there.
Billing your workspaces
A deployment can charge its workspaces for what they use: seats, file and database storage, AI usage, its Gateways' time and storage, and a flat fee.
- Set prices in Deployment settings → Billing. Everything is off until you price it.
- To be paid online, connect your own Stripe account under Payments on the same tab (Connect Stripe), with a restricted key that can write Customers, Invoices and Invoice items (and Checkout Sessions, Setup Intents and Payment Methods, for workspaces to save a card).
- When each month ends, every billed workspace gets a statement. With Stripe, it becomes an invoice Stripe emails to the workspace's billing contact (or owner), or charges to its saved card; without, mark statements paid under Statements, on the same tab.
Payments are checked with Stripe every hour, so a deployment behind a firewall needs nothing more.
Taxes
Invoices carry no tax unless you turn on Stripe Tax (Payments → Taxes → Use Stripe Tax). Stripe then works out VAT, GST or sales tax for each invoice from the workspace's billing address and tax ID, and adds it to your prices or takes it as included in them (Your prices). Stripe charges for Stripe Tax.
Stripe only collects tax where your account is registered to: set a head office address and add your registrations on Stripe (Tax → Settings and Tax → Registrations). The page shows what Stripe says (where it's collecting), and warns when it would add no tax at all. Which registrations you need is a question for your tax advisor, not this page. Invoices take your account's preset tax code (Tax → Settings).
- A workspace's address. Stripe Tax needs to know where a workspace is (a country is enough in most countries; a full address in the US, Canada and India). One without is asked for its billing address by email and on its Billing page, and its invoice is sent once the address is saved.
- Tax IDs. A workspace's tax ID is given to Stripe as its own (an EU, UK, Swiss or Norwegian VAT number, an Australian ABN, a Canadian BN, and so on, by its country), so a business abroad is reverse-charged. Elsewhere it's printed on invoices.
- What workspaces see. Statements show what the invoice comes to, with its tax.
- Invoices already sent stay as they are; turning it on or off applies to invoices made from then on.
A restricted key also needs read access to Tax settings and Tax registrations, and write access to Customers (their tax IDs).
Stripe's webhook
With a public https address, Stripe can tell your deployment at once: a payment shows (and a workspace that was read-only for it is writable again) as soon as Stripe has it, and a card saved on Stripe's page is kept even if the person closes the tab before coming back. Under Payments, Instant updates → Turn on adds the endpoint to your Stripe account (the key needs write access to Webhook Endpoints); turning it off, or disconnecting Stripe, removes it.
Without that access, add the endpoint on Stripe yourself and paste its signing secret (Add the endpoint on Stripe yourself):
| Address | <PUBLIC_URL>/api/billing/stripe/webhook (shown on the page, to copy) |
| Events | invoice.paid, invoice.voided, checkout.session.completed |
Deliveries are checked against the signing secret (stored encrypted) and refused when unsigned or more than five minutes old. A delivery only says what to look at: the invoice or card is read back from Stripe, so a repeated, late or out-of-order delivery changes nothing, and the hourly check carries on either way.
To try it on your own machine, where Stripe can't reach you, forward events with the Stripe CLI: stripe listen --forward-to <the address shown> --events invoice.paid,invoice.voided,checkout.session.completed (http://localhost:5400/api/billing/stripe/webhook with the example settings), then paste the signing secret it prints.
Gateway hours and storage
Agents on your Gateways cost you machine time. Two meters pass it on:
| Meter | What it counts |
|---|---|
| Gateway hours | Hours a workspace's own Gateway from the Gateway Manager ("Managed for you") is awake, and hours a workspace is connected to your shared Gateway. One price for both |
| Gateway storage | A workspace's own Gateway's disk (its volume), per GB-month, asleep or awake |
A workspace that connects its own Gateway pays neither. To price them, start from what your host charges: on Fly.io, a 2-CPU, 4 GB machine (what a Gateway needs once its agents are busy) is about $0.03 an hour and a volume $0.15 per GB-month.
Keeping a Gateway awake: a "Managed for you" Gateway sleeps after 15 idle minutes and takes about half a minute to wake. Turn on Let workspaces keep their Gateway awake in Deployment settings → General, and owners can choose Keep it awake in Settings → Gateway: it never sleeps, so agents answer at once, and they pay for every hour. Turning the option off lets every kept-awake Gateway sleep again.
Support
To be eligible for support from us, register the deployment in Deployment settings → Support with a contact email.
- What's sent: one report a day, numbers only (counts, sizes, tokens, version), never messages, names or files. The Support section shows the next report, field by field, before you register.
- Stopping: unregister there, and the reports stop.
- Without internet access: a deployment can run without registering, but isn't eligible for support.
- Asking for help: with a Standard or Priority support plan, open a ticket in the same section. Our replies appear there and are emailed to whoever opened it.
Helping your workspaces
People ask for help, report problems and share ideas from Help & feedback (their account menu). You answer in Deployment settings → Requests, and so can each workspace's owners and admins. With a support plan from us, you can pass any request on to us; to charge your workspaces for support, price the Support plan in Billing.
Health
| Check | What it tells you |
|---|---|
GET /api/health | The API is up, and its version |
GET /api/health/ready | The database and storage answer (503 if either doesn't) |
| Deployment settings → General → Service status | The same, with response times, in the app |
docker compose ps | Every container's health check |
To be told when something's wrong, deploy/monitor is a small check (one file, Node 22, no dependencies) to run every few minutes or hourly, with cron or a scheduled machine. It requests the addresses you give it and emails you through Resend when one doesn't answer as expected:
| Setting | What it is |
|---|---|
MONITOR_CHECKS | [{"name": "App", "url": "https://chat.example.com/api/health/ready"}, …], each expecting 200 unless it says "expect" |
RESEND_API_KEY | A Resend key (the same as your SMTP_PASSWORD when your email goes through Resend) |
ALERT_FROM, ALERT_TO | Who it's from (an address on your verified domain), and who's told (comma-separated) |
BACKUP_APP, FLY_API_TOKEN | On Fly, also checks the nightly backup succeeded within 26 hours (a read-only token) |
MONITOR_TEST=1 sends an email even when all is well, to check alerts reach you.
To check a deployment end to end, run the smoke test from a machine with Node 22:
node deploy/smoke-test.mjs https://chat.example.com <setup token>It completes setup if needed, creates a workspace, sends a message (checking it arrives live), and uploads and downloads a file. Use it on a fresh install or a test copy: it leaves a "Smoke test" admin and workspace behind.
More than one API machine
The API can run as several copies (machines, containers) for more room or to keep going while one restarts. They need nothing new from you: they share the database, the bucket and Redis (REDIS_URL, which production needs anyway for background jobs), and through Redis they share what each used to keep to itself:
- Live updates: a message posted through one copy reaches people connected to any of them, as do typing, who's here and who's away.
- Agents' answers: Stop, Delete and Retry work from any copy, and an answer still being written elsewhere isn't shown as cut short.
- Computers linked for Ollama (
tands ollama): the computer connects to one copy; a Gateway's request reaching another is passed to it. - One-time things: terminal links, a WhatsApp login being started, skill installs (one at a time per workspace), and limits on sign-ins, apps' actions and events (counted across copies).
- Moving a workspace's data, and imports: a move another copy is making isn't mistaken for one cut short, and an archive uploaded through one copy is imported through any other.
Put the copies behind your proxy as one address (the bundled Caddy forwards /api to every address API_HOST resolves to, in turn, on API_PORT; with Docker Compose, docker compose up --scale api=2). Live updates are WebSockets, so the proxy must pass those through; it doesn't need to send someone back to the same copy. Without REDIS_URL, run one copy only: each would keep its own.
On Fly.io: fly scale count 2 -a <your app>-api. The web app reaches the API at <app>-api.internal, which lists every machine: requests and sockets go to each in turn, and a machine that stops answering is left out until it's back.
Upgrades
Images are pinned to TAS_VERSION. To upgrade:
# 1. Back up (below).
# 2. The new release's install files, over the old ones (your .env and data stay):
curl -fsSL https://developer.tabsandspaces.dev/releases/tabs-and-spaces-X.Y.Z.tar.gz | tar -xz
cd tabs-and-spaces
# 3. Set TAS_VERSION=X.Y.Z in .env, then:
docker compose pull
docker compose up -dRead the release's CHANGES.md first (also on the Releases page): it says what's new and anything to do when upgrading.
On Fly.io, unpack the new release's download and run its fly/launch.sh again with your fly.env (Running on Fly.io); from the source, the same flyctl deploy commands.
When the API starts, it migrates the data to the new release's layout before serving anything: the deployment's database and every workspace's, wherever it lives. Migrations run once (several API instances take turns), an interrupted run resumes where it stopped, and a workspace whose database can't be reached is skipped and tried again on the next start (the logs say so).
Downgrades aren't supported. An older release refuses to start on data a newer one has migrated (Can't start: … was upgraded by a newer release). To go back, restore the backup taken before upgrading.
Backups
| What | How |
|---|---|
| MongoDB | mongodump --uri "mongodb+srv://user:pass@cluster.example.net/" --archive=backup.gz --gzip: the address without a database name, so it covers the deployment's database and every workspace's on that server (the bundled one: docker compose exec mongo mongodump --archive --gzip > backup.gz). On a hosted MongoDB such as Atlas, which won't dump its own admin database, use the nightly backup below, which goes database by database. Atlas also takes backups on paid tiers |
| Files | Copy the bucket (the bundled SeaweedFS: back up the s3-data volume) |
| Secrets | Keep a copy of .env (or your Fly secrets), above all AUTH_SECRET: changing it signs everyone out, and without it saved credentials (Gateway tokens, workspaces' own database and bucket keys) can't be read |
Every night, automatically
deploy/backup is a small image that dumps every database to a bucket of its own (any S3-compatible storage) and checks the result. Give it a bucket only it can write to, with a rule that deletes old dumps (on R2: wrangler r2 bucket lifecycle add <bucket> expire-30-days "" --expire-days 30), and run it daily:
| Setting | What it is |
|---|---|
MONGODB_URI | Your MongoDB, as the API has it (the database name in it is ignored) |
BACKUP_S3_ENDPOINT, BACKUP_S3_BUCKET | Where the dumps go: mongodb/YYYY/MM/tabs-and-spaces-<time>.tar, one gzipped dump per database |
BACKUP_S3_ACCESS_KEY_ID, BACKUP_S3_SECRET_ACCESS_KEY | A key for that bucket only |
BACKUP_S3_REGION, BACKUP_S3_PROVIDER | Default auto and Cloudflare; for AWS, the bucket's region and AWS |
With cron on your server: docker build -t tas-backup deploy/backup, then nightly docker run --rm --env-file backup.env tas-backup. On Fly, deploy/backup/schedule.sh runs it on a machine that starts once a day (deploy/fly/backup.toml).
Check it restores. restore-test.sh in the same image downloads the newest dump, restores it into a throwaway MongoDB inside the container, and lists every database and its documents: docker run --rm --env-file backup.env tas-backup restore-test.sh (on Fly: deploy/backup/schedule.sh restore). Do it after setting it up, and now and then.
Restoring for real, after losing data:
- Stop the API, so nothing writes meanwhile.
- Download the backup you want from the bucket, and unpack it:
mkdir dump && tar -C dump -xf <backup>.tar. It holds a folder per database. mongorestore --uri "<your MongoDB, without a database name>" --dir dump --gzip --drop.--dropreplaces each collection with the backup's. To restore one workspace only, add--nsInclude 'tas_ws_<workspace id>.*'.- Start the API. It migrates the data if the dump came from an older release.
Gateways keep agents' files (and their own notes) on their own disks; what spaces and people remember is in the workspace's database, with everything else. On Fly, the volume's daily snapshots cover them: flyctl volumes update <volume> --snapshot-retention 30 keeps a month (the Gateway Manager makes workspaces' Gateways with that). A workspace's own Gateway is also backed up to its bucket while it sleeps (Settings → Gateway → Backups).
Redis holds only pending work, which the app rebuilds from MongoDB: it needs no backups. Workspaces on their own MongoDB or bucket are backed up wherever those live. Workspace owners can also download an export (Settings → Data), which can be imported into any deployment.
Building the images yourself
From the repository root:
docker build -f deploy/Dockerfile --target api --build-arg TAS_VERSION=1.2.3 -t my-registry/tabs-and-spaces-api:1.2.3 .
docker build -f deploy/Dockerfile --target web --build-arg TAS_VERSION=1.2.3 -t my-registry/tabs-and-spaces-web:1.2.3 .Then set TAS_IMAGE_PREFIX=my-registry/tabs-and-spaces and TAS_VERSION=1.2.3 in .env. Both images run as non-root users: the API is Node 22 (slim) with only its runtime dependencies, and the web image is Caddy with the built app.