Opticnerve
by jordicor
README.md
# Opticnerve
**The optic nerve between a camera and an AI brain.**
**English** · [Español](README.es.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Deutsch](README.de.md)
AI models can already look at a picture and hold a spoken conversation. Putting one inside a real camera takes a lot of plumbing: video and audio streams, a pan-tilt head that has to stop every time, a speaker that few tools can reach, the echo of the AI's own voice, knowing when someone is talking to it, a memory, and the privacy of the people in the room. Opticnerve is an open Python engine that does that work, so the AI you choose can see, hear, talk and move through a camera you own.
It runs on your computer as a command-line tool and an MCP server. It's free and open source under the MIT license, with no account or cloud service of its own. The AI providers you turn on use your own accounts, and the camera's sounds, gestures, games and pet behaviors work with no AI at all.
**Status:** 0.1.0, the first public release. Commands and the Python API may still change, which is why the products built on Opticnerve pin an exact version.
## Who it's for
- **You want to give your AI agent a body.** Connect Claude Code, Codex, Claude Desktop or Grok Build through MCP. The agent can take a fresh look, turn the camera, nod, speak through the camera's speaker and listen to the room.
- **You're building something with a camera and an AI.** Camera control, hearing, voice, vision, memory and the conversation loop are already here, with tests that run without hardware. Your project brings its own name, persona, instructions and app.
- **You have a Tapo pan-tilt camera and like to tinker.** Turn it into a desk pet with its own sounds, gestures and party games, and give it a real voice when you feel like it.
## Built on Opticnerve
Two projects by the same author use Opticnerve as their engine. If you'd rather have a finished product than a toolkit, start with one of them:
- **Framepal**: film yourself with a DJI Osmo Pocket 3 while an AI in your earbuds frames, records and tracks with the camera. An Android app plus a server you run yourself.
- **Camkin**: a home companion and guardian inside a pan-tilt Tapo camera. It turns to whoever calls it, chats, plays, keeps an eye on the house and gets to know its people, if they want it to.
Each one is a small package on top of this engine with its own profile, documentation and app. [How they fit together](docs/product-architecture.md).
## How it works
```mermaid
flowchart LR
camera["Camera<br/>Tapo C210 or C200,<br/>DJI Osmo Pocket 3"] <-->|"video, sound,<br/>head, speaker"| engine["Opticnerve<br/>on your computer"]
engine <-->|"MCP, realtime voice,<br/>cloud or local models"| brain["The AI you choose<br/>Claude, Gemini, GPT,<br/>Grok, Ollama models"]
project["Your project<br/>(or Framepal, Camkin)"] -->|"profile, commands"| engine
```
The camera is the body and the AI model is the brain. Opticnerve turns the camera's streams into things a model can use, such as a fresh still, a transcript, a sound level or a recognized face, and turns the model's decisions into motion and sound. You can change the brain without touching the body.
## What it does
### Sees
`look` takes a fresh still from the camera. Detection runs on your computer: motion, faces (YuNet) and recognition (ArcFace) of the people who enrolled themselves. For filming, it measures a picture: histograms, shadows and highlights, and brightness across a 3x3 grid. On a pan-tilt camera, a panorama scan maps the room and its named spots, so "look at the door" points somewhere.
### Hears
The camera's microphone, a microphone on your computer or a file. Speech-to-text runs on your computer with Whisper (CPU or NVIDIA GPU), on a server on your network, or with ElevenLabs, OpenAI or Deepgram. A rolling transcript, wake words and voice detection tell it when someone is talking to it.
### Speaks
Through the camera's own speaker. With no API key, it has procedural creature sounds and a babble voice unique to its name. ElevenLabs adds spoken words. For a conversation, connect a realtime voice model (Gemini Live, OpenAI Realtime, GPT-Live, xAI or ElevenLabs Agents): it answers in about a second and you can interrupt it. Long conversations carry on past each provider's session limit. The personas and built-in lines are in English and Spanish.
### Moves
Pan and tilt over ONVIF, with nearly 30 gestures (nod, shake, giggle, shy peek, sneeze...) and emotions that pair a gesture with a sound. Every movement ends with a stop command, even after an error. Several cameras in one place run together as one pet, and a conversation follows its person from one camera to the next. Through Framepal's Android app it also drives a DJI Osmo Pocket 3: pan, tilt and zoom, recording and ActiveTrack.
### Thinks with the brain you choose
- **AI agents over MCP:** Claude Code, Codex, Claude Desktop and Grok Build.
- **Realtime voice:** Gemini Live, OpenAI Realtime and GPT-Live, xAI, and ElevenLabs Agents, which can run Claude.
- **Your ChatGPT plan,** through Sign in with ChatGPT.
- **Local models** in Ollama.
With `live --mind`, a vision model looks through the camera every few minutes and decides what to do on its own: explore the room, notice the light, start a conversation. Pet mode needs no model at all. It greets you when you come in, peeks at things moving, yawns when it's bored and says good night when the lights go out.
### Remembers, with consent
Memory is a set of SQLite files on your computer: one per person, one per place and one for the pet. People enroll themselves before it recognizes them, and anyone can see and delete what it keeps about them. A stranger's face or voice is compared on your computer and dropped. What's said in one place stays in that place.
## Get started
**What you need**
- A computer with Python 3.11+, [uv](https://docs.astral.sh/uv/), git and ffmpeg 5.1 or newer.
- A TP-Link Tapo C210 or C200 on your network, with a Camera Account created in the Tapo app: camera → Settings → Advanced Settings → Camera Account.
- Optional: accounts with the AI providers you want to use.
Tested with the Tapo C210 and C200 and the DJI Osmo Pocket 3. The [hardware guide](docs/hardware.md) lists other cameras and what's known about each one.
**Install and wake it up**
```bash
git clone https://github.com/jordicor/opticnerve.git && cd opticnerve
uv sync --extra vision --extra mcp
uv run opticnerve setup # finds the camera; passwords are asked with hidden input
uv run opticnerve go2rtc install # helper for the camera speaker, checksum-verified
uv run opticnerve go2rtc start
uv run opticnerve doctor --live # every problem comes with its fix
uv run opticnerve express happy
```
**Give it to your agent**
```bash
uv run opticnerve mcp-config --client claude-code # or codex, claude-desktop, grok-build
```
This prints what to register in your client. Add `--dry-run` to rehearse with a camera that doesn't move or make a sound.
You can also let your agent do the setup: ask it to *read AGENTS.md and set up opticnerve for my camera*. Your passwords stay out of the chat. You run `setup` yourself, or write them into files and give the agent only their paths.
The [home guide](docs/home-guide.md) goes on from here: hearing, live conversations, the inner mind, games, memory and recognizing people.
## Real cameras, real rooms
Commands like `move`, `gesture`, `say`, `live` and `companion` turn a camera or make sound in someone's home. Rehearse with `--dry-run` where it exists: the body records what it would do instead of doing it. Without a camera, use files: `--video-source loop-file:clip.mp4` and `--audio-source loop-file:voice.wav`.
Tell people before the camera listens or looks. Keep RTSP, ONVIF, go2rtc, speech servers and Ollama on your local network, never open to the internet. Passwords and API keys go into your operating system's keyring or a private file, typed with hidden input, never into a chat or the code.
## Documentation
- [Home guide](docs/home-guide.md) ([en español](docs/home-guide.es.md)): a pan-tilt camera as a pet and guardian, step by step.
- [Hardware](docs/hardware.md): cameras, the speaker and firmware notes.
- [Hearing](docs/hearing.md): microphones, speech-to-text, wake words and a local speech server.
- [Brains](docs/brains.md): MCP agents, your ChatGPT plan, Ollama, realtime voice and the inner mind.
- [Customizing](docs/customizing.md): personas, gestures, behaviors and sounds.
- [Pocket companion](docs/companion.md) and [Pocket 3 by USB](docs/pocket3.md): the DJI Osmo Pocket 3 as a body.
- [Long voice conversations](docs/realtime-continuity.md): how a conversation outlives provider session limits.
- [Product architecture](docs/product-architecture.md): building a product on the engine.
- [AGENTS.md](AGENTS.md): the short, exact version for AI coding agents.
## Developing
The engine fails fast with an actionable message, loads optional dependencies only when they're needed, and its tests use simulated devices and localhost connections, never a physical camera, a paid provider or your keyring.
```bash
uv run python -m unittest discover -s . -p "test_*.py" -t .
uv run ruff check opticnerve tests
```
Bugs, ideas and pull requests are welcome in [issues](https://github.com/jordicor/opticnerve/issues). See [CONTRIBUTING.md](CONTRIBUTING.md) first.
## License
MIT. Model files keep their own licenses: YuNet is MIT, and the ArcFace buffalo_l recognition model is for non-commercial use only. See the [third-party notices](THIRD_PARTY_NOTICES.md) and the [model details](docs/home-guide.md#license).
Opticnerve is an independent project, not affiliated with or endorsed by TP-Link or DJI. Product names and trademarks belong to their owners.
## Who's behind it
**An OjoCentauri lab.** OjoCentauri is the AI division of Acerting Art Inc., based in Florida. Opticnerve is built by [Jordi Cor](https://jordicor.com) · [YouTube](https://youtube.com/@JordiCor) · [LinkedIn](https://www.linkedin.com/in/jordicor/) · [X](https://x.com/jordicor).
More from the lab: [GranSabio](https://gransabio.jordicor.com), plus Aurvek, Axiotheon, KatariShoji and Atagia at [jordicor.com](https://jordicor.com).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues