> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Kai Code Bridge

> Run Kai Code sessions on your own computer or server with your own coding-agent subscriptions.

Kai Code Bridge is a small background service that connects a computer or server of yours to Gleap. When it is running, Kai Code sessions can execute there instead of in the Gleap cloud — using **your own AI subscriptions** (Claude Code, Codex or Cursor). Your agent logins never leave that device.

## Requirements

* Node 20 or newer and Git on the machine you want to connect.
* A terminal on that machine, or SSH access to it (a headless server works).
* A Gleap user with access to the project.

## Connect a machine

Run this in a terminal on the computer you want to connect:

```bash theme={null}
npm i -g @gleapai/kai-bridge && kai-bridge
```

The command installs the bridge, opens a pairing link in your browser, installs the background service and guides you through signing in to your coding agents. The machine shows up under **Kai Code → Settings → Kai Code Bridge** as soon as pairing completes, usually within a few seconds.

Re-run the guided setup at any time with:

```bash theme={null}
kai-bridge setup
```

<Tip>
  On macOS you can also install [Gleap Desktop](https://gleap.io/downloads). It pairs, installs and signs in without a terminal.
</Tip>

## Coding agents (harnesses)

Kai Code Bridge drives the coding agent that is installed on the machine. The guided setup installs and signs in Claude Code and Codex for you; Cursor is only available locally. To manage an agent by hand, run these on the machine running the bridge. Replace `claude` with `codex` or `cursor`.

Install an agent if it is missing:

```bash theme={null}
kai-bridge harness install claude
```

Sign in (your login stays on that device):

```bash theme={null}
kai-bridge harness login claude
```

Update to the latest version:

```bash theme={null}
kai-bridge harness update claude
```

<Note>
  On a server without a browser, Codex uses device-code sign-in automatically. You can force it with `kai-bridge harness login codex --device-auth`.
</Note>

## Choosing where a session runs

In the Kai Code composer, the **Run on** picker lists the Gleap cloud and every connected machine. Pick a machine to run the session there; previews and verification stay on that device, while photo and video proof is available in Kai Code as usual.

A machine is shown as **Away** when it is asleep or the bridge service is not running. Start it again with:

```bash theme={null}
kai-bridge
```

## Saved app sign-ins

When Kai verifies a change in your app and hits a login wall, it asks you once for a sign-in. Sign-ins are encrypted per repository and device, stored on the bridge machine only, and removed after 30 days without use. You can forget one at any time under **Kai Code → Settings → Kai Code Bridge → Saved app sign-ins**.

## Disconnect a machine

Open **Kai Code → Settings → Kai Code Bridge**, open the machine and choose **Disconnect**. Then stop the service on the machine:

```bash theme={null}
kai-bridge uninstall
```
