Block distracting websites until you've hit your daily AI coding token goals.
TokenGate is a productivity tool that helps you stay focused by blocking distracting websites until you've done meaningful work with AI coding tools like Claude Code, OpenCode, and Codex.
TokenGate in action
┌─────────────────────────────────────────────────────────────────┐
│ Your Machine │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Claude Code │ │ OpenCode │ │ Codex │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ tokengate-server │ │
│ │ localhost:3847 │ │
│ │ │ │
│ │ Aggregates token usage from your AI coding tools │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ tokengate-extension │ │
│ │ │ │
│ │ Blocks distracting sites until you hit your token goal │ │
│ └───────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Works with both Bun and Node.js (18+):
# Using Bun (recommended)
bun add -g tokengate-server
# Using npm
npm install -g tokengate-server
# Or run without installing
bunx tokengate-server run
npx tokengate-server runThen install as a background service:
tokengate-server installThe server runs on http://localhost:3847 and will start automatically when you log in.
tokengate-server install # Install and start as background service
tokengate-server uninstall # Stop and remove service
tokengate-server start # Start the service
tokengate-server stop # Stop the service
tokengate-server status # Check if running, show PID
tokengate-server run # Run in foreground (for debugging)Download from Chrome Web Store (coming soon) or:
# Clone the repo
git clone https://github.com/0xqtpie/token-gate
cd token-gate- Open Chrome and go to
chrome://extensions - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked"
- Select the
packages/extensionfolder
- Click the TokenGate extension icon
- Go to Settings
- Add domains you want to block (defaults are provided)
- Set your daily token threshold
- Start coding!
A local HTTP server that aggregates token usage from multiple AI coding tools:
- Claude Code - via
ccusage - OpenCode - via
opencode stats - Codex - via
@ccusage/codex
A Chrome extension that:
- Blocks configured domains if you haven't hit your token goal
- Shows your progress with a clean overlay
- Provides quick access to your stats via popup
# Clone the repo
git clone https://github.com/0xqtpie/token-gate
cd token-gate
# Install dependencies (Bun recommended, npm works too)
bun install # or: npm install
# Start the server in dev mode
bun run dev # or: npm run dev
# Load the extension in Chrome (see above)| Option | Default | Description |
|---|---|---|
PORT |
3847 | Port to listen on |
CACHE_TTL |
30 | Seconds to cache usage data |
ADAPTERS |
all | Comma-separated adapter list |
- Blocked Domains - Sites to block (supports wildcards like
*.reddit.com) - Token Threshold - Minimum tokens required to unblock (default: 50,000)
- Server URL - TokenGate server address (default:
http://localhost:3847)
The extension comes pre-configured to block common distracting sites:
- x.com / twitter.com
- reddit.com
- youtube.com
- netflix.com
- instagram.com
- facebook.com
- No bypass - There's no way to bypass the block. You must hit your token goal.
- Offline behavior - If the server isn't running, sites are blocked by default (with a warning shown)
- 24-hour period - Token counting resets at midnight local time
MIT


