No description
  • JavaScript 44.4%
  • TypeScript 43.5%
  • CSS 11.6%
  • Dockerfile 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brian 58c4603fd9
All checks were successful
Build and Deploy / build (push) Successful in 11s
Build and Deploy / deploy (push) Successful in 3s
Offer llama.cpp models alongside Claude and Ollama
Adds a 'llamacpp' provider. server/llamacpp.js runs a chat turn against
llama-server's OpenAI-compatible /v1/chat/completions with the same
callback contract as ollama.chat(), translating stored Anthropic-format
history (tool_use/tool_result, images, text documents) to OpenAI messages
and reassembling streamed tool-call fragments back into tool_use blocks,
so chats can switch providers mid-thread.

Vision and tool support come from /props. If the server was started
without --jinja and rejects tools, the turn retries without them once and
remembers that for the model. Works with router mode and llama-swap.

Admin gets a llama.cpp URL and optional API key (clearable), and the
Models card's local-model section is shared between Ollama and llama.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Eq42wB7UmprQbhrM3XCh4Y
2026-11-11 15:26:03 -07:00
.forgejo/workflows Adopt shared claude-chat-client / @brian/claude-chat-ui packages 2026-07-20 23:20:46 -06:00
client Offer llama.cpp models alongside Claude and Ollama 2026-11-11 15:26:03 -07:00
server Offer llama.cpp models alongside Claude and Ollama 2026-11-11 15:26:03 -07:00
.dockerignore Initial commit 2026-05-27 11:20:49 -06:00
.env.example Add support for image generation 2026-06-16 08:35:30 -06:00
.gitignore Migrate frontend to React + TypeScript with a visual refresh 2026-07-20 20:41:50 -06:00
.npmrc Adopt shared claude-chat-client / @brian/claude-chat-ui packages 2026-07-20 23:20:46 -06:00
docker-compose.dev.yml Migrate frontend to React + TypeScript with a visual refresh 2026-07-20 20:41:50 -06:00
docker-compose.yml Add OIDC single sign-on (link existing accounts; auto-provision new ones) 2026-06-09 12:21:47 -06:00
Dockerfile Adopt shared claude-chat-client / @brian/claude-chat-ui packages 2026-07-20 23:20:46 -06:00
package-lock.json Let Claude run Python to analyze data and plot charts 2026-10-14 11:29:15 -06:00
package.json Let Claude run Python to analyze data and plot charts 2026-10-14 11:29:15 -06:00
README.md Offer llama.cpp models alongside Claude and Ollama 2026-11-11 15:26:03 -07:00

Claude Family Chat

A self-hosted chat app that lets your family share access to Claude — each person gets their own private conversation history. Your API key stays on the server.

Quick Start

1. Get an API key

Sign up at console.anthropic.com and create an API key.

2. Edit docker-compose.yml

Open docker-compose.yml and fill in:

ANTHROPIC_API_KEY: "sk-ant-your-actual-key"
USERS: '{"alice":"password1","bob":"password2"}'
SESSION_SECRET: "any-long-random-string"

3. Run it

docker compose up -d

The app is now running at http://localhost:3000

On your home network, other devices can reach it at http://YOUR-LOCAL-IP:3000 (Find your IP with ipconfig on Windows or ifconfig / ip addr on Mac/Linux)


The Admin Page

Admins get a dedicated page at /admin (a ⚙ Admin link appears in the sidebar). From there you can, without ever editing the deploy or restarting:

  • Manage users — add a user directly (username + temporary password), or generate a one-time invite link (/join?token=…) the new person opens to set their own password. Delete users and grant/revoke admin.
  • View usage & cost — per-user token usage and per–group-chat usage (group chats are tracked separately), with period filters and cost estimates.
  • Manage shared chats — create, edit (title / members / prompt), and delete.
  • Edit configuration — the default system prompt, model, max-history, and the Anthropic & Brave API keys (masked, with reveal). Changes take effect immediately.

Everything here is stored in the SQLite database (/data/app.db).


Managing Users

Users and the admin flag are stored in a small SQLite database (/data/app.db), with passwords hashed (scrypt) — they're never stored in plaintext. Day-to-day user management happens on the Admin Page; the environment variables below are only used to bootstrap an empty database on first run.

First run: set USERS and ADMIN_USER so the first accounts (including your admin) exist. On the very first boot with an empty database, these are imported automatically:

USERS: '{"mom":"secure-pass","dad":"another-pass","kid1":"their-pass"}'
ADMIN_USER: 'mom'

After the first boot the database is the source of truth — changes to USERS / ADMIN_USER are ignored once any user exists. Manage users from the Admin Page instead. (To re-seed from scratch, wipe the data volume with docker compose down -v.)


Single sign-on (OIDC)

You can let people sign in through an OpenID Connect identity provider (Authentik, Authelia, Keycloak, Zitadel, Google, …) instead of — or in addition to — a username and password.

How it behaves:

  • New people are provisioned automatically. The first time someone signs in through your provider, an account is created for them (the username is derived from their preferred_username/email). On a brand-new install, the very first person to sign in this way becomes the admin.
  • Existing users can link their account. A password user opens the in-app Account panel (the person icon next to Sign out) and clicks Link single sign-on; from then on they can log in either way. Linking is the only way to attach SSO to an existing account — signing in with an unlinked provider identity always creates a separate account.
  • OIDC-only accounts have no password until the user sets one in the Account panel. They can't unlink SSO until they do (it'd lock them out).

⚠️ Provisioning is open: anyone your identity provider authenticates gets an account here. Restrict who can authenticate (or which apps they can reach) at the provider, not in this app.

