Skip to content

About

Chatterbox joins a voice channel and answers back in a cloned voice - yours or any from Fish Audio's library, with Claude driving the conversation.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

Chatterbox

Talk to yourself. Literally.

Chatterbox joins a voice channel and answers back in a cloned voice, yours or any voice from Fish Audio's library. Claude handles the conversation, Fish Audio handles the voice.

License: MIT Last commit GitHub stars Open issues

Why

Chatterbox gives the bot a persona rather than making it a generic assistant: it has its own name, its own backstory, and speaks in character. The persona is entirely yours to define: name, who they are, who they know, what they're into. There's no built-in default. See GLOSSARY.md for the terms this codebase uses (wake word, attention window, trigger, interrupt, voice session, ...).

Getting started

Chatterbox is BYO-keys. You'll need your own Discord bot, Anthropic API key, and Fish Audio API key before it'll run. Anthropic and Fish Audio are both metered, paid APIs, so running the bot costs money on both, not just Discord.

Prerequisites: Node >=24.22.0 (see .node-version) and pnpm 12.3.4 (see packageManager in package.json).

  • Discord. Create an application and bot in the Discord Developer Portal, following Discord's bot setup guide to create the app, add a bot user, and grab the token and client ID. Under Bot, Privileged Gateway Intents, enable nothing extra; Chatterbox only needs the default Guilds and Guild Voice States intents. When generating the invite URL under OAuth2, URL Generator, select the bot and applications.commands scopes, and under bot permissions pick at least View Channel, Connect, and Speak. You'll also need your own Discord user ID for OWNER_DISCORD_USER_ID and the server's guild ID for DISCORD_GUILDS. Enable Developer Mode in Discord's Advanced settings first, then right-click your name or the server icon and "Copy ID".
  • Anthropic. Create an API key at console.anthropic.com.
  • Fish Audio. Create an API key at fish.audio for voice synthesis, and grab a voice ID from the Fish Audio model library (or clone your own voice there) for FISH_VOICE_ID.
git clone https://github.com/sleithdylan/chatterbox.git
cd chatterbox
cp .env.example .env

Fill in .env with your own Discord, Anthropic, and Fish Audio keys. See the environment variables table below for what each one does and where to get it. Never commit .env. It's already gitignored, but double-check before pushing a fork.

cp src/claude-reply/persona-data.example.ts src/claude-reply/persona-data.ts

Fill in persona-data.ts with your own persona details (bot name, creator name, personality, games, friend group, current grind) — see src/claude-reply/persona-data-schema.ts for the shape.

pnpm install
pnpm dev

The bot logs in and, once invited to a server (see DISCORD_CLIENT_ID/DISCORD_GUILDS below), is ready to join a voice channel and respond to its wake word.

Environment variables

Variable Description
NODE_ENV Runtime environment (development, production, ...)
LOG_LEVEL Overrides the NODE_ENV-based default (debug in development, info otherwise). One of: debug, info, warn, error
PORT Port the HTTP server listens on
APP_NAME Name reported by the HTTP server
DISCORD_BOT_TOKEN Discord bot token from the Discord Developer Portal
DISCORD_CLIENT_ID Discord application (client) ID
DISCORD_GUILDS JSON array of the Discord guilds (servers) the bot operates in: [{"name": "...", "guildId": "..."}]
OWNER_DISCORD_USER_ID Discord user ID of the bot's owner
ANTHROPIC_API_KEY Anthropic API key for Claude
PERSONA Which persona the bot replies in character as: gamer-slang or normal. Default normal. Restart the bot for a change to take effect
FISH_API_KEY Fish Audio API key for voice synthesis
FISH_VOICE_ID Fish Audio voice ID to clone. IS_OWNER_VOICE is derived from this
OWNER_VOICE_SPEED Fish TTS prosody.speed multiplier (0.5-2.0), sent only when IS_OWNER_VOICE is true. Default 1
REPLY_LANGUAGE Default reply-language mode. Auto (default) matches the speaker's own language per turn; changeable at runtime via /language
ATTENTION_WINDOW_SECONDS How long (seconds) after a wake-word trigger the bot keeps responding without needing the wake word again
TTS_STREAM_PLAYBACK Stream TTS playback live instead of fully buffering first (true/false)
APPEAR_OFFLINE Make the bot appear offline/invisible in Discord while still joining voice channels and working normally (true/false)
WAKE_ON_GREETING Also wake the bot on a bare generic greeting ("hey", "hi", "sup", "what's up", ...) with no wake word needed (true/false)
TRANSCRIPT_RETENTION_DAYS How many days a transcript file under logs/ is kept before the retention sweep deletes it. See docs/CONFIGURATION.md and /consent forget

See docs/CONFIGURATION.md for more on how these are validated and used.

Self-hosting

Chatterbox ships a Dockerfile and docker-compose.yml, so you can build and run it without installing Node, pnpm, or ffmpeg locally.

git clone https://github.com/sleithdylan/chatterbox.git
cd chatterbox
cp .env.example .env
cp src/claude-reply/persona-data.example.ts src/claude-reply/persona-data.ts

Fill in .env — see the environment variables table above for what each one does — then fill in persona-data.ts with your own persona.

persona-data.ts is a build-time TypeScript import, not something read at runtime, so it has to exist before docker build runs. A missing file fails the image build itself, not container start. pnpm build runs scripts/generate-persona-data.mjs first, which writes this file from a PERSONA_DATA_JSON env var when it's missing. See Deploy on Railway below, for builds that start from a plain git clone with no local gitignored files.

docker compose up -d

This builds the image, starts the bot with .env loaded, persists data/consent.json across restarts and rebuilds via a named volume, and reports container health against GET /health. logs/ is deliberately left unmounted, so transcripts don't silently accumulate on your host. See docs/CONFIGURATION.md for the retention story.

Before inviting real users, read PRIVACY.md and adapt it for your own server. It's a template you post to your members, disclosing what's collected and how to request deletion. This project can't guarantee compliance on your behalf.

To rebuild after pulling changes: docker compose up -d --build. To check on the container: docker compose ps / docker compose logs -f.

Deploy on Railway

Deploy on Railway

Clicking the badge above deploys Chatterbox on Railway from a prebuilt template. See docs/RAILWAY.md for the full walkthrough: which env vars to set, setting your own persona via PERSONA_DATA_JSON, and attaching a volume for persisted consent data.

Commands

Command Purpose
npm run dev tsx watch server
npm run build tsc
npm start run dist/index.js
npm test Vitest
npm run lint ESLint
npm run type-check tsc --noEmit

Docs

Roadmap

No committed roadmap yet. This is a personal project that evolves as needs come up. Open an issue if you have ideas.

Contributing

See CONTRIBUTING.md for setup, coding standards, and the PR checklist.

License

MIT

Contact

Dylan Sleith (@sleithdylan)

About

Chatterbox joins a voice channel and answers back in a cloned voice - yours or any from Fish Audio's library, with Claude driving the conversation.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages