Using Gambi with AI tools
Every Gambi room is an OpenAI-compatible API. Any tool or library that lets you set a custom OpenAI base URL can send requests to the model participants in a room. Harness participants (Claude Code, Codex, OpenCode) do not serve these requests; applications reach them through the harness attach channel.
Connection details
Section titled “Connection details”Every Gambi room exposes an OpenAI-compatible base URL:
| Setting | Value |
|---|---|
| Base URL | http://<hub-ip>:<port>/rooms/<ROOM_CODE>/v1 |
| API key | any non-empty string (the hub ignores it) |
| Model | *, model:<name>, or <participant-id> |
Supported protocols:
- Responses API: default and preferred
- Chat Completions: compatibility path
Prerequisites
Section titled “Prerequisites”# 1. Start the hubgambi hub serve --port 3000
# 2. Create a roomgambi room create --name "My Room"
# 3. Join as a participantgambi participant join --room ABC123 --participant-id bot-1 --model llama3Editors and chat apps
Section titled “Editors and chat apps”Any tool that supports a custom OpenAI-compatible endpoint can point at Gambi:
- Base URL:
http://<hub-ip>:3000/rooms/<CODE>/v1 - API key:
gambi - Model:
*ormodel:<name>
This works for tools that send requests from your machine or your network, such as Cline or a self-hosted Open WebUI. Hosted products that call the model from their own servers cannot reach a hub on a private network, and the hub must not be exposed to the internet without your own authentication layer in front of it.
Python example
Section titled “Python example”from openai import OpenAI
client = OpenAI( base_url="http://192.168.1.100:3000/rooms/ABC123/v1", api_key="not-needed",)
response = client.responses.create( model="*", input="Hello!",)
print(response.output_text)TypeScript example
Section titled “TypeScript example”import { createGambi } from "gambi-sdk";import { generateText } from "ai";
const gambi = createGambi({ roomCode: "ABC123", hubUrl: "http://192.168.1.100:3000",});
const result = await generateText({ model: gambi.any(), prompt: "Explain recursion briefly",});
console.log(result.text);Use defaultProtocol: "chatCompletions" only if your tools or participants explicitly require it.
OpenAI SDK example
Section titled “OpenAI SDK example”import OpenAI from "openai";
const client = new OpenAI({ baseURL: "http://192.168.1.100:3000/rooms/ABC123/v1", apiKey: "not-needed",});
const response = await client.responses.create({ model: "*", input: "Hello!",});
console.log(response.output_text);curl example
Section titled “curl example”curl -X POST http://localhost:3000/rooms/ABC123/v1/responses \ -H "Content-Type: application/json" \ -d '{ "model": "*", "input": "Hello!" }'Compatibility example with Chat Completions:
curl -X POST http://localhost:3000/rooms/ABC123/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "*", "messages": [{"role": "user", "content": "Hello!"}] }'Programmatic management
Section titled “Programmatic management”import { createClient } from "gambi-sdk";
const client = createClient({ hubUrl: "http://localhost:3000" });
const created = await client.rooms.create({ name: "My Room" });console.log(created.room.code);
const participants = await client.participants.list(created.room.code);console.log(participants.map((p) => `${p.id} ${p.status}`));Harness participants are managed separately from OpenAI-compatible inference. Attach to one when an app needs its ACP stream or artifacts:
for await (const event of client.harness.attach(created.room.code, "harness-1")) { console.log(event.type);}They stay out of *, model:<name>, and participant-id inference routing.
See the SDK reference and the API reference for the full contracts.