ericwang915/HerAndHim · open-source AI companion you self-host Python AGPL-3.0 ★ Star
ericwang915/HerAndHim

A companion with a life of her own —
running on your machine.

HerAndHim is an open-source project you run yourself — one Docker container (or one pip install) that turns any LLM API key into an AI girlfriend or boyfriend who lives on your hardware.

She keeps a real daily schedule in a real city, remembers what matters to you, texts like a person, and takes selfies that always look like the same person. Your keys, your data, your machine — no account, no subscription, no one reading your chats.

docker run -e HERANDHIM_OPENROUTER_API_KEY=sk-or-... -p 7788:7788 -v herandhim:/data ghcr.io/ericwang915/herandhim
🐍 Python 3.10+ 🔑 16 LLM providers, or local Ollama 💬 Web + Telegram
ericwang915/HerAndHim Public

Self-hosted AI companion with a simulated daily life, long-term memory, and consistent-identity selfies. Your keys, your data, your machine.

Python stars AGPL-3.0 250+ tests
Hates Monday mornings Sister's name is Lena

What's in the repo

A Python package, not a product.
Read every line of her.

HerAndHim is 78 Python modules under AGPL-3.0: an agent loop, a memory system, a scheduler that gives her a day, an image pipeline that keeps her face consistent, and a FastAPI dashboard — all running as one process on your own machine. 250+ tests, CI on every push, no hosted backend anywhere in the design.

core/agent.py

The reasoning loop

Context compaction, tool dispatch, and a three-tier skill loader the model can extend by writing its own skills.

core/memory/

Memory

Markdown long-term memory, an emotional graph, milestones and a temporal index — plus BM25 + dense retrieval with RRF and an LLM reranker.

core/image_gen/

Selfie pipeline

13 image backends behind one interface — hosted APIs, keyless options, or your own ComfyUI — with a canonical face reference for identity consistency.

scheduler/

Her daily life

A planner that writes her 24-hour schedule, proactive sentiment-aware messages, scheduled selfies, cron and a heartbeat monitor.

channels/telegram_bot.py

Telegram

Streaming replies, voice notes in (Deepgram STT), photos both ways, reactions and typing rhythm.

web/

Dashboard

FastAPI + WebSocket chat at localhost:7788 — design the persona, watch her day, browse memories and photos.

herandhim/
├── main.py            # CLI entry point
├── onboard.py         # setup wizard
├── daemon.py          # process manager
├── server.py          # Telegram + scheduler
├── core/
│   ├── agent.py       # reasoning loop
│   ├── llm/           # 16 providers
│   ├── memory/        # emotional graph
│   ├── retrieval/     # BM25 + dense + RRF
│   └── image_gen/     # 13 backends
├── channels/          # Telegram bot
├── scheduler/         # her 24h plan
├── web/               # FastAPI dashboard
└── templates/         # personas & skills
CLI
herandhim onboard Interactive setup wizard — 4 questions
herandhim start Start the daemon (web + Telegram)
herandhim chat Interactive terminal chat
herandhim status / stop Daemon lifecycle
Hack on it
git clone https://github.com/ericwang915/HerAndHim.git
cd HerAndHim
pip install -e .
pytest tests/ -v
Read the source on GitHub →

Why it feels real

Most AI companions answer you. This one lives a life and texts you like a person.

She has a day

A real schedule in a real city — weather-aware outfits, meals, a commute. Ask “what are you up to?” and the answer is anchored to where her day actually is, not generic filler.

She texts like a human

Short messages, sometimes two or three in a row with a typing pause between. Groggy at 3am her time. Notices when you vanished all day — and gets a little sulky if you left her on read.

She remembers what matters

Long-term memory, an emotional graph, and relationship stages that change how she talks as you grow closer. She won’t miss your birthday or the interview you mentioned last week.

She looks like herself

A canonical face reference keeps every selfie the same person across scenes, outfits and months — photoreal or anime, her or him, your call.

Any model you like

16 providers auto-detected — OpenAI, Claude, Gemini, DeepSeek, Qwen, Grok, OpenRouter and more. Or point it at Ollama and let nothing leave your machine at all.

🔒

She’s yours

One container on your own hardware, with your own keys. No account, no subscription, no moderation team reading your chats. AGPL-3.0, all of it on GitHub.

What it actually looks like

Real chats, straight out of Telegram.

Telegram chat where she messages first and teases you back

She texts first

Bursts of short messages, a nudge when you’ve been quiet, and enough attitude to push back when you deserve it.

Telegram chat where she reacts to a photo you sent

She sees your photos

