How nazmussayad/mysubs works
mysubs is a CLI that aggregates subscription usage across AI providers. The main flow loads account configuration, discovers local accounts, selects requested accounts, fetches or reuses usage, then renders terminal output or JSON. Provider-specific acquisition, secret handling, caching, and presentation are distinct stages. The README documents several provider integrations and behaviors beyond the sampled excerpts; those branches are represented at their documented module boundaries.
Main entry points: app.ts Usage orchestration · providers/index.ts Provider registry · copilot/index.ts Copilot integration · codex/index.ts Codex integration
Components 21
CLI workflow
- CLI commands
src/index.ts - Usage orchestration
src/app.ts
Config and secrets
- Config loading
src/core/config.ts - Secret resolution
src/lib/secret.ts - Keyring access
src/lib/keyring.ts
Provider integrations
- Provider registry
src/providers/index.ts - Codex integration
src/providers/codex/index.ts - Claude integration
src/providers/claude/index.ts - Antigravity integration
src/providers/antigravity/index.ts - Copilot integration
src/providers/copilot/index.ts - OpenRouter integration
src/providers/openrouter/index.ts - OpenCode integration
src/providers/opencode/index.ts
Usage results
- Usage cache
src/utils/cache.ts - Usage renderer
src/core/render.ts
Other components
- CLI user
- Local account files
- Provider APIs
- Antigravity CLI
- GitHub CLI
- OS keyring
- Terminal or JSON
Connections 34
- CLI user → CLI commands: runs commands
- CLI commands → Usage orchestration: runs usage
- CLI commands → Keyring access: manages secrets
- Usage orchestration → Config loading: loads settings
- Config loading → Local account files: reads account settings
- Usage orchestration → Provider registry: selects handlers
- Provider registry → Codex integration: registers handler
- Provider registry → Claude integration: registers handler
- Provider registry → Antigravity integration: registers handler
- Provider registry → Copilot integration: registers handler
- Provider registry → OpenRouter integration: registers handler
- Provider registry → OpenCode integration: registers handler
- Usage orchestration → Codex integration: detects or fetches
- Usage orchestration → Claude integration: detects or fetches
- Usage orchestration → Antigravity integration: detects or fetches
- Usage orchestration → Copilot integration: detects or fetches
- Usage orchestration → OpenRouter integration: detects or fetches
- Usage orchestration → OpenCode integration: detects or fetches
- Usage orchestration → Usage cache: reads and writes
- Usage orchestration → Usage renderer: renders results
- Usage renderer → Terminal or JSON: formats output
- Codex integration → Provider APIs: fetches usage
- Claude integration → Provider APIs: fetches usage
- Antigravity integration → Antigravity CLI: reads quota
- Copilot integration → GitHub CLI: reads token
- Copilot integration → Provider APIs: fetches usage
- OpenRouter integration → Provider APIs: fetches usage
- OpenCode integration → Provider APIs: fetches usage
- Copilot integration → Secret resolution: resolves token
- OpenRouter integration → Secret resolution: resolves API key
- OpenCode integration → Secret resolution: resolves credentials
- Secret resolution → Keyring access: reads key
- Keyring access → OS keyring: accesses secret
- Codex integration → Local account files: reads and updates auth