Skip to content

Latest commit

 

History

History
80 lines (52 loc) · 2.06 KB

File metadata and controls

80 lines (52 loc) · 2.06 KB

CC-Switch Usage Query for Command Code

中文版 | English

A custom usage query script for CC-Switch to display Command Code's quota usage.

About

This script integrates with CC-Switch to show real-time usage of Command Code's billing windows.

Known Limitation

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.

Two Scripts

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.

Getting Started

Prerequisites

  • CC-Switch installed
  • Command Code API key (from ~/.commandcode/auth.json)

Installation

  1. Open CC-Switch
  2. Find your Command Code provider
  3. Click the Usage Query button (chart icon)
  4. Enable Enable Usage Query
  5. Select Custom template
  6. Paste the content from your chosen script
  7. Enter your Command Code API key
  8. Click Test Script to verify
  9. Save

Supported Plans

Plan Monthly Credits
GOAT 70
Pro 30
Max 150
Ultra 300
Teams Pro 40

License

MIT

Related