DEV Community

ops-sd
ops-sd

Posted on Originally published at github.com

Stop Wasting Expiring AI Coding Subscriptions: Zero-Proxy, Zero-Token Quota Window Routing

I keep running into the same annoying problem with AI coding subscriptions: I have more than one subscription CLI available, and I accidentally burn the one that resets in 6 days while another one resets tonight and its unused quota disappears.

Most existing routers (LiteLLM, OpenRouter, local API proxies) sit in the HTTP path and assume API keys. I didn't want a proxy daemon, didn't want to intercept prompts, and definitely didn't want to spend tokens just to check whether a CLI is rate-limited.

So I extracted a tiny, zero-dependency Python CLI called model-tui (single file, stdlib only, MIT):

  • Zero proxy: Checks quota metadata once, then execs your native interactive TUI (claude, etc.) directly.
  • Zero LLM tokens: Uses native OAuth usage / local 5-hour limit cooldown detection for Claude Code, plus a simple probe_cmd JSON contract for any other CLI or profile.
  • Earlier-reset routing: When a model has 2+ channels configured, it probes them concurrently, caches the route decision (default 5m TTL, auto-invalidated on reset), and launches whichever available channel resets earliest (weekly window first, 5-hour window tie-breaker, with automatic failover if one is exhausted).
  • Interactive-only guard: Rejects -p/--print flags so subscription CLIs stay interactive.

Example ~/.config/model-tui.json channel probe contract:

{
  "remaining": 0.65,
  "five_hour_reset": "2026-11-27T14:00:00Z",
  "weekly_reset": "2026-12-01T00:00:00Z",
  "available": true
}
Enter fullscreen mode Exit fullscreen mode

Dry-run check:

model-tui --model opus --check
Enter fullscreen mode Exit fullscreen mode

Right now Claude Code has a built-in zero-token probe and anything else plugs in via probe_cmd.

Question for folks juggling multiple coding subscriptions: which other subscription CLIs (Codex CLI, Gemini CLI, Cursor CLI, Copilot CLI, etc.) would you want built-in zero-token probes for?

Repo (MIT, stdlib-only Python 3.10+): https://github.com/sdailabs/modeltui

Top comments (0)