Setup: create an OIDC/OAuth2 confidential client in your provider with the redirect URI:

https://YOUR-DOMAIN/api/auth/oidc/callback

Then fill in the Single sign-on (OIDC) section on the Admin Page (or seed it with the OIDC_* env vars on first boot). Once the issuer, client ID, and client secret are all set, a Sign in with single sign-on button appears on the login page. Requested scopes are openid email profile.


Local models (Ollama)

You can offer models from your own Ollama server in the chat picker alongside Claude:

  1. On the Admin Page, under Configuration → Local models (Ollama), set the Ollama URL (e.g. http://192.168.1.50:11434). The app server must be able to reach it, and Ollama must listen on the network (OLLAMA_HOST=0.0.0.0).
  2. In the Models card, click Load models from Ollama and Add the ones you want. They're tracked in usage stats at no cost.

Local models get the weather, web search, artifact, and image-generation tools when the model supports tool calling. They don't get code execution (which runs in Anthropic's sandbox) or PDF attachments. They only see images if the model supports vision. Chats can switch between Claude and local models mid-thread.

The Context length setting (default 32768) is sent with every request. Ollama's own default is small and silently cuts off long chats from the start, system prompt first. Raise it for long chats or knowledge-base docs if you have the VRAM.

llama.cpp

Models served by llama.cpp's llama-server (or anything speaking its OpenAI-compatible API, like llama-swap) work the same way:

  1. Start the server reachable from the app, with tool calling enabled: llama-server -m model.gguf --host 0.0.0.0 --port 8080 --jinja -c 32768 Add --mmproj for a vision model, and --api-key if you want one.
  2. On the Admin Page, under Configuration → Local models (llama.cpp), set the URL (e.g. http://192.168.1.50:8080) and the API key if you set one.
  3. In the Models card, click Load models from llama.cpp and Add the models it lists. A plain llama-server lists one model; router mode or llama-swap list several, and each is picked by name per request.

The context size comes from -c on the llama-server command line. Unlike Ollama, llama.cpp rejects a request that doesn't fit instead of silently truncating it. Without --jinja the server refuses tool definitions, so the app falls back to plain chat for that model and logs a hint.


Environment Variables

Most settings now live in the database and are edited on the Admin Page. The variables below seed the database on first boot only (when their value isn't set in the DB yet); afterward the DB wins and the admin page is where you change them. Only the infrastructure variables (SESSION_SECRET, DB_FILE, PORT) are read from the environment on every boot.

Variable Default Description
ANTHROPIC_API_KEY (required first boot) Your Anthropic API key. Seeds the DB, then editable on the Admin Page
USERS {} JSON object of username→password pairs. First boot only — ignored once any user exists
ADMIN_USER (none) Username to mark as admin when seeding. First boot only
BRAVE_API_KEY (none) Brave Search API key (enables web search). Seeds the DB, then editable on the Admin Page
CLAUDE_MODEL claude-sonnet-4-6 Default model. Seeds the DB, then editable on the Admin Page
MAX_HISTORY 100 Max messages kept per chat. Seeds the DB, then editable on the Admin Page
SYSTEM_PROMPT (helpful-assistant prompt with tool guidance) Default system prompt. Seeds the DB, then editable on the Admin Page
OIDC_ISSUER (none) OIDC provider issuer URL. Seeds the DB, then editable on the Admin Page
OIDC_CLIENT_ID (none) OIDC client ID. Seeds the DB, then editable on the Admin Page
OIDC_CLIENT_SECRET (none) OIDC client secret. Seeds the DB, then editable on the Admin Page
OIDC_BUTTON_LABEL Single sign-on Label on the sign-on button. Seeds the DB, then editable on the Admin Page
OIDC_BASE_URL (auto-detected) Override for the base URL used to build the redirect URI. Seeds the DB, then editable on the Admin Page
COMFYUI_URL (none) ComfyUI HTTP API URL. When set, Claude gets a generate_image tool (the server must be able to reach this URL). Seeds the DB, then editable on the Admin Page
COMFYUI_CHECKPOINT (none) Checkpoint for the built-in default txt2img workflow. Seeds the DB, then editable on the Admin Page
COMFYUI_STEPS 25 Sampler steps for the built-in workflow. Seeds the DB, then editable on the Admin Page
COMFYUI_CFG 7 CFG scale for the built-in workflow. Seeds the DB, then editable on the Admin Page
SESSION_SECRET change-me-in-production Secret for signing session cookies — change this! Read from env every boot
DB_FILE /data/app.db Path to the SQLite database. Read from env every boot
PORT 3000 Port the server listens on. Read from env every boot

Data & Privacy

  • Conversation histories are saved in a Docker volume (chat-data) — they persist across restarts
  • User accounts and runtime config (API keys, system prompt, model) live in a SQLite database (/data/app.db) on the same volume; passwords are hashed (scrypt), never stored in plaintext
  • Each user's history is completely isolated from other users
  • Your API key is only on the server; it's never sent to the browser (admins can reveal it on the Admin Page)
  • To wipe all history and accounts: docker compose down -v (deletes the volume)

Monitoring Costs

Keep an eye on your API usage at console.anthropic.com/usage. Set a spending limit under Settings → Limits to avoid surprises.


Updating

docker compose pull   # if using a registry image
docker compose up -d --build

Running on a Raspberry Pi or Home Server

Works great on any always-on machine. Just open port 3000 in your firewall/router if you want access outside your home network (consider adding HTTPS via a reverse proxy like Caddy or nginx in that case).