If you use Claude Code on more than one computer, you have probably run into this. The laptop, the desktop and that always-on box running agents all draw from the same 5-hour and weekly allowance. When you hit the limit, there's no way to tell which machine used it, and no way to stop the unattended one from quietly running everything on Opus.
DeviceGate is my answer to that. It's a small, self-hosted gateway you run on your own LAN. Your Claude login stays on one machine, and every other PC gets its own revocable key, its own model access, its own limits and its own usage history. It's free and open source (MIT): github.com/jkugsiya/DeviceGate.

A quick tour: status page, adding a device, per-device limits and the usage explorer (sample data).
How it works
DeviceGate sits in front of TeamClaude, which signs in to your Claude account once, through Anthropic's own OAuth flow, and listens only on 127.0.0.1. DeviceGate runs next to it on the same machine and is the only thing the rest of your LAN talks to.

Each PC holds its own device token. Only the gateway machine holds the Claude login.
For every request, DeviceGate checks the device token, applies that device's model allow-list and limits, forwards the request with the one credential it holds, and streams the response back unchanged. As the stream passes through, it reads the token counts out of it and records them. Prompts and responses are never stored.
Claude Code itself needs no patches. The setup script only sets ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in ~/.claude/settings.json.
Adding a machine takes about two minutes
In the admin, click Add device and give it a name. You get a one-time setup code and the exact command to run on that PC, for macOS, Linux or Windows. Codes work once and expire after 15 minutes. After that, plain claude just works on that machine.

The setup screen after adding a device.
Different rules for different machines
Each device gets its own model allow-list and its own limits: daily and weekly token and request quotas, requests per minute, and concurrent requests. Models match by family prefix, so a new Opus or Sonnet version is covered without any changes. When a device hits a limit, Claude Code shows a readable error with the reset time instead of failing in some confusing way.

The always-on agent box: Haiku and Sonnet only, 800 requests a day, 20 a minute, 2 at a time.
Seeing where the capacity went
The usage explorer records input, output and cache tokens for every request, plus what those tokens would have cost at Anthropic's API rates. Your subscription already covers the traffic, so nothing is billed. The number is there to compare devices and spot the one burning through your quota.

Usage by day, with filters for device, model and outcome. Every filter lives in the URL, so any view is a link you can bookmark.

Breakdown by model and by device.
The overview puts the numbers that matter on one screen, including your remaining 5-hour and weekly capacity, read straight from Anthropic's own response headers.
There's also a public status page at / that needs no login. It's handy to keep open on a spare screen, and it only shows device names and totals.

The status page: capacity left, totals, and usage over time.
Small on purpose
- One Next.js process and one SQLite file. No Redis, no Postgres.
- Docker Compose if you prefer containers.
- An audit log of every admin action and sign-in attempt, with before/after diffs.
- Device tokens and setup codes are stored only as hashes.
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 your Pro or Max credentials, so please don't hand a device token to anyone else. If several people need Claude Code, each should use their own subscription, or a Team/Enterprise plan or API keys. DeviceGate is an independent project and isn't affiliated with or endorsed by Anthropic.
Try it
You need an always-on Linux or macOS machine on your LAN, Node.js 20.9+, Bun and a Pro or Max plan. The README walks through the whole setup. The short version, with Docker:
# on the gateway machine, with TeamClaude signed in and running
git clone https://github.com/jkugsiya/DeviceGate.git && cd DeviceGate
bun run init-env
docker compose up -d --build
docker compose exec -it devicegate bun run admin create you@example.com "Your Name"
Then open http://<gateway-ip>:3000/admin, add your first device, and run the command it gives you on that PC.
The code is on GitHub: github.com/jkugsiya/DeviceGate. Issues and pull requests are welcome. There are a few good first issues open, from a Docker health check to a dark mode. If you try it, I'd love to hear how it goes.
Originally published on my Substack.

Top comments (0)