Metadata-Version: 2.4
Name: pipelabs-bridge
Version: 0.2.9
Summary: Pipelabs bridge — connects your local ComfyUI server to Pipelabs.
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31
Requires-Dist: pillow>=10.1

# pipelabs-bridge

The Pipelabs bridge runs on your ComfyUI server. It connects **outbound** to
Pipelabs (no inbound ports needed, so it works behind Vast.ai's NAT), polls for
jobs, talks to your local ComfyUI API, and reports status back.

## Install & run

```bash
pip install pipelabs-bridge
pipelabs-bridge --token <YOUR_TOKEN> --app-url https://your-pipelabs-app
```

Options (all can also be set via environment variables):

| Flag          | Env var             | Default                 |
| ------------- | ------------------- | ----------------------- |
| `--token`     | `PIPELABS_TOKEN`    | (required)              |
| `--app-url`   | `PIPELABS_APP_URL`  | `http://localhost:3000` |
| `--comfy-url` | `COMFY_URL`         | `auto` (finds ComfyUI on 8188, or 18188 on Vast.ai) |
| `--interval`  | —                   | `3.0` (seconds)         |
| `--max-interval` | —                | `20.0` (seconds, capped at 25) |

Keep it running in `tmux` or `screen` so your server stays "online" in the app.
Press Ctrl+C to stop it.

The bridge polls every `--interval` seconds, then slows to `--max-interval` after
2 minutes with no jobs, so a new job can take up to that long to start when idle.

Handles every Pipelabs job: health checks, images, reference boards, clips,
stitching, and splitting scenarios into clips.

Scenario splitting runs an open Qwen model locally through
[Ollama](https://ollama.com), which `setup_server.sh` installs. Before it runs,
the bridge asks ComfyUI to unload its models, and Ollama unloads Qwen right
after, so the video model gets the GPU back. Set `OLLAMA_URL` if Ollama isn't
on `http://127.0.0.1:11434`.

## Changes

- **0.1.1:** splits scenarios with local Qwen; finds the ComfyUI port by itself;
  Ctrl+C always stops the bridge; unique file names for base images and boards
  (they used to overwrite each other); boards keep the frames' widescreen shape.
