Skip to content
Proyek

Tentang

BitTorrent for local LLMs. Share your local model, use everyone's.

Produktivitas dan otomatisasi

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

BitLLM_

test release MIT

English | 中文

Using an AI agent? Point it at https://bitllm.org/llms.txt. Changing the code? See AGENTS.md.

BitTorrent for local LLMs. Share your local model, use everyone's.

Every node runs the same binary. It can share an OpenAI-compatible server you already run (vLLM, SGLang, llama.cpp, Ollama, LM Studio, MLX...), and it gives you a local gateway that answers from whichever peer serves the model you ask for. There is no coordinator: peers find each other through a Kademlia DHT and gossip, connect directly when they can, and go through a relay plus hole punching when both sides are behind NAT.

Beta, MIT licensed. The network is live at bitllm.org. Invites set your priority, not whether you can join: the access rules decide who gets a slot first, and uninvited nodes can still get idle slots. Using it needs no account and no wallet.

The dashboard a running node serves: a terminal-style editor with a model list, a copyable setup snippet, and a test console

How the network fits together

Four jobs, one binary:

   your node                 public relay / seed           GPU host
  127.0.0.1:7778            DHT, relay, receipts          vLLM / Ollama
        │                          ▲                          ▲
        │  first contact           │                          │
        └──────────────────────────┘                          │
        │                                                     │
        └──────── direct, or relay + hole punch ──────────────┘
  • Your node runs the same binary as everyone else. Its gateway listens on 127.0.0.1:7778 and speaks OpenAI and Anthropic, so an agent points at it like any API. By default nothing on the internet can call the gateway.
  • A serving node is your node plus --upstream, pointed at a model server you already run. It can be behind NAT: peers reach it through a relay and hole punching, so no port forwarding is needed.
  • A public relay is a node with inbound TCP and UDP 4001: start it with --public. It answers DHT queries and relays for NATed peers, but still joins the default seeds, so it needs no DNS record. Its announce carries relay=true; autorelay adds it as a candidate, so a NATed node reserves on the seed and on public relays instead of only on the seed. Before v0.5.0 it must serve a model, because only a serving node announces. From v0.5.0 it needs no model, once the seeds run v0.5.0 and can pass its announce on.
  • A seed is a public relay that is also listed in _dnsaddr.bootstrap.bitllm.org and starts alone (--dht-server). It is the first contact for a fresh install. One seed is enough to join; public relays are what make relay capacity grow with the network.

Discovery has two steps. The binary resolves _dnsaddr.bootstrap.bitllm.org to get seed addresses, then the DHT and gossip carry everything else: which peer serves which model, how to reach it, and which public nodes can relay. If the name does not resolve, it tries the boot.bitllm.org fallback; if that fails too, the node starts alone and prints a join code that another machine can pass to --bootstrap.

Only these pieces are centrally hosted, and none of them carries inference traffic:

piece where what it does if it is down
DNS seed list Cloudflare DNS, _dnsaddr.bootstrap.bitllm.org names the seeds for first contact a node with a join code still joins; boot covers a missing record, not a dead zone
site and installers Cloudflare Worker, bitllm.org the page, install.sh, llms.txt installed nodes keep running; install by hand from GitHub
release binaries GitHub downloads, checksums, self-update no new installs or updates

Everything else is peer to peer: no coordinator, no database, no KV store. Cloudflare serves DNS and the static site, not inference; the one exception is traffic relayed through the temporary boot tunnel. DNS is used only to find the first peer; an inference request goes from your gateway to the serving peer, directly or through a relay. Public relays are not centrally hosted: any operator with a public address can run one. The Mac mini that runs boot.bitllm.org today is a transition fallback, not part of the design.

What each piece depends on

piece needs does not need
node and gateway outbound internet; a seed or a join code to meet others inbound ports, an account, a wallet
serving node a local OpenAI-compatible server (vLLM, SGLang, llama.cpp, Ollama, LM Studio, MLX) a public IP, a port forward, a seed role
public relay a public address; inbound TCP and UDP 4001 a DNS record, a GPU, a model
seed a public relay listed in DNS; always on a GPU, a model, a database
DNS seed list a DNS zone for bitllm.org (Cloudflare here) and TXT records a Worker or any runtime
site and installers a Cloudflare Worker with static assets KV, a database, the Mac mini
self-update GitHub releases and SHA256SUMS a package manager