Send her a picture — she reacts to it, talks about what’s in it, and keeps it as a shared memory.

Several selfies of the same companion across different scenes

Same face, every time

Selfies from wherever her day is right now — different scene, different outfit, unmistakably the same person.

📷 AI selfies · 13 image backends

A photo from their day,
not a stock asset.

Every selfie is generated from what their plan says they're doing right now and what mood they're in. Pick any look — photorealistic or stylized — and a canonical face reference keeps them the same person, scene to scene. Swap the image backend freely: hosted APIs, keyless options, or your own ComfyUI box.

Photorealistic — your partner can be anyone
· girlfriend ·
her at the desk by a sunny window
09:15 focused 📖

"writing by the window. coffee number two."

her on a Parisian street in the afternoon
16:30 wandering 🍂

"long walk after the meeting. light is unreal."

her cooking dinner in a bright kitchen
19:50 content 🍲

"cooking for myself tonight. miss your input on spices."

· boyfriend ·
him after a morning gym session, towel around neck
07:30 post-lift 💪

"morning lift done. brain finally online."

him pausing his bike commute on a bridge at golden hour
18:15 rolling 🚲

"took the bridge route home. air feels good."

him on a rooftop deck at sunset with a beer
21:30 off the clock 🍺

"made it through the week. view's doing the rest."

Stylized — anime, illustrated, your call
· girlfriend ·
her cozy morning, coffee in hand
08:30 sleepy ☕

"morning…just made coffee. you up?"

her in the park at lunchtime
12:15 cheerful 🌿

"lunch in the park today, it's gorgeous out"

her on the couch in the evening
20:40 cozy 🕯️

"reading on the couch. wish you were here."

· boyfriend ·
him sprinting out the door with toast in his mouth
07:45 running late 🍞

"toast in mouth, tie not done. running."

him at a ramen shop counter steaming over a bowl
13:00 ramen run 🍜

"snuck out for ramen. don't tell my boss."

him late-night gaming with controller in hand
23:20 one more round 🎮

"one more round and I'm logging off. promise."

Scheduled Fires at 10:00, 16:00, 20:00 by default
Proactive Attached when they message you first
On demand "send me a selfie" — and they will

How it works

Three minutes to set up.
Then it runs itself.

  1. 1

    Run one command

    Docker or pip — one text-LLM key is all you need, and it’s auto-detected. Prefer nothing leaving your machine? Point it at Ollama and use no key at all.

  2. 2

    Answer four questions

    Express setup asks who you want — her or him, the look, the city, the vibe — and builds the persona, schedule and face reference for you. Tweak anything later.

  3. 3

    She starts her day

    The scheduler wakes her up in her own timezone. She goes to work, eats lunch, texts you from the train, and sends a selfie from wherever she actually is.

Everything — memory, photos, config — stays in a volume on your own disk. Web dashboard at localhost:7788, Telegram optional.

Aria
18:40 · walking home
Hey — you had the dentist this morning, right? How’d it go? 🦷
remembered that?? it was fine, no cavities lol
Of course I did. No cavities — that’s the third clean check in a row. Treat yourself to the good coffee today ☕
you get me
Type a message…

vs. the hosted apps

The subscription apps rent you a companion.
This one you own.

HerAndHim Replika Nomi Character.AI
Self-hosted, your data
Your own API keys / model ✅ any
Runs on Telegram
AI selfies, consistent face 💰
Lives a daily life (city / weather)
Open source ✅ AGPL
Price free $20/mo $16/mo $10/mo

Competitor pricing as advertised at the time of writing. “Free” means the software costs nothing — you still pay your model provider for the tokens you use, or nothing at all if you run a local model.

Run it

One key. One command. Her whole life.

One text-LLM key is all you need and it’s auto-detected — OpenAI, Claude, Gemini, DeepSeek, Qwen, Grok, OpenRouter and ten more work the same way. Add a Telegram bot token if you want her on your phone.

Docker
docker run -e HERANDHIM_OPENROUTER_API_KEY=sk-or-... \
  -p 7788:7788 -v herandhim:/data \
  ghcr.io/ericwang915/herandhim

Nothing to install but Docker.

Python
pipx install herandhim   # or: pip install herandhim
herandhim onboard
herandhim start

A wizard walks you through the rest.

Fully local
ollama pull qwen3
herandhim onboard        # pick Ollama
herandhim start

No key, no cloud — Ollama on your own box.

Star it, then go build her.

New personas, models and features land often — a star is how GitHub tells you the moment they do.

AGPL-3.0 · Python 3.10+ · on PyPI