Host a node
Run a small open-source agent next to Ollama or another local model server, and sell inference from your Mac or GPU when you are not using it. Read what it does first; every answer below links the source file it describes.
Setup in under 5 minutes
Four copy-paste steps. Every command is plain and works the same in bash, zsh, PowerShell and cmd.
Requirements
- OS
- macOS, Windows or Linux. The agent is plain Node.js (TypeScript run with tsx).
- Tools
- Node.js ≥ 22.13, npm, git.
- Model server
- Ollama (default), or any local OpenAI-compatible server:
mlx_lm.server, LM Studio, llama.cpp server, vLLM. - GPU
- Apple Silicon M1–M5 is the primary target. NVIDIA GPUs are detected via
nvidia-smi. Anything else your model server can run (AMD via Ollama's ROCm build, even CPU-only) works too, as long as it passes verification. - VRAM
- No hard minimum in the agent. The model must fit in VRAM (unified memory on a Mac). Rule of thumb: model file + 1–2 GB.
llama3.2:3bis a ~2 GB download, so 8 GB Macs and 4 GB+ GPUs can serve it. - Verification
- On connect the network runs a short test on your smallest model: it must echo a random code and reach ≥ 3 tok/s, measured server-side. Only verified machines get paid traffic. Re-runs every 6 h and when your model list changes.
- Network
- Outbound internet only. No inbound ports, no router changes (see FAQ).
- 1Install Ollama and pull a model
ollama pull llama3.2:3b
Any chat model works. Using vLLM, MLX or LM Studio instead? Start its server and use
--backend vllm(port 8000) or--backend openai-compat --backend-url http://127.0.0.1:8080in steps 3 and 4. - 2Get the agent
git clone https://github.com/robralbovsky/P2PAI.git p2pai cd p2pai npm install
Optional:
npm run agent -- detectprints the exact hardware report the agent would send, without connecting. - 3Check your setup
npm run --silent agent -- doctor --backend ollama --orchestrator [https://api.vramgrid.com](https://api.vramgrid.com)
Read-only pre-flight check: is your model server up and which models it has, can this machine reach the network over WebSocket, and does your smallest model pass a few-second speed test (≥ 3 tok/s, the same bar as verification). Anything that fails prints how to fix it. It enrolls nothing and needs no join token; add
--jsonto share the report. - 4Connect
npm run agent -- --backend ollama --orchestrator [https://api.vramgrid.com](https://api.vramgrid.com) --join-token YOUR_JOIN_TOKEN
Create an account to get a join token. It enrolls the machine once; after that the agent reconnects with its own saved credentials.
Add
--require-idle 5to serve only after 5 minutes without keyboard/mouse input,--models a,bto limit which models you sell,--nameto replace the hostname shown to the network. Stop with Ctrl+C.
Security & isolation FAQ
Answers checked against the agent's source. Each one links the files it describes.
Do I need to open router ports or set up port forwarding?
No. The agent makes one outbound WebSocket connection to [https://api.vramgrid.com](https://api.vramgrid.com) and never listens on a port: it contains no HTTP or socket server. It pings every 20 s to keep NAT and tunnels open and reconnects with backoff if the connection drops.
Your model server stays on 127.0.0.1 (agent defaults: :11434 for Ollama, :8000 for vLLM, :8080 for other OpenAI-compatible servers). Keep it bound to localhost; the network never connects to it directly.
What can the network make my machine do?
Only what four message types allow: welcome, rejected, infer, cancel. Every frame is schema-validated and anything else is dropped. infer is a chat request (messages plus temperature, top_p, max_tokens, stop, seed, presence/frequency penalty) for a model your server already lists; the agent refuses any other model id. There is no message for running commands, reading files, downloading models or updating the agent.
How are inference jobs isolated?
Each job is a single HTTP request from the agent to your local model server, with its own cancel handle. Prompt text is passed to the model as input and is never executed. Jobs run one at a time unless you raise --max-concurrency. The agent keeps no conversation state between jobs and writes no prompts or outputs to disk; its log (terminal only) records request id, model, duration, character count and token usage.
What it does not do: sandbox anything. The agent runs as the user who starts it, and memory isolation between requests is whatever your model server provides. For OS-level separation, run it under a dedicated non-admin account. Ollama keeps the model loaded for 15 minutes after a job.
Source: host-agent/src/agent.ts, host-agent/src/backends/ollama.ts, host-agent/src/backends/openai-compat.ts
Do local files or telemetry leave my machine?
No files, no telemetry or analytics (the agent's only runtime dependencies are ws and zod). This is everything it sends:
- Name: your hostname, unless you pass
--name. - Hardware: OS, CPU architecture, CPU model and core count, total RAM; the Apple chip, GPU name and GPU core count on Macs; GPU names and VRAM on NVIDIA machines.
- Models: id, file size, quantization and MoE flag, as your server lists them.
- Availability: available or not (with the reason), active job count, seconds since last input (only with
--require-idle), battery state (macOS). - Job results: generated text, token counts, and error messages, which can include up to 500 characters of your model server's error response.
The only files it reads are ~/.p2pai/identity.json (its node id and secret, owner-only permissions on macOS/Linux) and the cloned repo's .env if you create one. Run npm run agent -- detect to see the hardware report first.
Source: shared/src/protocol.ts, host-agent/src/hardware.ts, host-agent/src/identity.ts, host-agent/package.json
Will it get in the way while I use the machine?
By default it serves whenever it is connected. With --require-idle 5 it takes jobs only after 5 minutes without keyboard or mouse input (macOS and Windows; on Linux this needs xprintidle under X11, otherwise only the load check applies) and pauses while the 1-minute load average is above 85% of your cores (not measured on Windows). MacBooks pause on battery unless you pass --allow-battery. Verification runs use your smallest model and at most 128 tokens.
Source: host-agent/src/idle.ts, orchestrator/src/nodes/verifier.ts
Something isn't working. How do I troubleshoot?
Run npm run --silent agent -- doctor with the same options you connect with. It checks Node.js, your model server and its models, the WebSocket connection to [https://api.vramgrid.com](https://api.vramgrid.com), enrollment, idle/battery state, and runs one tiny request (at most 32 tokens) on your smallest model to measure tok/s. Every failed check prints concrete fixes; the exit code is 0 when the machine is ready.
It is read-only. The orchestrator only sees a WebSocket handshake and a ping, then a normal close: no hello, no hardware report, no enrollment. Nothing is written to disk. If your model server does not answer, it also looks for Ollama, vLLM, LM Studio or mlx_lm.server on their usual ports on 127.0.0.1 and tells you which flags would use them.
How do I stop or remove it?
Ctrl+C stops new jobs, lets running ones finish (up to 30 s) and disconnects. Nothing is installed system-wide: no service, no auto-start. To remove it, delete the cloned folder and ~/.p2pai. Revoking a join token blocks new enrollments only; an enrolled machine keeps reconnecting with its saved secret until you stop the agent or delete ~/.p2pai/identity.json.
Founding Host Beta
Where things stand
The network is early and buyer demand is still ramping up, so a new machine can sit idle for stretches. You earn only when paid buyer traffic is routed to you; verification runs and buyers' free starter credit pay nothing.
Standard split: 80% of what buyers pay goes to the host, 20% to the platform. Cash payouts (Stripe Connect, $25.00 minimum) are not live yet; today you can convert earnings to API credit with a 25% bonus, available to every host.
First 15 hosts
0% platform fee for the whole beta. You keep 100% of what buyers pay for your tokens instead of 80%.
A slot goes to each of the first 15 accounts with a verified machine, in the order their first machine passed the speed test; a machine quarantined for faking its hardware does not count. The ledger pays the standard 80% automatically; the other 20% is settled by hand for founding hosts until it is automated.