Skip to content

Quick start

This tutorial runs Gambi from scratch. By the end, you’ll have a hub running, a room, and a model shared in it that you can call from code.

  • The Gambi CLI on each machine, on the same minor version as the hub (any 0.8.x works with any other 0.8.x). See Installation.
  • A machine to run the hub. Any computer on the network works. It doesn’t need a GPU, because the hub only routes traffic.
  • At least one model endpoint. Ollama, LM Studio, vLLM, or any OpenAI-compatible API.

To share Claude Code, Codex, or OpenCode instead of a model endpoint, follow this page up to creating a room, then see Bring your harness.

Prefer to have your coding agent do it? Copy the prompt in Set it up with your agent at the end of this page.

gambi room create and gambi participant join prompt for missing values when you run them in a terminal. Pass the values as flags for scripts, or add --no-interactive to turn prompts off.

Pick a machine on the network to be the hub. It doesn’t need a GPU, because the hub only routes requests between participants.

Terminal window
# Defaults: host 0.0.0.0, port 3000
gambi hub serve
# Or choose a port and enable mDNS:
gambi hub serve --port 3000 --mdns

The --mdns flag advertises the hub so other machines on the network can discover it.

Other machines reach the hub at http://<hub-ip>:3000, where <hub-ip> is this machine’s address on your network, such as 192.168.1.10. Every other command takes that URL as --hub, or from the GAMBI_HUB environment variable. Without either, the CLI uses http://localhost:3000, which only works on the hub machine itself.

Terminal window
# In a terminal, prompts for the room name:
gambi room create
# Or with flags:
gambi room create --name "My Room"

The CLI prints the room code and the host ID:

Created room ABC123 (My Room).
host_id: …

Share the room code with everyone who wants to join.

To protect the room with a password, pass it as a flag; the CLI never asks for one:

Terminal window
gambi room create --name "Private Room" --password secret123

Each person with a model endpoint joins the room:

Terminal window
gambi participant join \
--room ABC123 \
--participant-id joao-1 \
--model llama3:latest

On any machine other than the hub, add the hub URL:

Terminal window
gambi participant join \
--hub http://192.168.1.10:3000 \
--room ABC123 \
--participant-id joao-1 \
--model llama3:latest

--model must be the exact name your provider lists. Ollama names include a tag: run ollama list and use what it shows, such as llama3:latest.

The default endpoint is http://localhost:11434 (Ollama). For other providers, use --endpoint:

Terminal window
# LM Studio
gambi participant join \
--room ABC123 \
--participant-id joao-lmstudio \
--model mistral \
--endpoint http://localhost:1234
# vLLM
gambi participant join \
--room ABC123 \
--participant-id joao-vllm \
--model llama3 \
--endpoint http://localhost:8000

The CLI probes your local endpoint, checks that the model exists, detects which protocols it supports, registers the participant, and opens a tunnel to the hub. Press Ctrl+C to leave, or use gambi participant leave from another terminal. If the network drops for a moment, the participant reconnects by itself with the same participant ID.

If the hub runs another minor version of Gambi, the join fails with VersionMismatch and names the version to install.

Your provider endpoint can stay on localhost, even when the hub runs on another machine in the same trusted network. The hub never connects to it. For the reasoning, see How tunnels work.

The CLI also shares your machine specs (CPU, RAM, GPU). Use --no-specs to keep them private.

Once joined, your model is available to everyone in the room.

Anyone can now use the shared models from their code:

import { createGambi } from "gambi-sdk";
import { generateText } from "ai";
const gambi = createGambi({
roomCode: "ABC123",
hubUrl: "http://localhost:3000",
});
// Send to any available participant
const result = await generateText({
model: gambi.any(),
prompt: "Hello, Gambi!",
});
console.log(result.text);

If your code runs on another machine, set hubUrl to the hub’s network address, such as http://192.168.1.10:3000.

You can also target a model or a participant:

// Any participant serving this model
const explained = await generateText({
model: gambi.model("llama3:latest"),
prompt: "Explain quantum computing",
});
// The participant that joined as joao-1
const haiku = await generateText({
model: gambi.participant("joao-1"),
prompt: "Write a haiku",
});

To use Chat Completions instead of the default Responses API:

const gambi = createGambi({
roomCode: "ABC123",
hubUrl: "http://localhost:3000",
defaultProtocol: "chatCompletions",
});

You don’t need the SDK. The hub speaks the OpenAI API, so any language or HTTP client works:

Terminal window
curl -X POST http://localhost:3000/rooms/ABC123/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "*",
"input": "Hello!"
}'

Any tool that accepts a custom OpenAI base URL works, such as Open WebUI or Python’s openai library. Point it at:

http://<hub-ip>:<port>/rooms/<ROOM_CODE>/v1

The tool has to reach the hub over your network. Hosted tools that call the model from their own servers cannot reach a hub on a private network.

See the API reference for every route.

Your coding agent can run these same steps with you, asking before it installs or starts anything.

Ask your agent

Paste this into Claude Code, Codex, OpenCode, or Cursor. It reads these docs as Markdown and walks you through the setup, one step at a time.

Help me set up Gambi on this machine. Gambi is a hub that lets several people share their AI models and coding agents (Claude Code, Codex, OpenCode) on a trusted local network.

Read these pages first. They are plain Markdown:
- https://gambi.sh/start/introduction.md
- https://gambi.sh/start/installation.md
- https://gambi.sh/start/quickstart.md
- https://gambi.sh/guides/bring-your-harness.md (only if I share Claude Code, Codex, or OpenCode)

Then guide me one step at a time, and ask before you install anything or start a long-running process:

1. Run `gambi --version`. If the CLI is missing, install it with the method for this OS from the installation page.
2. Ask me whether this machine runs the hub or joins a hub that already exists.
   - Runs the hub: start `gambi hub serve` in its own terminal, then tell me the URL other machines should use (this machine's LAN IP and port 3000).
   - Joins: ask me for the hub URL and pass it as `--hub` from now on. This CLI must be on the same minor version as the hub (0.8.x with 0.8.x); if the join fails with `VersionMismatch`, install the version the error names.
3. If I don't have a room code yet, create a room with `gambi room create --name "<name>" --no-interactive` and show me the code.
4. Ask me what I want to share:
   - A model: look for an OpenAI-compatible server already running (Ollama on localhost:11434, LM Studio on localhost:1234, vLLM on localhost:8000), list its models, and join with `gambi participant join --room <code> --participant-id <id> --model <model> --endpoint <url>`.
   - A harness: check that Claude Code, Codex, or OpenCode is installed and logged in, as the bring-your-harness page describes, then join with `gambi participant join --room <code> --participant-id <id> --harness <claude-code|codex|opencode>`.
   `participant join` stays in the foreground, so run it in its own terminal.
5. Prove it works:
   - `curl http://<hub>/rooms/<code>/v1/models` lists the model participants of the room that are connected.
   - For a model, send `curl -X POST http://<hub>/rooms/<code>/v1/responses -H "Content-Type: application/json" -d '{"model":"*","input":"Say hello in one sentence."}'` and show me the answer.
   - For a harness, confirm that the join output says the harness started and the tunnel connected (the `harness_started` and `tunnel_connected` events with `--format ndjson`).

Rules:
- Never type, print, or store my API keys. If a provider needs one, ask me to set an environment variable myself (its value is `Bearer <key>`), then pass `--header-env Authorization=<VARIABLE_NAME>`.
- The hub has no authentication. Keep it on a network I trust and never expose it to the internet.
- If a step fails, read https://gambi.sh/troubleshooting/common-issues.md before trying something else.