中文版 | English
A custom usage query script for CC-Switch to display Command Code's quota usage.
This script integrates with CC-Switch to show real-time usage of Command Code's billing windows.
CC-Switch's custom usage query only supports single API call. Command Code's billing data is split across two APIs:
/alpha/billing/credits- Returns 5h/7d window usage and remaining credits/alpha/billing/subscriptions- Returns plan type and subscription end date
This means you must choose one script based on what you want to display.
Option 1: Usage Details (usage-credits.js)
Shows 5-hour, weekly, and monthly usage percentages with reset countdown.
5h 19% · 7d 21% · 月 11%
5h reset in 1h46m · 7d reset in 5d12h · 余额 $62.54
Requires manual configuration: Edit monthlyCap to match your plan.
Option 2: Subscription Info (usage-subscription.js)
Shows plan type, credits per month, and subscription end date.
套餐: GOAT (70 credits/月)
到期: 30 天后 (2026-09-24)
Requires manual maintenance: Update planCredits mapping when new plans are added.
- CC-Switch installed
- Command Code API key (from
~/.commandcode/auth.json)
- Open CC-Switch
- Find your Command Code provider
- Click the Usage Query button (chart icon)
- Enable Enable Usage Query
- Select Custom template
- Paste the content from your chosen script
- Enter your Command Code API key
- Click Test Script to verify
- Save
| Plan | Monthly Credits |
|---|---|
| GOAT | 70 |
| Pro | 30 |
| Max | 150 |
| Ultra | 300 |
| Teams Pro | 40 |
MIT
- CC-Switch - The parent project
- Command Code - The AI coding assistant