Skip to content

About

A chatbot, with a large language model split across its users, entirely in the browser.

Topics

Resources

Stars

57 stars

Watchers

0 watching

Forks

Repository files navigation

ClusterChat

The AI your group runs together.
Cluster the GPUs you already have to run one 27B model.
Chat with it in a browser tab, or point your whole team's coding agents at it.

Live demo npm License: AGPL v3 WebGPU WebRTC Model

At a glance · Chat · Coding agents · Benchmarks · How it compares · How it works · Limitations · Run it yourself · Docs


12 people 8 coding agents 19.7 tok/s 8.1 tok/s 0 installs
chatting at once on two RTX 3090s concurrent opencode sessions (3.6 s to 1st tok) one chat, two RTX 3090s in one PC across the internet, France ↔ Spain a browser tab is enough


Four people open the same link and each lend a different amount of GPU memory, and their pieces come together into the whole model. Ana and Lab PC 3 chat in the browser while Ben and Mia point opencode and Claude Code at the same model. Ana closes her laptop mid-reply, and the chat and both agents keep going.

At a glance

ClusterChat splits a 27B model across the machines of everyone in a group, so machines that could never run it alone run it together. A machine lends its GPU from a browser tab or, with one command, from a terminal. Anyone with the link can chat in a browser tab, and anyone with a terminal can run their coding agents on it through local Anthropic and OpenAI APIs. Many people and agents use it at once, any machine can leave mid-reply without breaking it, and the invite code never reaches the server.

Model Qwen3.8-27B, 8-bit, about 27 GiB across the cluster
Speed up to 19.7 tok/s per chat (Speed)
Context 4K to 32K tokens, chosen when the cluster is created (16K by default); the KV cache is int8
People per cluster up to 64, each with their own chat
Replies at once set by whoever starts the cluster
Chats each browser keeps in memory 8 by default, up to 32 in a private cluster
Coding agents opencode, Claude Code and any OpenAI-compatible tool; 8 opencode sessions at once (Benchmarks)
Install none to chat or lend a GPU in a browser; npx clusterchat@latest for agents, or to lend a GPU from a terminal

Two ways to use it

Chat in your browser Run your coding agents on it

Open the invite link. Lend as much GPU memory as you like, or none, and start chatting. Everyone gets their own chat, and the replies are written at the same time.

12 people on two RTX 3090s, each reply at about 7 tok/s.

Try the demo · Start a private cluster · More

One command in your terminal. No GPU or browser needed:

npx clusterchat@latest connect '<invite link>'

Then point opencode or Claude Code at it. 8 agents at once, and each response starts in a median 3.6 s. If the machine has a GPU, the same command can lend it.

Setup · Benchmarks · Lend from a terminal

Why ClusterChat

