Recorded v1.0.0 engineering showcase · 3 AI coding CLIs · LiteLLM v1.105.1 · 2026
Stop runaway AI coding loops.
I built a team policy console, background spend watcher, and in-terminal request tool on top of open-source LiteLLM so every engineer gets a clear weekly AI allowance and forgotten night or weekend loops pause automatically.
When a small engineering team shares one raw API key across Claude Code, OpenCode, and Codex, a single stuck retry loop on Friday evening can quietly burn the month’s budget. Here, each engineer works on a virtual key with an 80% soft warning, a 5% grace buffer, and one-command top-up requests from the terminal.
Static showcase of recorded v1.0.0 runs. No live model calls or cookies run in your browser.
Real example: hitting a cap
Same terminal session-
1. Lena hits her weekly cap HTTP 422 · USD 21.00
Lena’s weekly allowance is USD 20.00 with a 5% grace buffer. At USD 21.00, the gateway pauses her key and returns a recovery command.
-
2. She asks for USD 5.00 from her CLI MCP tool or CLI
Instead of chasing a manager in chat, she requests a top-up directly from her coding session:
npx allowance request --amount 5 --reason "Finish release test suite" -
3. Priya approves USD 3.00 until Friday +USD 3.00 approved
Manager Priya adjusts the grant to USD 3.00 in the console. Lena’s next prompt in the same terminal succeeds immediately, and the audit log records both numbers.
Swipe or use the arrow keys to change images. Select an image to enlarge it.
What I built
Open-source LiteLLM v1.105.1 enforces per-key hard budgets, but its built-in per-user management screens and approval workflows sit behind the enterprise license. I built the missing team layer using only open-source endpoints.
TypeScript Node.js 24 LiteLLM MCP PostgreSQL Playwright
-
Manager & member web console
Server-rendered console on port
18080with Overview, Member detail, Requests queue, Usage breakdown, Audit log, and CSV/JSON export. -
Background spend & off-hours watcher
Polls spend every
30seconds, fires80%soft warnings, blocks keys outside working hours once off-hours caps cross, and expires temporary grants. -
In-terminal MCP & CLI request tools
Engineers check remaining allowance (
allowance_status), ask for more budget (allowance_request_more), or check approval status without leaving their editor. -
OpenCode unattended loop guard
Local plugin pauses a session after
30minutes (40calls at one call every45seconds) without a fresh human message.
Ten-step product walkthrough
Follow how engineers Lena, Omar, and Jonas interact with team manager Priya across ten recorded screens. Filter by scenario, swipe the screenshot carousel, or click any screen to zoom and pan.
1. Lena works inside budget
Lena runs her normal AI coding CLI against the team gateway on port 14000. Because her weekly spend (USD 7.20) is well below the 80% warning mark, the gateway forwards the request with zero extra prompts.
In the manager overview, Lena shows a healthy green status bar at 36% of her USD 20.00 weekly allowance.
Measured results & honest limits
Tested in three ways: a deterministic weekend runaway-loop simulation, a live 3-CLI verification against deepseek-v4.1-flash, and a 4-agent team test that exposed a real streaming cost-metering bug.
| Protection configuration | Stop trigger | Calls | Spend (USD) | Saved (USD) |
|---|---|---|---|---|
| No limits | None · ran until Monday 08:00 | 5,000 | 144.97 | 0.00 |
| Member budget only | Weekly hard limit (USD 20.00 + 5% grace = USD 21.00) | 740 | 21.03 | 123.94 |
| Off-hours cap only | Off-hours cap (USD 5.00 after 19:00 reached at USD 5.01) | 289 | 8.03 | 136.94 |
| Budget + off-hours + unattended rule | Unattended pause after 30 minutes without user input | 40 | 0.55 | 144.42 |
Live verification across 3 CLIs
18 / 18 steps passed
Each real coding CLI ran the same 6-step live check against deepseek-v4.1-flash with a test budget of USD 0.05: allowed call, blocked model (HTTP 403), budget/key stop (HTTP 422/401), MCP extra-budget request, manager approval in the web console, and a working retry.
Total live-verification gateway spend across all 3 CLIs and the plugin check: USD 0.170827 (01 Nov 2026, using elevated test token pricing so a USD 0.05 budget is reached in two calls).
Real 4-agent team test
5 / 7 probes passedFour AI coding workers and a team manager ran through the live gateway across two teams: Crew (6 accounts: 5 workers + 1 leader, 11 requests, 69 audit events) and Night (3 accounts: 2 workers + 1 leader, 0 requests). Total gateway spend was USD 0.082512 across 369 spend rows (including USD 0.022452 from scripted feature probes).
Hit her USD 0.05 test budget, requested USD 0.20, received a partial USD 0.10 approval, and continued working.
Blocked from an unapproved model (HTTP 403), submitted a model access request, and received a manager denial with a note.
Exercised MCP status checks and request cancellation; all 48 of her streamed CLI calls recorded USD 0 cost.
Ran off-hours probes; non-streaming probe calls metered USD 0.002574 while streamed CLI calls recorded USD 0.
How the architecture works
Budget enforcement happens on the team gateway rather than trusting the developer’s laptop, while local CLI helpers and MCP tools keep requests fast inside the terminal.
Claude Code, OpenCode, or Codex points at the gateway on 127.0.0.1:14000 using a member virtual key stored with 0600 permissions. The local MCP server exposes allowance_status and allowance_request_more, and the OpenCode plugin pauses unattended loops after 30 minutes.
Open-source LiteLLM v1.105.1 and PostgreSQL (127.0.0.1:15432) enforce hard budgets and model allowlists on every call. The Team AI Allowance service (127.0.0.1:18080) runs a 30-second watcher for 80% soft alerts, off-hours caps, and grant expiry.
Managers review requests in the web console, approve full or partial top-ups with an expiration time, or deny with a written reason. Alerts deliver to local SMTP (127.0.0.1:18025) and webhook (127.0.0.1:18090) endpoints.
Why local edits cannot bypass a cap
Even if an engineer disables the local OpenCode plugin or edits local config files, the virtual key’s hard budget and model allowlist live on the LiteLLM gateway and Postgres database.
30-second watcher polling
Hard budget caps block inline on the next gateway call, while off-hours caps and 80% soft warnings evaluate on the 30-second watcher tick.
Single-host Docker stack
Designed for a small engineering team running on a single Linux/macOS host with loopback-bound ports rather than multi-region federation.
Open-source LiteLLM boundary
Uses only open-source LiteLLM proxy key routes and Postgres spend tables, with zero dependency on enterprise-licensed modules.
Local setup & verification
The stack runs on Node.js 24 and Docker Compose, binding all five services to 127.0.0.1 by default: console on 18080, LiteLLM gateway on 14000, PostgreSQL on 15432, mail catcher on 18025, and webhook catcher on 18090.
Start the stack and seed demo data
git clone https://github.com/sabers13/team-ai-allowance.git
cd team-ai-allowance
make setup
make demo
# Open http://127.0.0.1:18080
Member CLI & verification targets
node src/cli/index.ts status
node src/cli/index.ts request more-budget --amount 5 --reason "Finish tests"
make release-check
make e2e
make sim
LiteLLM boundary & 9 limits
Team AI Allowance uses only open-source LiteLLM proxy routes (/key/generate, /key/update, /key/info, /key/block, /key/unblock) and its Postgres spend tables. Nine operational boundaries are documented:
| Boundary | Behavior in v1.0.0 | Operational impact |
|---|---|---|
| 1. Streaming USD 0 cost rows | 317 of 369 team-test rows logged USD 0 across 12,896,452 streamed tokens | Upstream OpenAI-compatible streams must emit usage chunks or use token-count fallback pricing |
| 2. Watcher poll interval | Off-hours caps and 80% warnings evaluate every 30 seconds | A burst of calls inside one 30-second window can briefly overshoot an off-hours threshold |
| 3. Unattended plugin scope | Client-side inactivity pause ships as an OpenCode plugin | Claude Code and Codex rely on gateway hard budgets and off-hours caps unless wrapped |
| 4. Client-side plugin trust | The unattended pause runs on the member workstation | Treated as a convenience brake; hard financial enforcement stays on the server |
| 5. Shared team timezone | Working hours are configured per team (e.g. Europe/Berlin) | Distributed teams across continents should group members into regional teams |
| 6. Passphrase session auth | Console uses role passphrases and HTTP-only session cookies | Built for internal VPN/SSH access rather than public internet exposure without SSO |
| 7. In-flight call completion | Budget checks happen before a model call starts | A large single call that starts at 99% budget completes into the 5% grace buffer |
| 8. Single-node Postgres | State lives in one local PostgreSQL container | Requires standard volume backups for production durability |
| 9. Custom model price table | Non-standard model IDs need explicit input/output token rates in LiteLLM config | Unmapped models default to zero cost unless added to the gateway model list |
Project code and documentation are released under the MIT License (Copyright 2026 Saber Sojudi). Self-hosted typography and icons are used under their respective open licences: IBM Plex Sans (SIL OFL 1.1), Inter (SIL OFL 1.1), and Feather Icons (MIT).