Discord Bot
The ctok Discord bot exposes token estimation and prompt refinement as slash commands in any server.
Commands
| Command | Description |
|---|---|
/ctok check <prompt> | Estimate tokens, cost, and model recommendation |
/ctok refine <prompt> | Run the 7-pass refiner |
/ctok scan <directory> | Scan a server-side directory |
/ctok help | Show help |
/ctok check also accepts model, plan, and task_type options.
Self-host setup
1. Create a Discord application
- Go to discord.com/developers/applications → New Application
- Bot → Add Bot → copy the Token
- OAuth2 → URL Generator → select scopes
bot,applications.commands; permission:Send Messages,Use Slash Commands - Invite the bot to your server with the generated URL
2. Configure
cd apps/discordcp .env.example .env# Edit .env with DISCORD_TOKEN, DISCORD_CLIENT_ID3. Register slash commands
# Guild-scoped (instant, for development)DISCORD_GUILD_ID=your-guild-id pnpm deploy-commands
# Global (propagates in ~1 hour, for production)pnpm deploy-commands4. Run
# Developmentpnpm dev
# Dockerdocker build -t ctok-discord .docker run --env-file .env ctok-discordPrivacy
All analysis runs locally on the bot server. No prompt text is sent to ctok-cli.github.io/ctok or any external service.