Slack Bot
The ctok Slack bot lets your whole team estimate Claude token usage directly from Slack.
Commands
| Command | Description |
|---|---|
/ctok check <prompt> | Estimate tokens, cost, and get a model recommendation |
/ctok refine <prompt> | Run the refiner - shows tokens saved |
/ctok scan <path> | Scan a server-side directory |
/ctok help | Show help |
You can also @mention the bot: @ctok check <prompt>.
Options
Append to any command:
| Flag | Example | Description |
|---|---|---|
--model | --model haiku-4-5 | Override model |
--plan | --plan max5x | Override plan |
--task | --task bug-fix | Task type hint |
Self-host setup
1. Create a Slack app
- Go to api.slack.com/apps → Create New App → From scratch
- OAuth & Permissions - add scopes:
commands,app_mentions:read,chat:write - Slash Commands - create
/ctokpointing athttps://your-host/slack/events - Event Subscriptions - enable and subscribe to
app_mention - Install the app and copy the Bot User OAuth Token
2. Configure
cd apps/slackcp .env.example .env# Edit .env with your SLACK_BOT_TOKEN, SLACK_SIGNING_SECRETFor Socket Mode (no public URL):
- Generate an App-Level Token with
connections:write - Set
SLACK_APP_TOKENin.env
3. Run
# Developmentpnpm dev
# Dockerdocker build -t ctok-slack .docker run -p 3000:3000 --env-file .env ctok-slackPrivacy
All analysis runs locally on the bot server. No prompt text is sent to ctok-cli.github.io/ctok or any external service.