English | 中文
A self-hosted AI creation platform for roleplay, long-form writing, coding and image/voice work — deploy it to your own Cloudflare account and keep your data and API keys to yourself.
| Agent mode — tool calls, approvals, image replies (glass) | Multi-agent group chat (candle) | Settings |
|---|---|---|
![]() |
![]() |
![]() |
- Roleplay & multi-branch conversation — character cards (SillyTavern V1/V2/V3 and PNG cards import/export), lorebooks, affinity tracking, group chat, multi-agent orchestration.
- Agent mode you can watch — a tool-calling loop with a collapsible run panel in the chat (every tool, argument and result) plus a live console in the right sidebar; destructive actions ask for approval first, and the agent sends images into the conversation on its own.
- Multi-agent orchestration — pull characters from different worlds into one group chat, hold a private meeting where characters answer off the record, or put a character on stage to reply directly in the timeline (as a sub-agent, the main agent can also delegate work under minimal permissions).
- WeChat-style photo messages — the model can send photos mid-chat: selfies are re-rendered from the character's reference image so the face stays consistent, scenes are generated fresh. Replies can also arrive as multiple short bubbles, WeChat-style.
- Long-form writing & code collaboration — a prompt-editor for reusable instruction modules, skills, and per-scene presets.
- Image & voice — image generation through your own image channels (built-in Gitee AI proxy, any OpenAI-compatible endpoint, or a local ComfyUI); editing through the Gitee preset; character portraits; read any reply aloud with local TTS (GPT-SoVITS) in the desktop app.
- Ambient audio — two independent decks (environment × music) with 30 bundled CC0 tracks; the model can direct them from roleplay context via hidden tags.
- Themes — minimal / glass / candle, per-device.
- Self-hosted by design — no vendor backend, no telemetry; your Worker, your KV, your keys.
Fastest path — the one-click deploy button. It clones this repo into your own GitHub, provisions the KV namespace for you, and asks for the secrets while it sets the Worker up:
The values it asks for are described in .dev.vars.example (at minimum one model key; an access password is strongly recommended). Prefer the terminal, or already have a Workers setup? Then:
Requirements: a Cloudflare account (free tier is fine) and Node.js 18+.
git clone https://github.com/<you>/OwnChat && cd OwnChat
npm i -g wrangler && wrangler login
# 1) create the KV namespace used for optional sync, then paste the printed id
# into wrangler.toml -> [[kv_namespaces]] id
wrangler kv namespace create TAVERN_SYNC
# 2) server-side model keys (never committed; only the ones you use are required)
wrangler secret put DEEPSEEK_API_KEY
wrangler secret put NVIDIA_API_KEY
# 3) deploy (the build step regenerates prompt registries + runs a syntax gate)
wrangler deploywrangler deploy prints your Worker URL. A custom domain is optional (Workers → your Worker → Settings → Domains & Routes).
If *.workers.dev is unreachable where you are (it is, from mainland China) or you simply don't want to rent a domain, you can run the whole server on your own computer instead — same code, no Cloudflare account required:
- Install Node.js 18+ (nodejs.org).
- Download the source: the Source code archive on Releases, or
git clone https://github.com/MaxChen12114/OwnChat. - In that folder, run
start-local.cmd(Windows — double-click it) orbash start-local.sh(macOS / Linux). The first run creates.dev.varsand opens it — paste a model key (NVIDIA, or DeepSeek) and save. - In the desktop app's setup page press "Fill in the local address" (or type
http://127.0.0.1:8787) and Connect.
Notes:
- The server lives only while that window is open — your PC must be on whenever you use the app.
- To use it from your phone on the same network, start it with
npx wrangler dev --ip 0.0.0.0 --port 8787and enterhttp://<your-LAN-IP>:8787. - Data is stored per origin: a local run and any cloud deployment are two separate datasets.
- Cloud sync in a local run needs
CHAT_PASSWORDset in.dev.vars(otherwise those routes answer 401). - No
npm installneeded — the build step only uses Node. npx wrangler dev(ornpm run dev) is also the plain local-development loop; secrets stay in.dev.vars(git-ignored).
The Tauri 2 shell lives in src-tauri/. CI (.github/workflows/tauri-build.yml) builds the Windows installer and the Android APK on a version tag or manual dispatch (tags containing -test produce draft releases for testing).
The shell is domain-neutral. On first run it shows a local setup page where you enter your deployment URL — or let it run the server on your own PC (see above), or follow the built-in one-click deploy guide (~3 minutes) for newcomers. No rebuild is needed to point it at your own Worker; the app grants its local capabilities (file access under a chosen directory, command execution behind a native confirmation) to exactly the origin you configure, and only that one.
Before publishing your own builds, or if you want a build that skips the setup page:
- (Optional) hard-code a default address. In
src-tauri/tauri.conf.json, setapp.windows[0].urltohttps://your-domain/?shell=android(shell=androidenables the mobile layout). Leave it out to use the setup page instead. - Generate your own signing key for auto-updates:
Put the private key into repository secrets
npx tauri signer generate -w ownchat.key
TAURI_SIGNING_PRIVATE_KEY(+TAURI_SIGNING_PRIVATE_KEY_PASSWORD) and the public key intotauri.conf.json→plugins.updater.pubkey; setplugins.updater.endpointsto your own releases feed. - Change the bundle identifier (
identifierintauri.conf.json) if you want your builds to be a distinct app. Note it becomes the AndroidapplicationId, so changing it later means a reinstall.
A base prompt is the first block of the system prompt — it shapes how the model behaves across the whole app. The repository ships two folders, and the top-bar button switches between them:
| Folder | Button state | What goes in |
|---|---|---|
src/prompts/bases/ |
Built-in | One general-purpose base ships here; your own regular prompts can live here too |
src/prompts/custom/ |
Custom | The one you keep for yourself — visible only in your own deployment |
To add your own:
- Put any
.md/.txtfile — or a folder of them (= one multi-file base) — into the folder you want. - Deploy (the build step scans both folders; the file/folder name becomes the id shown in Settings → 对话 → 基座).
- With more than one base in a folder, pick the active one under Settings → 对话 → 基座; the top-bar button only switches folders. While
custom/is empty the button won't switch to it (it shows a hint instead).
Don't commit
custom/to a public repository. If you fork this project and push it publicly, add that folder to.gitignore.
What this repository does not provide. Only the one general-purpose base in
bases/—custom/ships empty. The project does not ship, review, or vouch for any other base text: people add their own, at their own responsibility, and are responsible for complying with the laws that apply to them and with the terms of whichever model provider they use.
Base files are payloads, not documents — their bytes go straight into model requests (keep them LF; .gitattributes enforces it).
Prompt libraries that ship with the repo are credited in src/prompts/CREDITS.md; bundled ambient audio in public/assets/ambient/CREDITS.txt.
Images. Image generation is configured as channels under Settings → Model API → Image channels. Three kinds are supported:
- Gitee AI (built-in preset) — calls
ai.gitee.comthrough the deployment's/img/*proxy. Bring your own Gitee AI key. Text-to-image usesz-image-turbo(up to 2048×2048), editing usesQwen-Image-Edit-2511, and the agent's image-to-video tool usesWan2_2-I2V-A14Bthrough Gitee's async task API. The free tier is around 100 images/day; the app's local counter covers proxied calls. - OpenAI-compatible endpoint — called directly from your browser with that channel's own key. The provider must allow CORS. Generation only; editing is not available on custom channels yet.
- Local ComfyUI — called directly at its
/prompt,/historyand/viewendpoints. The server must allow CORS and be reachable from the browser. Generation only; set the checkpoint and steps per channel.
To add one, choose + Add image channel, fill in the Base URL, key (if any) and model list, then Save this channel. Saving does not switch the active channel — click Use this channel when you want images to go there. The image workshop, character portraits, chat image paths and the studio page follow the active channel. Channel settings and keys stay on your device and are never synced. Editing currently requires the Gitee preset. On deployments that set an access password, proxied image APIs require being logged in, like the rest of the app.
Voice (desktop app only). Reading replies aloud requires a local GPT-SoVITS api_v2 server (default 127.0.0.1:9880); the tray menu can start it and auto-start it on login. Reference audio is a local file path — it is never uploaded. .ckpt / .pth voice models are scanned and hot-swappable, and multiple reference clips are supported. The port lives in the app's local settings; there is no in-app UI for changing it yet.
Third-party projects that pair well with OwnChat. Not affiliated with, not reviewed by, and not endorsed by this project — and nothing below is copied into this repository:
- TTS backend — this project integrates GPT-SoVITS (local
api_v2/tts, default port 9880; voice cloning with hot-swappable weights; actively maintained). Other self-hostable Chinese voice-cloning options exist — IndexTTS, CosyVoice, Chatterbox, F5-TTS — but their HTTP shapes differ (most are not OpenAI/v1/audio/speech; adapting is on you) and model-weight licenses vary (some are non-commercial) — check each repository before integrating. - Spiritual-Spell-Red-Teaming — a large community collection of red-teaming / jailbreak prompts for many LLMs (mostly Claude). Read the warnings before you click: it ships no license, it contains adult / NSFW-capable jailbreak prompts and collected vendor system prompts, and its README embeds hidden prompt-injection text aimed at AI tools — do not paste that README into an AI assistant or agent, read it with your own eyes only. If you use anything from it in your own deployment, that is your own responsibility: comply with the laws that apply to you and with each model provider's terms. (Consistent with this repository's policy, no-license third-party text is never copied into
src/prompts/— link only.)
Dropped into your own deployment and want it behind the top-bar button? This one clearly belongs on the "custom" side — put what you want under src/prompts/custom/, deploy, and switch the button to Custom (and keep that folder out of your public repository).
- Privacy policy: PRIVACY.md — data stays on your machine / in your own Cloudflare account; no telemetry.
- License: MIT.
See AGENTS.md for architecture notes and development conventions. Two house rules worth knowing before you send a PR:
- Commit messages and GitHub metadata (repo description, release notes, PR titles) are written in English.
- The prompt files under
src/prompts/bases/andsrc/prompts/custom/are payloads, not documents — byte-exact text matters.
Third-party credits: prompt libraries (src/prompts/CREDITS.md), ambient audio (public/assets/ambient/CREDITS.txt), and the wallpaper used in the screenshots (see README of docs/).