The seed is deliberately small and separate from the GPUs: a GPU that trains, renders or switches off must not take first contact with it. A GPU host with inbound can still be a public relay (PUBLIC=1), which adds relay capacity without adding a DNS record. One seed is enough for a new node to join; a second public relay, in DNS or not, keeps the network reachable when the seed is busy. docs/bootstrap.md explains the model and docs/seed-handoff.md is the deployment checklist.

Contents: How it works · Install · Share a model · Use the network · Manage your node · Credits · Access · Seed · Caveats · Build · Contributing

Install and run

No port forwarding, no configuration. The script picks the build for your machine, verifies its checksum and installs to ~/.local/bin (no sudo). The node joins through the DNS seed list in docs/bootstrap.md, or through boot.bitllm.org while that fallback lasts. If neither answers, it starts its own network and prints a join code: bitllm --bootstrap /ip4/.../p2p/....

# macOS (Apple silicon), Linux (x86-64, arm64)
curl -fsSL https://bitllm.org/install.sh | sh
~/.local/bin/bitllm
# Windows (PowerShell): installs to %LOCALAPPDATA%\bitllm
irm https://bitllm.org/install.ps1 | iex
& "$env:LOCALAPPDATA\bitllm\bitllm.exe"

The examples below use bitllm; if ~/.local/bin is not on your PATH, use the full path (the installer tells you which; on Windows, %LOCALAPPDATA%\bitllm). Prefer to download by hand? Take the file for your system from Releases; on macOS use curl, not a browser, to avoid the quarantine flag.

The node runs in the foreground. Then open http://127.0.0.1:7778, pick a model, copy the setup for your agent, and send a test message. To leave it running after you close the terminal, see keep it running. 完整的中文说明见 README.zh.md。

While it runs, bitllm top in another terminal shows peers, work exchanged and the log; see Watch and manage your node.

Share a model

You need an OpenAI-compatible server on this machine. Point the node at it:

