CC Gateway: Control Claude Code Telemetry
CC Gateway: Take Control of Claude Code Telemetry
Claude Code aggressively collects telemetry - 640+ event types across 3 channels, 40+ environment fingerprints, device IDs, emails, OS details, and hardware specs reported every 5 seconds. CC Gateway is a TypeScript reverse proxy that sits between your Claude Code clients and Anthropic's API, normalizing everything to a single canonical identity.
Why You Need This
- Multi-machine privacy: Use the same 'device' identity across laptops, servers, VMs
- Zero leaks: Environment variables, process metrics, system prompts - all rewritten
- Defense in depth: Env vars + Clash blocking + proxy rewriting
- No browser logins: Centralized OAuth token management
Quick Deployment (5 minutes)
git clone https://github.com/motiful/cc-gateway.git
cd cc-gateway
npm install
npm run generate-identity
npm run generate-token my-laptop
cp config.example.yaml config.yaml
Extract OAuth token from Keychain:
bash scripts/extract-token.sh
Run with Docker:
docker-compose up -d
curl http://localhost:8443/_health
Client Setup (Any Machine)
export ANTHROPIC_BASE_URL="https://your-gateway:8443"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export CLAUDE_CODE_OAUTH_TOKEN="gateway-managed"
export ANTHROPIC_CUSTOM_HEADERS="Proxy-Authorization: Bearer YOUR_TOKEN"
claude
No login prompts. Traffic routes automatically.
What Gets Protected
| Layer | What | Action |
|---|---|---|
| Identity | device_id, email, user_id | β Canonical values |
| Environment | 40+ fields (OS, Node, shell, CI) | β Single profile |
| Hardware | RAM, heap, CPU | β Normalized metrics |
| Prompts | block, paths | β Sanitized |
| Leaks | baseUrl, gateway fields | β Stripped |
Network Safety Net (Clash Rules)
rules:
- DOMAIN,gateway.your-domain.com,DIRECT
- DOMAIN-SUFFIX,anthropic.com,REJECT
- DOMAIN-SUFFIX,claude.com,REJECT
- DOMAIN-SUFFIX,datadoghq.com,REJECT
Blocks direct connections even if Claude Code updates bypass env vars.
Architecture
ββββββββββββββ ANTHROPIC_BASE_URL ββββββββββββββββββββ
β Claude Code β βββββββββββββββββββββββ β CC Gateway β
β (any machine)β β β’ OAuth refresh β
ββββββββββββββ β β’ Identity rewriteβ
β β’ Prompt sanitize β
ββββββββββββ¬ββββββββββ
β
Single canonical
identity β Anthropic
Production Ready
β MIT License β Docker Compose β Health checks β Token verification endpoint β 277 GitHub stars β TypeScript + automated tests
Alpha warning: Test with non-primary accounts first. Monitor Clash logs for new endpoints.
Deploy CC Gateway and reclaim your privacy from AI telemetry tracking.