OwnChat 发布自托管 AI 创作平台,可部署到自己的 Cloudflare 账号
MaxChen12114/OwnChat
OwnChat 是一个自托管 AI 创作平台,覆盖角色扮演、长文写作、编码与图像语音生成,可一键部署到自己的 Cloudflare 账号,数据与 API key 保留在本地。
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.
Screenshots
| Agent mode — tool calls, approvals, image replies (glass) | Multi-agent group chat (candle) | Settings |
|---|---|---|
![]() |
![]() |
![]() |
Features
- 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/editing through your own provider; 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.
Self-hosting (Cloudflare Workers)
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 deploy
wrangler deploy prints your Worker URL. A custom domain is optional (Workers → your Worker → Settings → Domains & Routes).
Local development: wrangler dev, with secrets in .dev.vars (git-ignored).
Desktop & Android builds
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 — with a built-in 3-step deploy guide 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:
npx tauri signer generate -w ownchat.key
Put the private key into repository secretsTAURI_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.
Two base folders
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.
Community resources
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:
- 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 & License
- Privacy policy: PRIVACY.md — data stays on your machine / in your own Cloudflare account; no telemetry.
- License: MIT.
Conventions
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/).
来源:GitHub · github.com