bitllm --upstream http://localhost:8000/v1 --concurrency 2
  • Without --model, every model your server lists is shared under exactly the id it reports. A Hugging Face id such as nvidia/GLM-5.3-Flash-NVFP4 keeps its slash and its case. The node re-reads the list while it runs, so a model added to vLLM later appears without restarting BitLLM.
  • --model local=public: use this only when your server's local name is not the name the network should use. The name on the left is what your server calls the model; the name on the right is the network name.
  • --concurrency: how many requests you serve at once. Extra requests wait in this node's queue, in order of access class, which improves one step every 20 seconds as a request waits, but never past the best class; after that, arrival decides, so the longest wait goes first among equals. A full queue answers at once, so nobody waits on a place that does not exist.
  • --max-tokens (default 32768): the most new tokens one peer request may ask for. Peers also get one choice per request (n is dropped).
  • Requests from peers are narrowed: your node forwards known fields only, data: images only, and one prompt per /completions request. --peer-field NAME adds a field. Your own requests to your own server are not narrowed.
  • Images: if your server caps images per prompt (vLLM's --limit-mm-per-prompt), the node learns the cap from the server's first refusal and from then on sends only the newest images, with a short note in place of each older one. Agents send every screenshot of a session again on each turn, so this keeps long sessions working. Nothing to set; restart the node after you change the cap.
  • --location LAT,LON (optional): declare a coarse location for the network map. Give any point in your city, e.g. --location 52.52,13.40; the node announces only a cell of about 150 km, never the point. The map at bitllm.org shows only nodes that opted in. Without it your node is counted as "no location". Details: docs/network-map.md.

More flags

bitllm --help lists every flag. These are less common:

  • --upstream-key KEY: API key for your model server. Also BITLLM_UPSTREAM_KEY, which keeps it out of the process list.
  • --upstream-timeout DURATION: how long the node waits on your model server for one request. Default 10 minutes.
  • --peer-field NAME: forward one more request field from peers. Repeatable.
  • --peer-fallback: when your own server is down, answer a model you share from peers. Those peers can read the prompts.
  • --open-slots N: with --open, the most slots uninvited nodes may hold at once. Default half of --concurrency, at least 1.
  • --open-daily N: with --open, the credits all uninvited nodes together may use per UTC day, then they wait for idle slots. Default 0, no limit.
  • --deny PEER_ID: refuse one node outright, before any slot or quota. Repeatable. It takes the node id, not the pseudonym in a receipt. See docs/abuse.md.
  • --attribution-log: record which node is behind each receipt you countersign, in attribution.jsonl in the data directory: node id, address, receipt pseudonym and token counts, never the prompt. Off by default.
  • --audit-every N: with --audit, real requests to a peer between its spot checks. Default 50.
  • --audit-serve: offer to score answers for other nodes' --audit, if your server returns prompt logprobs (vLLM).
  • --gateway ADDR: the gateway's address. Default 127.0.0.1:7778.
  • --gateway-key KEY: key clients must send as their API key. Also BITLLM_GATEWAY_KEY. Needed when the gateway is on a non-loopback address; without it the node warns and the gateway is open.
  • --mdns: find peers on the local network. On by default; --mdns=false turns it off.
  • --roots ADDR: root account of the invite tree. Repeatable. Default the BitLLM root. For private networks and tests.
  • bitllm invite --revoke 0xADDRESS: revoke an account. Roots only.

Model names

A network name is just the model string clients send. Two machines that announce the same string are interchangeable for it: the gateway picks one, and if it stops answering it tries another. The name must identify the weights, not the machine.

  1. A public model uses its exact Hugging Face repo id. nvidia/GLM-5.3-Flash-NVFP4, with the slash and the case as published. Independent hosts that serve the same repo match without a central registry, and one can replace another when it goes down.
  2. A fine-tune or quant uses the repo id of the actual weights, if it has one; otherwise the base model plus a suffix that says what changed. For example the Mac Studio node shares Hygaard/Inkling-2-Small-oQe-3.07bpw-MLX; a fine-tune with no repo of its own appends the suffix to the base id, such as nvidia/GLM-5.3-Flash-NVFP4-heretic.
  3. A private or brand-new model can use any stable name. Nothing has to be registered first: the node announces it, GET /v1/models lists it, and the dashboard lets a user pick it. Use --model only when the name the server reports locally is not the name clients should send.

The table below lists the short names the beta has used for its reference models. They are not a gate; any id is accepted.

network name weights
deepseek-v4.1-flash-1017 DeepSeek V4.1 Flash, 1017 release, official weights
deepseek-v4.1-flash-1017-heretic same, heretic (uncensored) fine-tune
Hygaard/Inkling-2-Small-oQe-3.07bpw-MLX Inkling 2 Small (Thinking Machines Lab), Hygaard's oQe 3.07-bit MLX quant on Apple silicon; reasoning model, accepts images, 128K context

Same name must mean same weights. A Hub id is the simplest way to make that true across operators.

How names are built: <model>[-<quant>][-<source>], joined with hyphens; the model part keeps the case and slashes of its Hugging Face repo id.

part what it says when to leave it out examples
model the base model and release, as its maker names it never nvidia/GLM-5.3-Flash-NVFP4, deepseek-v4.1-flash-1017
quant the weight format, if not the maker's own release official weights as released fp4, nvfp4, int4, q4_k_m
source who changed the weights: fine-tune name, or the group that made the quant official weights as released heretic, Piecrust-Abliterated

How a server runs the model (vLLM or SGLang, context length, fixed sampling) does not change the name; note it in the table instead. To add a reference name, open an issue with: the base model, where the weights come from (link), the quant format and who made it, and anything a client should know (fixed sampling, context length, image support). Your server's address is never needed: nodes find each other on the network.

Use the network

Every node, sharing or not, has a gateway at http://127.0.0.1:7778/v1:

bitllm                                 # use only, share nothing
curl localhost:7778/v1/models
curl localhost:7778/v1/chat/completions \
  -d '{"model":"deepseek-v4.1-flash-1017-heretic","stream":true,"messages":[{"role":"user","content":"hi"}]}'
curl localhost:7778/v1/chat/completions \
  -d '{"model":"tee/phala/deepseek-v4.1-flash-1017-uncensored","stream":true,"messages":[{"role":"user","content":"hi"}]}'
curl localhost:7778/status             # your peer id, connections, ledger
curl localhost:7778/queue              # slots, running jobs and the wait list

No account is needed to use the network. /v1/models lists what is online right now, with the number of nodes serving each one. Slot totals on the network map count a node once per model it serves, so adding up the models overstates capacity.

Open http://127.0.0.1:7778 for a dashboard with copy-paste setup for your agent and a connection test. The gateway speaks both OpenAI (/v1/chat/completions, /v1/completions) and Anthropic (/v1/messages), so Claude Code works as is:

M=deepseek-v4.1-flash-1017-heretic   # any name from /v1/models, a tee/ one included
ANTHROPIC_BASE_URL=http://127.0.0.1:7778 ANTHROPIC_API_KEY=bitllm ANTHROPIC_MODEL=$M \
ANTHROPIC_DEFAULT_OPUS_MODEL=$M ANTHROPIC_DEFAULT_SONNET_MODEL=$M ANTHROPIC_DEFAULT_HAIKU_MODEL=$M \
CLAUDE_CODE_SUBAGENT_MODEL=$M claude

OpenAI clients (Cline, Continue, OpenCode, Aider...): base URL http://127.0.0.1:7778/v1, any API key. Anthropic requests need the serving peer's upstream to support /v1/messages (vLLM does). The response header X-Bitllm-Peer says which peer answered.

A model whose name starts with tee/ runs inside a TEE ("privacy": "tee-e2ee" in /v1/models). Its servers say so in what they announce, and nobody has to take their word for it: before anything is sent, your gateway asks the server for the TEE's attestation, checks it itself, and seals the request to the key the TEE proved. The server that relays the request cannot read your messages, the system prompt, tool results or the answer, and X-BitLLM-TEE on the answer says what was verified. Asking for the tee/ name is how you require this: such a request goes to no server whose TEE did not verify, and never in the clear. The same model under its plain name, if anyone serves it that way, is a separate entry in the list, served by other machines.

Both APIs work with sealed models: an Anthropic request is turned into a chat request on your machine before it is sealed, so Claude Code needs only the tee/ name as its model.

How much is protected depends on the encryption the TEE takes, and X-BitLLM-TEE names it. Your gateway reads that from the key list the TEE attested, which nobody on the way can change. When the TEE takes the newer version, your gateway uses no other, and it never sends a request in a weaker form after an error.

With e2ee=v2.1, your messages, the system prompt, tool results, the arguments of every tool call, the model's reasoning and its answer are all sealed. The request also carries a sealed digest of its whole body, and every answer carries a keyed checksum that only the TEE that opened your request can make. So the relaying server can neither read these nor change a request, or an answer that is not streamed: it cannot add or drop a message, raise max_tokens, take out a tool, rename a tool call or replace an answer, and it can no longer read an answer by putting its own key in place of yours. Three things are not covered, and the protocol says so itself:

  • Tool definitions and the names of tool calls stay readable. So do a response_format schema, stop sequences, and everything else that is not message text: roles, the model name, sampling settings, token counts and the length of each sealed field. The relaying server can read them and cannot change them. X-BitLLM-TEE names the larger ones after readable=, for example readable=tool-definitions,tool-names; the name a message carries and tool_choice are readable too. Keep private text out of tool descriptions.
  • Errors are not authenticated. The relaying server can make up a refusal, so an error tells you nothing certain about the TEE.
  • A streamed answer comes in events, and nothing numbers them. Every event that reaches you is the TEE's own, unchanged, and belongs to this answer, but the relaying server can still drop one from the middle, repeat one or put them in another order. For text that loses or doubles some words. For a streamed tool call it can change the arguments, by leaving a piece of them out. The header says stream=unsequenced on every streamed answer. Your gateway does refuse a stream that ends without the TEE's own event that says the answer is finished. That stops a stream that is simply cut off, but not one where earlier events are dropped and the last ones kept. Noticing a missing piece takes the TEE's signed receipt, which BitLLM does not check yet. An answer that is not streamed has no such gap: when an agent's tool calls must reach you exactly as the model wrote them, ask with "stream": false.

A sealed v2.1 request cannot be changed on the way, so your own gateway now does what the serving node used to do to it: it leaves out request fields that servers do not pass on, asks for one answer, and keeps max_tokens within the limit the server names. It also leaves out what the protocol would not seal and the model does not need: the user id, and members of a message other than its role, content, name, reasoning, tool calls and tool call id. A server that relays for such a TEE has to run a BitLLM that knows v2.1. If it does not, that server refuses the sealed request, and your gateway says that the server must update and does not send the request again in any weaker form.

With e2ee=v2, which is what an older TEE takes, less is covered. Tool definitions, and the name and arguments of every tool call, are not sealed. The relaying server can read them, and could change them: for a coding agent that includes the shell commands it runs and the text it writes to files. When a request carries tools, X-BitLLM-TEE ends with tools=unsealed to say so; when it carries none, an answer that comes back with a tool call is refused. An answer is also private without being proven: the relaying server cannot read it, but it could replace it with text of its own, sealed to your key, without knowing what you asked. If a changed answer would cost you more than a wrong answer from any model does, use a model whose header says e2ee=v2.1, or count the relaying server among the parties you trust.

To serve a model from a TEE gateway you run, start your node with --e2ee-only. It announces its models as sealed, relays the gateway's attestation, and refuses any request that is not sealed.

Which TEEs a node seals to is its own decision. Every release trusts the builds listed in internal/aci/policy.go, and you can add others with --tee-policy FILE, so a TEE needs nobody's release to be usable by the people who trust it:

{"accept": [{"name": "our lab's gateway", "mrtd": "…", "rtmr1": "…", "rtmr2": "…", "compose_hash": "…"}]}

The four values are the TEE's measurements in hex. When a node meets a build it does not accept, the refusal and the log line end with that build's entry, ready to paste. Your prompts are sealed to whatever you list, so add a build only after reading the compose file its hash stands for.

A model you share stays on your machine: your gateway answers it from your own server, for free. If your server is down, the gateway answers 503. --peer-fallback opts in to using peers instead, and those peers can read the prompts.

Hosts narrow what they take from peers: known fields only, data: images only, one prompt per /completions request. If a client sends an unusual field, the host may need --peer-field for it.

Watch and manage your node

bitllm top is a live view of a running node in your terminal: who you are connected to, what you share, the work exchanged with each peer, and the tail of the log, redrawn every second.

bitllm top                     # watch 127.0.0.1:7778
bitllm top --interval 2s       # a slower refresh
bitllm top --gateway 127.0.0.1:9000
q                               # quit; the node keeps running

It only reads the local gateway over HTTP, so it watches a node started any way you like: from another terminal, from tmux, or as a service, and it never touches the node's state. If the node stops it shows why and keeps retrying, so you can leave it open while you restart. In a pipe (bitllm top | cat) it prints one frame and exits, which is handy over ssh or in a log.

The same data is available without a terminal:

curl localhost:7778/status        # peer id, addresses, connections, serving, uptime, ledger
curl localhost:7778/logs?n=50     # the last 50 log lines the node kept in memory
curl localhost:7778/credits       # credits per serving peer

The node keeps its last 500 log lines in a ring buffer for /logs, and still writes every line to stderr, so nothing changes for a log file, journalctl, or a tee in your terminal.

Keep it running

In tmux, if you want a terminal you can detach from and come back to:

tmux new -s bitllm 'bitllm 2>&1 | tee -a ~/.local/state/bitllm.log'
# ctrl-b d detaches and leaves it running; `tmux attach -t bitllm` comes back

On Linux, as a user service that starts at login and restarts if it stops:

# ~/.config/systemd/user/bitllm.service
[Unit]
Description=BitLLM node
After=network-online.target
[Service]
ExecStart=%h/.local/bin/bitllm
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
systemctl --user daemon-reload && systemctl --user enable --now bitllm
loginctl enable-linger "$USER"      # keep it running after logout
journalctl --user -u bitllm -f      # the log

Add the sharing flags to ExecStart if the node also serves a model. On macOS, a LaunchAgent in ~/Library/LaunchAgents with KeepAlive does the same job.

Updates

A release build checks for a newer release 30 seconds after it starts, and every 6 hours after that. When there is one, it downloads the binary for this machine, checks it against the release's SHA256SUMS, runs it once to confirm the version it reports, and swaps it in. If the node is serving, it waits until no job is running and the queue is empty, then restarts itself in place: same terminal, same systemd unit, same peer id. It waits up to 24 hours, then restarts anyway, so one stuck client cannot hold an update back forever. GET /status shows pending_restart: true in the meantime. On Windows a running .exe cannot be replaced, so the new binary is installed and used at the next start.

HTTPS and the checksum catch a corrupted or truncated download. Each release also publishes SHA256SUMS.sig, a signature over the tag and the checksum file, made with an admin's offline key and checked against the public keys built into the binary. A release with a missing or wrong signature is refused: nothing is downloaded and the running binary stays as it is. bitllm update prints the result, and GET /status shows it as signature: ok, missing, bad or no-keys.

--auto-update=false stays on the version you have. bitllm update runs the same check now, which is also the way to update a node under a supervisor. --check only reports, and exits non-zero if the signature is not ok. bitllm update --tag vX.Y.Z installs that one release through the same checks, which is how to try a prerelease, since the regular check skips those. It can also go back to an older release, but a running node with auto-update moves forward again unless it is started with --auto-update=false. The replaced binary stays next to it as bitllm.prev, so mv bitllm.prev bitllm goes back one version. Builds from source (dev) and CI builds never update themselves, and bitllm update on one of them still requires a signature. bitllm --version prints what is running, and GET /status shows the last check. The updater writes in the directory that holds the binary, so a package-manager install or a read-only mount needs --auto-update=false; otherwise the node logs the error and keeps running.

A release the node installed by itself has to prove itself: until it has run for 60 seconds with its gateway up, each start counts. After three failed starts, the next start puts bitllm.prev back and restarts into it. That release is not installed again, while a newer one installs as usual. GET /status shows rolled_back_from after such a start, and the failed binary stays as bitllm.failed. This needs something to start the node again, such as the systemd unit above; in a plain terminal the count only moves when you run it again. A node started with --auto-update=false never swaps its binary by itself.

Where things live

Everything the node stores is in ~/.bitllm (--data moves it): the node key, the seed it signs receipts with, the receipt log, the ledger, and the membership and quota state. Delete the directory to start over with a new identity.

Credits for serving

Every job you serve earns credits (prompt tokens / 4 + completion tokens), recorded in a receipt: the client signs what it received (model, token counts, SHA-256 of the exact response bytes), your node checks it against what it sent and countersigns, and the receipt is gossiped to the whole network.

Receipts are self-reported. Both sides sign, but two keys can belong to one person, so a receipt does not prove the work happened.

The client signs with one key per server, rotated every 30 days. That server can link your jobs to each other, but other nodes cannot link you across servers. A receipt shows which server did the work, not who asked for it.

Credits must equal the token formula, and each node accepts at most 120 receipts a minute per server (600 overall) from gossip. Any node can verify both signatures and add up the credits from the receipts it has heard, so totals can differ between nodes:

curl localhost:7778/credits      # credits per serving peer, from every receipt this node has seen

Receipts are stored in ~/.bitllm/receipts.jsonl; a new node catches up from its bootstrap peers. What credits will be worth is not decided yet. Which receipts count will be published before it is: serving yourself through fake clients or serving a model other than the one named will not count.

How access works

Invites set priority, not entry. Three rules:

  1. An invite gets you served on any free slot. Uninvited nodes are served only when a server is idle, unless its owner opens it to everyone.
  2. There is no daily quota by default. A server owner can set one.
  3. Sharing makes you a contributor: 10 invites instead of 3 once your nodes have served, and no quota on a server that asked your node for a job in the last 7 days.

If you are not a member yet, you can still use the network: you are served whenever a server is idle, and a server started with --open serves you like a member. To become a member, ask a member to invite your Ethereum address, then link this node to that address in the dashboard ("Link wallet" or bitllm account link). Linking is public, see Accounts. You do not need a wallet to use the network, only an address if you want an invite or a quota.

A member is the root account or anyone a member invited. Once your nodes have served a job you have 10 invites for good. That limit reads public receipts, which are self-reported. Owners can set a daily quota per member (--free-daily). Quota exemption does not read public receipts. It comes from what a server has seen itself: your node did a job that server asked for within the last 7 days. A server that never asks peers for jobs exempts nobody.

A root can revoke an account (bitllm invite --revoke). That account and everyone it invited drop to the uninvited tier, so they can still get idle slots. Everyone it invited can be invited again by someone else.

Invites are signed with an Ethereum account and gossiped, so there is no membership server. Members converge as signed items spread, and nodes can disagree for a while. Servers look up the requesting node's account through its claim (below).

bitllm invite 0xADDRESS           # invite with a recovery-words account

With a browser wallet, use the Invite box in the dashboard instead.

Serving only people you choose (--allow)

To share only with a few people, list their node ids (each node prints its id at startup, and curl -s 127.0.0.1:7778/status shows it as id):

bitllm --upstream http://localhost:8000/v1 --model ... \
  --allow 12D3KooW...friend1 --allow 12D3KooW...friend2
  • Listed nodes are served on any free slot, like members, whether or not they were invited. --free-daily still applies to them.
  • Every other node is refused, members included, with 403 not allowed: this server serves only the peers its owner listed with --allow. Your node is 12D3KooW...; send that id to the owner to be added. Their gateway skips your server and tries others for the model at once; if yours is the only one, they get that message right away, not after a wait.
  • Your model still appears in everyone's /v1/models, because the list is not announced.
  • To refuse one node while everyone else is served as before, use --deny PEER_ID (repeatable). See docs/abuse.md.
  • Without --allow or --deny nothing changes: the three rules above apply.
  • The list is read at startup; restart the node to change it.

Accounts

Credits are earned by nodes. To add up the credits of all your machines, link each node to one Ethereum address. It is only a signature (personal_sign): no transaction, no gas, no RPC, nothing on chain. A claim is signed by both the owner's wallet and the node's key, so nobody can claim your node, and the newest claim per node wins.

Linking is public. It publishes this node's id with your wallet address and display name to every node on the network. Decide whether you want that before you run these steps:

bitllm account new --name alice     # new 12-word account, links this node
bitllm account link --name alice    # link another machine to the same account
bitllm account                      # show who owns this node

Or click "Link wallet" in the dashboard to sign with a browser wallet (MetaMask, Rabby...). Smart-contract wallets are not supported yet (their signatures need a chain to verify).

Separately, each node keeps a private ledger of work exchanged with each peer (~/.bitllm/ledger.json), kept as data.

Run a seed

A seed is the first peer a new node dials. It answers DHT queries, relays for NATed peers until they hole-punch a direct connection, and serves the receipt history a node syncs on join. It is a public relay that is also listed in _dnsaddr; it does not answer inference requests or decide membership.

Keep the first seed separate from the GPUs. A small always-on VPS, or any machine with a public address, is the usual choice, so a GPU that is training, rendering or switched off cannot take first contact with it. One seed is enough for a new node to join.

bitllm --dht-server --port 4001 \
  --announce /ip4/203.0.113.10/tcp/4001 \
  --announce /ip4/203.0.113.10/udp/4001/quic-v1

A public host that should help but does not need to be a first contact runs as a public relay:

bitllm --public --port 4001 \
  --upstream http://localhost:8000/v1 \
  --announce /ip4/203.0.113.11/tcp/4001 \
  --announce /ip4/203.0.113.11/udp/4001/quic-v1

It joins the default seeds, answers DHT queries and relays, and needs no _dnsaddr record. Its announce carries relay=true, so NATed nodes use it as an additional relay; this is how relay capacity grows without adding DNS entries. Before v0.5.0 it must serve a model, because only a serving node announces. From v0.5.0 it needs no model, once the seeds run v0.5.0 and can pass its announce on. deploy/gpu-host.sh with PUBLIC=1 installs a serving node this way.

Open TCP and UDP 4001. On a fresh Ubuntu VM, deploy/bootstrap-vps.sh installs the systemd unit and prints the DNS records to publish. A home host can be a public relay too, with a port forward or UPnP, but most home hosts are ordinary serving nodes: they join through a seed and peers reach them by relay or hole punching.

Both --dht-server and --public force public reachability, so turn them on only when inbound actually works. Otherwise the node advertises addresses nobody can dial. Only the first seed uses --dht-server, because it has to start without the DNS list it is about to be published in; every later public host uses --public, which joins the default seeds. A second seed needs a live one: bitllm --dht-server --bootstrap /dnsaddr/bootstrap.bitllm.org.

docs/host-a-gpu.md is the step-by-step for a machine that serves a model, including the check that decides whether it can also be a public relay. deploy/gpu-host.sh installs the service next to the model server.

The default list is a DNS seed list at _dnsaddr.bootstrap.bitllm.org. Publish it with deploy/seed-dns.py, and a new node joins through any of the records. Adding or retiring a seed is a DNS change, not a release. When neither that list nor the temporary boot.bitllm.org fallback answers, a default node starts its own network and prints a join code; nothing fails. The failure behavior is in docs/bootstrap.md.

No public IP? Put it behind an HTTPS tunnel that passes WebSockets (Cloudflare Tunnel, free): bitllm --dht-server --ws-port 4002 --announce /dns4/boot.example.org/tcp/443/wss and point the tunnel at http://127.0.0.1:4002. Others join with --bootstrap /dns4/boot.example.org/tcp/443/wss/p2p/<peer id>. This puts Cloudflare in the connection path, so use it as a fallback, not as the primary seed.

Announce a restart before you do it. Nodes redial a lost seed every 15 seconds, but a request already streaming through your relay is cut when it goes down, and the user's agent may not retry it.

What you should know

  • The peer that serves you sees your prompt, like any inference provider. Transport is encrypted (Noise/TLS/QUIC), but the serving machine reads the plaintext. Don't send secrets.
  • Peers you connect to directly see your IP address, and the peer serving you sees your node id. If that matters where you live, use the network through a VPN or Tor-capable VPS.
  • If you share a model, the clients you serve can see your IP too.
  • A host may keep a record of who it served. With --attribution-log a server writes the node id and address behind each receipt it countersigns, and the token counts, to a local file. It does not write the prompt or the answer, and a job whose client does not send a receipt back leaves no line. A host that investigates abuse may look at requests more closely, as any inference provider can.
  • Don't use the network to attack systems you have no permission to test, or to harm people. The models are open; the machines that run them belong to people who share them for free. A host decides whom it serves and can refuse any node (--deny). What a host does when it finds abuse is in docs/abuse.md.
  • A node could serve a different model than it claims. Start with --audit (off by default) to spot-check the peers that answer you: about one request in 50 to a peer is followed by a canary request, and another node (the auditor) scores the answer token by token; a peer that keeps failing gets no requests for that model for 24 h (GET /audits shows the results). The default auditor is a node run by us, the maintainers; --auditor PEER_ID replaces it and --auditor none drops it. An audit is a spot check, not a proof:
    • It finds a server running another model, and a coarser quant (Q4 or below) on greedy requests.
    • It does not find a server that recognizes canaries (the prompts are public in the source), a quant swap on sampled requests only, or a light fine-tune swap such as official weights for heretic.
    • An auditor can lie: pass a cheater, or make up bad scores for an honest server. A shuffled control catches only an auditor that passes everything. Trusting the seed means trusting us.
    • A server and an auditor run by the same person can pass each other. Nodes of the same claimed owner or /24 are never paired, but unclaimed nodes on different networks can be.
    • --weights NAME=HASH is what the server says it loads. The node only relays its server and cannot prove it. Numbers and details: docs/audit.md.
  • --upnp (on by default) asks your router to forward the p2p port.
  • IPv6 exposes the p2p port. With a public IPv6 address and a router that lets inbound IPv6 through, anyone on the internet can reach port 4001 (the p2p port, not the gateway on 7778, which listens only on 127.0.0.1 by default). That is how peers get direct connections, but if you do not want an open port on that machine, start with --ipv6=false to listen on IPv4 only. The cost: IPv6-only peers can no longer dial you directly, so more of your traffic goes through relays and may be slower. On IPv4 nothing changes.

Build and test

Go 1.26 or newer (mise.toml pins the toolchain). No C dependencies, one binary; packages follow the domain under cmd/ and internal/.

go build -o bitllm ./cmd/bitllm
go vet ./...
go test -race ./...              # real libp2p nodes on 127.0.0.1; 30 to 60 s

Release binaries for all four targets, with checksums, come from scripts/release.sh vX.Y.Z. The tests cover discovery, the relay-only path, the serving queue, receipts, the ledger and the access rules. See AGENTS.md for the layout and the rules that are easy to break.

Protocol: /bitllm/infer/1.1.0 (one JSON request line, zero or more 202 position lines while the request waits for a slot, then one 200 header and the upstream body verbatim) next to the older /bitllm/infer/1.0.0, which a client falls back to when a server does not know 1.1.0. Nodes find a model's servers through the DHT under a key derived from the model name, ask a provider for its current announce over /bitllm/hello/1.0.0, and keep gossip (bitllm/announce/1) as the fast path for free slots.

Contributing

Bug reports, fixes and small features are welcome. CONTRIBUTING.md says how issues and pull requests are handled; read AGENTS.md before changing code. After a change to networking, access or the gateway, run the external test workflow (.github/workflows/external-test.yml), which joins the live network and sends real requests.

Other docs: audit, host a GPU, seed handoff, network map, compatibility, 中文, and llms.txt (the same instructions for AI agents). Brand assets live in bitllm-org/branding.

License

MIT, see LICENSE. The dashboard bundles the JetBrains Mono and Arimo fonts under the SIL Open Font License 1.1; their notices and license are in internal/assets/fonts.css.

Jelajahi proyek terkait

Memuat…