OpenRouter Balance
Monitor your OpenRouter account balance directly from Visual Studio Code — always visible in the status bar, with a full account management panel in the sidebar.
Features
- Live balance in the status bar — your balance is always visible on the right side of VS Code, updated every 30 seconds
- Multi-account support — add, switch, connect, and disconnect multiple OpenRouter accounts
- Secure key storage — Management Keys are encrypted at rest using the OS keychain (Windows Credential Manager / macOS Keychain / libsecret on Linux) via VS Code's built-in
SecretStorage API — keys are never stored in plain text
- Sidebar panel — detailed view showing balance, total credits, total usage, and account list
- Manual refresh — refresh on demand with the panel button or via the Command Palette
- Auto-refresh — balance updates automatically every 30 seconds in the background
Preview
Status Bar
The balance is displayed on the right side of the VS Code status bar in gold. Click it to switch accounts.
$(database) $77.22 $(person) My Account
Open the panel from the Activity Bar (the $ icon). It shows:
- Current balance in gold
- Total credits purchased and total usage
- Account list with connect / disconnect / remove actions
- "Add Account" form with secure key input
Getting Started
1. Get your OpenRouter Management Key
- Go to openrouter.ai and sign in
- Navigate to Settings → API Keys
- Create or copy a key with Management permissions
2. Install the extension
From the VS Code Marketplace:
Search for OpenRouter Balance in the Extensions panel (Ctrl+Shift+X).
From a VSIX file:
- Download the
.vsix file from the Releases page
- Open VS Code → Extensions (
Ctrl+Shift+X) → ··· menu → Install from VSIX...
- Select the downloaded file
3. Add your account
- Click the
$(plug) OR: No account item in the status bar, or
- Open the sidebar panel (Activity Bar
$ icon) → click + Add Account
- Enter a name for the account and paste your Management Key
- The extension connects automatically and shows your balance
Commands
Access these from the Command Palette (Ctrl+Shift+P):
| Command |
Description |
OpenRouter: Add Account |
Add a new account with a Management Key |
OpenRouter: Select Active Account |
Switch between saved accounts |
OpenRouter: Refresh Balance |
Force an immediate balance refresh |
OpenRouter: Open Panel |
Focus the sidebar panel |
Security
Your Management Keys are stored exclusively through VS Code's SecretStorage API, which delegates to the operating system's native credential store:
| OS |
Storage backend |
| Windows |
Windows Credential Manager |
| macOS |
Keychain |
| Linux |
libsecret / GNOME Keyring |
Keys are never written to disk in plain text, never logged, and never leave your machine.
Requirements
- Visual Studio Code 1.74.0 or higher
- An OpenRouter account with a Management Key
- Internet access to reach
openrouter.ai
Extension Settings
This extension does not add any settings.json entries. All configuration is done through the sidebar panel.
Known Limitations
- Balance is fetched from the
GET /api/v1/credits endpoint — it reflects the same data shown on the OpenRouter dashboard
- The auto-refresh interval is fixed at 30 seconds and is not currently configurable
Contributing
- Clone the repository
- Run
npm install
- Press
F5 in VS Code to launch the Extension Development Host
- Make your changes in
src/ — TypeScript compiles automatically via npm run watch
git clone https://github.com/<your-username>/vs-openrouter-balance.git
cd vs-openrouter-balance
npm install
code .
# Press F5 to run
To package a .vsix:
npm install -g @vscode/vsce
vsce package --allow-missing-repository
Changelog
0.1.0
- Initial release
- Status bar balance display with gold color
- Sidebar panel with account management
- Multi-account support with connect / disconnect
- Encrypted key storage via OS keychain
- Auto-refresh every 30 seconds
- Manual refresh button
License
MIT
This extension is not affiliated with or endorsed by OpenRouter.