DEV Community

pradip
pradip

Posted on

How I turned my Claude subscription into a multi-tenant API for my team

I have a Claude Max subscription and I kept running into the same problem. I wanted a couple of teammates, and a few of my own scripts, to use it. But I did not want to hand out my login, and I really did not want one person's runaway loop to burn through everyone's limits for the day.

I could not find anything that solved this the way I wanted, so I built it. It is called Aegis, it is open source (Apache 2.0), and this post is a quick tour of what it does and how it works.

The core idea

The Claude Agent SDK bundles the Claude Code CLI, and that CLI can run off your subscription login instead of an API key. Aegis wraps that and puts a proper multi tenant HTTP API in front of it, plus an admin dashboard to manage everything.

So one subscription becomes a shared, controlled platform:

  • No API key. You sign in once with your Claude login and the runtime uses it for everything. Aegis strips ANTHROPIC_API_KEY from the environment so it is always the subscription, never metered API billing.
  • Per tenant API keys. Create tenants, hand out separate keys, and set each key's own rate limit and daily cost cap. Usage is tracked per key, so you can see exactly who used what.
  • Sessions. Stateful chats, each with an isolated workspace and file upload and download, plus a live streaming chat UI.
  • Objectives. Give it a goal and a success rubric and it loops. It does the work, a separate evaluator grades the result, and it repeats until it passes or hits a budget.
  • MCP servers. Register HTTP or stdio MCP servers and attach them to agents.
  • OpenAI compatible endpoint. A drop in POST /v1/chat/completions so existing tools and SDKs just work.
  • Live plan usage. The dashboard shows your actual Claude plan limits, the 5 hour session window and the weekly caps, right next to your per tenant token usage.

The stack

FastAPI and SQLAlchemy, SQLite by default, Alembic for migrations, packaged with uv. Around 220 tests. Layered structure so it is easy to read and extend.

Running it

Docker:

git clone https://github.com/dhpradeep/aegis && cd aegis
cp .env.example .env
docker compose up -d --build
Enter fullscreen mode Exit fullscreen mode

Or locally with uv:

uv sync
uv run claude auth login
uv run aegis
Enter fullscreen mode Exit fullscreen mode

Then open the dashboard at http://localhost:8000/admin, sign in to Claude from the System page, and mint an API key.

The honest caveat

This drives Claude through a CLI logged into a personal or Team subscription, not an API key. Anthropic's terms discourage reselling or provisioning subscription access to other people, so I built and use this for personal, internal, or trusted team use of my own subscription. If you want to run it as a commercial service, you switch the runtime to API key billing, which is a config change and not a rewrite.

It is open source and I want help

The repo has screenshots, a three command quick start, and a contributing guide. I would love issues, PRs, and especially a second pair of eyes on the security model.

Repo: https://github.com/dhpradeep/aegis

If you try it and something breaks, tell me and I will fix it.

Top comments (0)