---
title: Quick start
description: Run a hub, create a room, share a model, and call it from code, in
  four commands.
editUrl: true
head: []
template: doc
sidebar:
  hidden: false
  attrs: {}
pagefind: true
draft: false
---

import AgentPrompt from '../../../components/AgentPrompt.astro';

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.

## What you'll need

- **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](/start/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](/guides/bring-your-harness/).

Prefer to have your coding agent do it? Copy the prompt in [Set it up with your agent](#set-it-up-with-your-agent) at the end of this page.

## Steps

`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.

### 1. Start the hub

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

```bash
# 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.

:::caution[Trusted networks only]
The hub has no built-in authentication. Anyone who can reach its port can create rooms and send inference requests to any room. A room password only protects joining. Run it only on a network you trust. If you need to expose it beyond that, put it behind your own proxy and authentication layer.
:::

### 2. Create a room

```bash
# 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:

```text
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:

```bash
gambi room create --name "Private Room" --password secret123
```

### 3. Join with your model

Each person with a model endpoint joins the room:

```bash
gambi participant join \
  --room ABC123 \
  --participant-id joao-1 \
  --model llama3:latest
```

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

```bash
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`:

```bash
# 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](/concepts/tunnel-first/).

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.

### 4. Use the SDK

Anyone can now use the shared models from their code:

```typescript
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:

```typescript
// 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:

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

### 5. Call the API directly

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

```bash
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](/reference/api/) for every route.

## Set it up with your agent

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

<AgentPrompt />

## Next steps

- Share Claude Code, Codex, or OpenCode: [Bring your harness](/guides/bring-your-harness/)
- Learn the [CLI commands](/reference/cli/)
- Explore [SDK usage](/reference/sdk/)
- Read the full [API reference](/reference/api/)
- Using cloud models? See [Remote providers](/guides/remote-providers/)
- Building with several models? See [Multi-LLM patterns](/guides/patterns/)