DGDeviceGate

Self-hosted gateway for Claude Code · MIT

One Claude login.
A separate key for every machine.

Your subscription stays on one box on your LAN. Every other PC connects with its own revocable device token, its own model allow-list and limits, and its own usage history. Now you can see which machine used up your weekly limit.

Workstation opussonnethaiku 412K / 1M tokens today
MacBook Pro opussonnethaiku 610K / 1M tokens today
ThinkPad opussonnethaiku 90K / 500K tokens today
Home server opussonnethaiku 1.3M / 3M tokens today
Your Claude subscription one login, never leaves this machine 5-hour Weekly
home-server $ claude --model opus 403 MODEL_NOT_ALLOWED: claude-opus-5-5 is not allowed for this device. Switch models with /model.

What you set for each machine

Nothing is patched on the PC. The setup script only points Claude Code at the gateway, so plain claude keeps working.

Key
A device token you can revoke from the admin at any time. Tokens and setup codes are stored only as hashes.
Models
An allow-list by family: Opus on the workstation, only Haiku on the automation box. New model versions are covered automatically.
Limits
Daily and weekly request, token and dollar-spend quotas, requests per minute and concurrent requests. Over the limit, Claude Code shows a readable error with the reset time.
Usage
Input, output and cache tokens for every request, plus what they would have cost at API rates, by device, model and day.
Capacity
The 5-hour and weekly utilization left on each of your Claude accounts, and across all of them.
Audit
Every admin action and sign-in attempt, with before and after values.
The home server's device page: Haiku and Sonnet allowed, Opus not, and a 3M tokens-per-day limit

See where your capacity went

Break usage down by device, model and day. Every filter lives in the URL, so any view can be bookmarked.

Setup

You need an always-on Linux or macOS machine with Node.js 20.9+, Bun and a Claude Pro or Max plan.

  1. Sign in once, on the gateway machine

    TeamClaude holds your Claude login through Anthropic's own OAuth flow and listens only on loopback.

    bun add -g @karpeleslab/teamclaude
    teamclaude login
    teamclaude server --headless
  2. Start DeviceGate next to it

    One Next.js process and one SQLite file. No Redis, Postgres or Docker.

    git clone https://github.com/jkugsiya/DeviceGate.git
    cd DeviceGate && bun install
    bun run init-env
    bun run admin create you@example.com "Your Name"
    bun run build && bun run start
  3. Add a device and run its one-liner

    The admin shows a single-use code that expires in 15 minutes. PowerShell works too.

    curl -fsSL http://192.168.1.50:3000/setup.sh | sh -s -- K7QM-2XPA

Services, updates and configuration are in the README.

For your own machines only

DeviceGate is built for one person and their own devices. Anthropic's Consumer Terms don't allow routing other people's requests through a Free, Pro or Max plan, so never give a device token to anyone else. Prompts and responses are never stored, and the gateway is meant to stay on your LAN or behind a VPN.