Local AI, natively in UniFi Protect

Protect's AI features on the cameras Ubiquiti's AI doesn't cover: third-party ONVIF cameras and UniFi cameras older than G6. Keystone is an open-source AI Key and AI Port that adopts into Protect like Ubiquiti's own hardware, on a box you already own.

Apache-2.0 · Ollama, CLIP & YOLOX · 100% LAN

Search every camera in plain English, ONVIF and older UniFi cameras included, from Protect's own search bar.

How it works

Everything stays on your network

Keystone is a small service on a box you already run. Protect sends it events; it sends back descriptions, search results and detections over Protect's own protocols. Nothing goes to a cloud unless you point it at one.

  1. 01

    Adopts like real hardware

    Advertises over Ubiquiti UDP discovery and connects over Protect's own mTLS and WebSocket protocols (0xa5f0 and 0xa5f5). No database hacks or patched Protect files.

  2. 02

    Captions and plain-English search

    Looks at several moments of each event so moving cars aren't called parked, maps results onto Protect's 5,375-tag vocabulary, and embeds object crops with local CLIP ViT-L/14.

  3. 03

    Smart detections on ONVIF cameras

    The built-in virtual AI Port (UP AI PORT X) relays HD streams with zero video transcoding, runs motion-gated YOLOX detections, and evaluates Protect's own polygon zones.

Features

What you get

The AI features Protect keeps for Ubiquiti's own AI hardware and newest cameras, on every camera you have, in the same places in Protect's own app.

Quick start

Running in a few minutes

Docker Compose on any Linux box, or Python 3.12+ in an LXC or systemd service.

  1. 1

    Start Keystone

    Copy config.example.yaml, set controller.host and your vision model, and bring it up. Compose includes the TLS pgvector database Protect 7.3+ uses for Find Anything.

  2. 2

    Adopt it in Protect

    Open UniFi Protect → UniFi Devices and adopt the AI Key. The default credentials, ubnt / ubnt, rotate automatically on adoption.

  3. 3

    Pair ONVIF cameras (optional)

    Set aiport.enabled: true, adopt the AI Port, pair your cameras, and turn on Basic Object Recognition and AI Summary under Settings → Intelligence.

git clone https://github.com/seeARMS/keystone.gitcd keystonecp config.example.yaml config.yaml # set controller.host & vision.base_urldocker compose up -d --build

Includes Keystone + the local TLS pgvector database Protect 7.3+ uses for Find Anything.

FAQ

Questions

How is this different from Frigate?

Frigate is a separate NVR, with its own recordings, its own app and its own events. Keystone isn't an NVR and records nothing. It adopts into UniFi Protect as an AI Key and AI Port, so search, descriptions and smart detections show up in Protect itself: the web and mobile apps, push notifications, the timeline and Alarm Manager.

You keep Protect for recording, and everyone in the house keeps the app they already use.

Do I need Ubiquiti's AI Key, AI Port or G6 cameras?

No. Keystone takes the AI Key's and AI Port's place: it shows up in UniFi Devices as a virtual AI Key, and optionally a virtual AI Port, running on hardware you already own. And it works with the cameras you have, not only Ubiquiti's newest.

Which cameras does it work with?

Every camera Protect records, including the ones Ubiquiti's AI doesn't cover. UniFi cameras older than G6 get Find Anything and event descriptions. Third-party ONVIF cameras you've added to Protect, such as Reolink, Amcrest or Nest, can also pair with Keystone's AI Port for Protect's own person, vehicle and animal detections, detection and exclude zones, and descriptions.

What hardware do I need?

Any Linux machine, LXC container or Docker host on the same network as Protect. Search and ONVIF detection run on the CPU in about 4 GiB of RAM.

Descriptions need a vision model through Ollama, on the same machine or on another one with a GPU. A discrete GPU describes an event in a few seconds; an integrated one takes longer.

Does anything leave my network?

Not unless you choose to send it. Ollama, CLIP and YOLOX all run locally. If you'd rather use a hosted model for descriptions, Keystone can call any OpenAI-compatible or Anthropic endpoint instead.

It pins Protect's certificates, its adoption password rotates when Protect adopts it, and its status dashboard only listens on 127.0.0.1 unless you change that.

Which models does it use?

Descriptions come from any vision model Ollama serves (qwen3.5:9b by default), or from an OpenAI-compatible or Anthropic API. Find Anything uses CLIP ViT-L/14, and ONVIF detection uses YOLOX, both as ONNX models downloaded on first run.

Which versions of Protect does it support?

Protect 7.3 and later. Find Anything relies on the pgvector search database Protect 7.3 introduced, which the Docker Compose setup includes.

What happens when Protect updates?

Keystone doesn't patch Protect or touch its database, so an update can't overwrite it. It does speak Protect's own device protocols, so a release that changes them may need a Keystone update to match.

Can I get descriptions in Home Assistant?

Yes. Besides Protect's own notifications, Keystone can send each description to a webhook or over MQTT, for Home Assistant, ntfy or anything else that listens.

Which ports does it need?

Keystone uses host networking so Protect can discover it. If Keystone and Protect are on different VLANs, allow these:

DirectionPortPurpose
Keystone → ProtectTCP 7442UCP4 control WebSocket and AI Port avclient
Keystone → ProtectTCP 7443Find Anything search WebSocket
Keystone → ProtectTCP 7444Media export downloads and RAM callbacks
Keystone → ProtectTCP 7550 / 7551AI Port extendedFlv video ingest
Protect → KeystoneTCP 8080AI Key adoption (HTTPS)
Protect → KeystoneTCP 443AI Port adoption (HTTPS)
Protect → KeystoneTCP 5432PostgreSQL + pgvector over TLS for Find Anything
Protect ↔ KeystoneUDP 10001Ubiquiti LAN discovery (optional if adopted by IP)
Is it affiliated with Ubiquiti?

No. Keystone is an unofficial, open-source community project under the Apache-2.0 license. It includes no Ubiquiti firmware, binaries or model weights.

Run it on hardware you already own

Keystone is free and open source. Start it next to Protect, adopt it, and search your cameras tonight.

View on GitHub