A 27B model needs about 27 GB of GPU memory. Few people have that. A group of friends, a lab or a club usually does, spread over several machines. ClusterChat turns those machines into one model that the whole group uses at the same time. It works like a torrent, except people share the work of running a model instead of the pieces of a file.

  • Nobody has to stay. There is no host. Each piece of the model can be held by more than one browser. When someone leaves mid-reply, the browser before them replays the lost work into another holder, and the reply carries on.
  • Built for real networks. Speculative decoding (prompt lookup plus the model's own multi-token prediction head) checks up to 7 tokens per trip around the cluster. Two machines 28 ms apart reach 8.1 tok/s at default settings and 14.5 on repetitive text.
  • Full 8-bit weights, same text however it is split. The model runs at q8. The residual stream is rounded to f16 after every block, so a reply is bit-identical whether one browser or ten hold the model.
  • Private by design. Invite codes live in the link's fragment and never reach the server. Every handshake is signed with a key derived from the code. Links go through a relay, so nobody learns anyone else's IP address (more).
  • Nothing to install. Open a link. A new browser serves as soon as its first piece has downloaded and takes on more while it is idle, up to the VRAM limit its owner sets. Any browser can join just to chat. A machine with no browser open lends its GPU with one command instead.

Note

Your chat is separate, not secret. Every computer in your cluster processes it. Invite people you trust. The public demo is open to anyone, so don't send it anything personal.

Chat together

Start a private cluster at clusterchat.io/create. You choose how much GPU to lend, how many replies can run at once and the context length, then share the invite link. Up to 64 people can join. Everyone gets their own chat, saved in their own browser, and each one has its own KV cache on every machine. Each browser runs the waiting chats' next tokens as one GPU pass, so a busy cluster stays fast for everyone.

Four computers join one cluster, each lending a different amount of GPU memory. Each person asks their own question and the replies are written at the same time. Ana closes her laptop mid-reply, the other chats keep going, and Mia starts a new one.

Speed

One person gets 19.7 tok/s on one PC, and twelve people at once still get about 7 tok/s each. Qwen3.8-27B q8 on two RTX 3090s, either both in one PC or in two PCs, one in France and one in Spain:

One PC Two PCs, France and Spain (28 ms apart)
One person chatting 19.7 tok/s 8.1 tok/s
Twelve people chatting at once about 7 tok/s about 5 tok/s

Code and lists are faster: 14.5 tok/s across the two PCs.

How it was measured, and the full numbers

Replies of up to 128 tokens, default settings, measured with tools/load.mjs.

Twelve people arrive over 30 seconds and ask three questions each. Speed of each chat (median), by how many prompts were running at once:

Prompts at once 1 2 3 to 4 5 to 8 9 to 16
One PC 13.9 tok/s 4.9 tok/s 7.2 tok/s 7.1 tok/s –
Two PCs 9.0 tok/s 6.3 tok/s 5.9 tok/s 4.0 tok/s 5.0 tok/s

All 36 replies finished. The cluster wrote 19.1 tok/s in total on one PC and 16.0 tok/s on two.

One person asks six questions. Speed over the whole run:

Speculation off On (default)
One PC – 19.7 tok/s
Two PCs 6.5 tok/s 8.1 tok/s
Two PCs, code and lists (greedy) 6.5 14.5

Speculation checks up to 7 drafted tokens per trip through the GPUs, and the text is the same as without it (how).

# One person. Add --no-spec or --greedy for the other columns.
node tools/load.mjs --url <cluster url> --users 1 --turns 6 --tokens 128

# Twelve people.
node tools/load.mjs --url <cluster url> --users 12 --ramp 30 --turns 3 --think 10 --tokens 128

Private clusters

A private cluster is for a group: friends, a lab, a club.

  • The invite code never reaches the server. It lives in the link's fragment (/chat#mesh=<code>), which browsers don't send.
  • Handshakes are signed. Every WebRTC handshake is signed with a key derived from the code, so only browsers holding the invite can link.
  • The servers see who, not what. The signaling server sees who is in the cluster but cannot join it or read anything in it.
  • Relay-only links by default, so peers don't learn each other's IP addresses.
  • Chats stay in your browser (IndexedDB) and can be resumed or exported later.

Browser support

Browser Can lend its GPU on
Chrome, Edge 113+ Windows, macOS, ChromeOS, Android. Linux may need WebGPU switched on in chrome://flags.
Safari 26+ macOS, iPhone, iPad
Firefox Windows (141+), Apple silicon Macs (145+)

Any modern browser can join to chat without lending.

Lend a GPU from a terminal

A machine doesn't need a browser to lend its GPU. The clusterchat npm package joins the cluster from a terminal and holds part of the model as a lending browser tab does, so a server or a lab PC can serve the group with one command:

npx clusterchat@latest connect '<invite link>'

connect asks how much GPU memory to lend. It suggests what the driver reports as free, less some headroom for your desktop, and fills in your last answer next time. It then shows a full-screen dashboard of the cluster, what your GPU holds and how many tokens it has served, where ←/→ changes the amount and s stops lending. It asks first if stopping or leaving would take the model down for everyone else.

npx clusterchat@latest gpu                                             # what this machine could lend, without joining
npx clusterchat@latest connect '<invite link>' --lend 20 --no-bridge   # a machine that only lends 20 GB, nothing asked
  • The same model, token for token. The terminal runs the same hand-written kernels as the browser, through Dawn, the WebGPU implementation inside Chrome. A cluster served from a terminal writes the same reply as one served from browser tabs.
  • What it needs. Node 18 or newer and a GPU that Dawn can use: Vulkan on Linux, D3D12 on Windows, Metal on macOS.
  • Restarts are quick. The part of the model the machine holds is cached on disk and checked against the server on each start, so only what changed is downloaded again.

See cli/README.md for the dashboard, the keys and every option.

Coding agents

Four computers lend their GPUs to one cluster. Four developers point opencode and Claude Code at it with npx clusterchat connect, and the agents read, edit and run tests at the same time. Ana closes her laptop and every agent keeps going.

Run a whole team's coding agents on GPUs you already own. The clusterchat npm package joins a cluster from your terminal, with no GPU or browser needed, and serves it to your agent as local Anthropic and OpenAI APIs. When someone's machine leaves, every agent keeps going.

Connect in one command

npx clusterchat@latest connect '<invite link>'

Keep the link in quotes: unquoted, the shell cuts it at & and you join a different, empty cluster. The invite card on a private cluster's page shows this command with the link filled in, and connect shows which cluster it joined and how many GPUs serve it. On a machine with a usable GPU it also asks whether to lend it; answer no, or pass --no-lend, to only run agents. Then point your agent at it from another terminal. connect shows both commands:

opencode: add the cluster as a provider to opencode.json in your project, keeping the rest of the file:

npx clusterchat@latest setup opencode --write

Claude Code: start claude with every model it may pick pointed at the cluster's. Its own arguments pass through:

npx clusterchat@latest claude

Claude Code's system prompt and tools are about 20K tokens, so it needs a cluster created with a 32K context. opencode needs less.

Anything else that speaks the Anthropic Messages API or the OpenAI Chat Completions API can use http://127.0.0.1:4747 (OpenAI: /v1). It works the same with a self-hosted server: the client takes the server from the link. npx clusterchat@latest status shows what a running connect is doing. See cli/README.md for the options.

Built for a whole team

Tip

Before the cluster shared prompts between sessions, eight opencode sessions finished 1 task of 8 in 50 minutes. Now they finish 16 of 16.

  • Each request only processes what's new. An agent resends the whole conversation every time it asks the model something, 8,000 to 10,000 tokens here. The cluster keeps every conversation in memory, so a request usually adds about a hundred new tokens, and eight agents wait barely longer than one.
  • The system prompt is processed once for everyone. Every opencode session opens with the same ~8,000-token system prompt and tool list, which takes the cluster about 100 s. Each new session reuses 7,168 of those tokens, so its first response starts after 21 s, or 33 s with eight agents running.
  • The work gets done. Bug fixes, edits across files and shell tasks: 82 of 82 tasks passed across the 16K and 32K runs, with no malformed tool calls in 544 requests.
  • Give each agent its own connect. Several agents can share one connect, but it writes one reply at a time, so their requests wait their turn.

Benchmarks

Going from one agent to eight, each response starts barely later (2.4 s → 3.6 s) and the cluster writes 70% more in total. opencode sessions at once on two RTX 3090s, each working in its own repo, 16K context:

opencode agents at once 1 2 4 8
Each response starts after 2.4 s 3.1 s 2.8 s 3.6 s
A new session's first response starts after 21 s 22 s 27 s 33 s
Each agent's writing speed, while writing 12.7 tok/s 9.9 tok/s 3.8 tok/s 1.6 tok/s
Cluster output, averaged over the whole run 5.2 tok/s 7.3 tok/s 8.5 tok/s 8.9 tok/s
Tasks passed 5 / 5 4 / 4 8 / 8 16 / 16

Medians, waiting in line included.

How it was measured, and the full numbers

Qwen3.8-27B q8 on two RTX 3090s in one rented machine, one GPU per browser tab, each holding half the model. A private cluster with 32 chats in memory. opencode 2.2.5, one clusterchat connect per session, run on a separate machine and reaching the cluster through the relay. One session runs five tasks: fix a bug, answer a question about the code, add a function with a test, rename a function across files, and a multi-step shell task. At 2, 4 and 8 sessions, each session runs the bug fix and the shell task.

Context Agents Each response starts (median) New session's first response (median) Any request, first token p50 / p95 Writing speed, each response All agents Tasks passed Time per task (median) Retried
16K 1 2.4 s 21 s 6.2 / 21.5 s 12.7 tok/s 5.2 tok/s 5/5 59 s 0
16K 2 3.1 s 22 s 5.5 / 34.7 s 9.9 tok/s 7.3 tok/s 4/4 197 s 0
16K 4 2.8 s 27 s 5.5 / 50.6 s 3.8 tok/s 8.5 tok/s 8/8 223 s 0
16K 8 3.6 s 33 s 6.5 / 41.6 s 1.6 tok/s 8.9 tok/s 16/16 475 s 15
32K 1 2.4 s 22 s 5.8 / 22.2 s 11.1 tok/s 5.9 tok/s 5/5 82 s 0
32K 2 5.5 s 31 s 5.9 / 35.0 s 8.8 tok/s 8.9 tok/s 4/4 115 s 0
32K 4 2.8 s 32 s 4.4 / 37.5 s 4.0 tok/s 9.2 tok/s 8/8 135 s 2
32K 8 2.9 s 44 s 5.1 / 48.7 s 1.6 tok/s 10.2 tok/s 16/16 317 s 18

Each response starts is the time to first token for a request that continues a conversation, typically after the agent ran a tool. New session's first response is the same for the ~8,000-token first request of a session that reused the shared system prompt. Both include waiting in line. Any request also counts each session's first request and opencode's title requests. Retried counts requests the cluster turned away with "try again in a moment" while busy; opencode sent them again and every task still passed. The 32K run happened to need fewer requests for the same tasks, so its times are not a sign that 32K is faster.

Several agents through one connect also works: four opencode sessions pointed at a single clusterchat connect passed 8 of 8 tasks (median 374 s at 16K, 263 s at 32K). A connect writes one reply at a time, so requests wait their turn (median 37–39 s).

# All five tasks, one session.
node tools/cli.opencode.mjs '<invite link>' --ctx 16k --levels 1

# 2, 4 and 8 sessions at once, one connect each.
node tools/cli.opencode.mjs '<invite link>' --ctx 16k --levels 2,4,8 --tasks fix,shell

# Four sessions through one connect.
node tools/cli.opencode.mjs '<invite link>' --ctx 16k --levels 4 --tasks fix,shell --shared

How it compares

Projects that split a model across machines, or run one in a browser tab. Each published speed is for a different model on different hardware, so read it as what each project can do, not as a ranking. Facts are from each project's README or the linked source as of October 2026.

Project Runs in Splits one model across machines Install per machine Several people at once When a machine leaves Published speed (source, hardware)
ClusterChat browser tab (WebGPU), or a terminal yes, over WebRTC through a relay none, open a link; one npx command from a terminal yes, each person has their own chat and several replies run at once; coding agents connect through local Anthropic and OpenAI APIs pieces are held by more than one browser; an interrupted reply is replayed elsewhere Qwen3.8-27B q8: 19.7 tok/s on two RTX 3090s in one machine, 8.1 tok/s across two machines 28 ms apart over a real internet link (Speed)
Pooled browser tab (WebGPU) yes, over direct WebRTC, relay as a fallback none, open a link one shared conversation that everyone in the room sees; requests run one at a time the host deals the layers out again Qwen 3.8 27B Q4_0: 20 to 27 tok/s on one GB10; 7.6 to 11.9 on two devices under emulated delay (README)
Petals native Python yes, layers served by volunteers pip package, PyTorch yes, each client runs its own session clients route around servers that leave up to 6 tok/s Llama 2 70B (README); last commit 2024-08-25
exo native (MLX); macOS app, Linux on CPU yes, with RDMA over Thunderbolt 5 on Macs macOS app or build from source serves an OpenAI-compatible API not stated 31.9 tok/s Qwen3 235B on 4x M3 Ultra (Jeff Geerling)
llama.cpp RPC native yes, remote ggml devices build with -DGGML_RPC=ON on every host; trusted networks only through llama-server not stated 15.2 tok/s Qwen3 235B on 4 nodes, 4x M3 Ultra (Jeff Geerling)
distributed-llama native (CPU, experimental Vulkan) yes, tensor parallel, power-of-2 node counts C++ build plus Python launcher not stated not stated 13.04 tok/s Qwen3 30B A3B on 4 Raspberry Pi 5 (#255)
Mesh LLM native (Rust, llama.cpp) yes, over QUIC install script, Homebrew or distro package serves an OpenAI-compatible API not stated none in the README
WebLLM browser tab (WebGPU) no, the whole model in one tab none for users no, one tab n/a 41.1 tok/s Llama 3.1 8B on an M3 Max (paper)
Transformers.js browser or Node (ONNX Runtime) no none for users no, one tab n/a WebGPU up to 100x faster than WASM (v3 post)

Where others are ahead today: ClusterChat runs one model per cluster, its peers are trusted, and its license is AGPL. See Limitations.

How it works

Ana's laptop and Lab PC 3 each hold pieces 1 to 6 of the model. Ben's gaming PC and Mia's desktop each hold pieces 7 to 12. Ben's message runs on Ana's laptop, then his own PC. Mia's runs on Lab PC 3, then her desktop. All four connect to a signaling server and a relay.

The model is cut into positions: the embedding, each transformer block, and the head. A browser, or a terminal running clusterchat (a peer), holds a contiguous range of positions and downloads only those weights. Ranges can overlap, so a peer leaving does not break the model.

For each token, the residual stream passes from peer to peer over WebRTC datachannels as f16. Each peer runs its range on its own GPU with hand-written WebGPU kernels, and the peer holding the head samples the next token. Every chat is its own session with its own paged KV cache on each peer, and routing balances sessions across peers that hold the same positions.

The signaling server gives each browser an id, decides which range a new browser should hold, broadcasts the roster, and relays WebRTC offers and answers. It never sees a prompt, a reply or an activation.

When a peer leaves mid-reply, the peer before it replays the lost work into another holder. If that fails, the asking browser rebuilds the chat from its token history.

Limitations

  • One model per cluster.
  • Agents share the cluster's speed. Total throughput grows as you add agents, but each one's replies slow down: at eight opencode sessions on two RTX 3090s, each reply writes at about 1.6 tok/s.
  • Peers are trusted. Nothing checks that a browser ran its piece honestly.
  • First come, first served. Each browser runs one job queue, so a long prompt can briefly slow other chats on the same peers.
  • A rare stalled reply. Earlier load tests had one to three replies that stalled for about five minutes before finishing. The latest runs had none, but the cause is not fixed yet.
  • Metadata is visible to the servers. They see who is in a cluster, but not what anyone says.

The full list is under Known gaps in docs/architecture.md.

Run it yourself

What it can run

tools/convert_hf.py converts a Hugging Face checkpoint and rejects any architecture the kernels do not implement:

  • Llama-style decoder blocks (RMSNorm, GQA/MHA, RoPE including Llama 3.1 scaling, SwiGLU, tied or untied LM head): SmolLM2 and Llama 3.x.
  • The Qwen3.8 hybrid (qwen3_5): Gated DeltaNet linear-attention layers mixed with full-attention layers that have partial RoPE, QK-norm and an attention output gate, plus its MTP draft head. Text only.

Weights are stored as f32, f16 or q8. The tokenizer must be byte-level BPE.

Quick start

You need Node.js, Python 3, Caddy and a browser with WebGPU.

git clone https://github.com/l-wn/ClusterChat && cd ClusterChat
npm install
pip install -r tools/requirements.txt

# Convert a small model and point the cluster at it.
python tools/convert_hf.py --model HuggingFaceTB/SmolLM2-135M
echo '{ "url": "/weights/smollm2-135m" }' > checkpoint.json

# Serve the repo and the signaling server on http://localhost:8001.
export CHAT_PASS_HASH="$(caddy hash-password --plaintext <password>)"
PORT=8081 node signal-server.js &
caddy run --config Caddyfile.dev

Open http://localhost:8001/chat?direct=1 in two or more tabs. Each asks whether to lend its GPU, then joins the cluster. One machine can hold the whole cluster, since every tab gets a share of the same GPU. To host it on a LAN or a domain, see docs/deploying.md.

Tests

npm test            # Node suites, no GPU
npm run test:gpu    # real peers in headless Chrome, needs a GPU

Documentation

docs/deploying.md Converting checkpoints, running on a LAN or a domain, TURN, hosting the weights, configuration, troubleshooting
docs/architecture.md Positions, placement and growth, links, routing, the wire format, sessions, the KV cache, speculative decoding, failure recovery, known gaps
docs/model.md The forward pass and what each kernel computes
docs/development.md Page parameters, dev pages, tests, repo layout
cli/README.md The clusterchat client: lending a GPU from a terminal, the dashboard, options, each agent's setup, self-hosting, adding a protocol or tool

Research it builds on

License

GNU Affero General Public License v3.0. See LICENSE. Under NOTICE, any deployment must keep a visible credit to ClusterChat in its interface.

The demo's privacy notice, terms and code of conduct (site/privacy.html, site/terms.html) are written for that deploy and its operator. Replace them if you run your own.

About

A chatbot, with a large language model split across its users, entirely in the browser.

Topics

Resources

Stars

57 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages