Skip to content

[Feature] Add Command Code (commandcode.ai) provider with live 5h/weekly/monthly windows #20

Closed

Description

@Luna161

Add Command Code (commandcode.ai) provider with live quota windows

TL;DR: Add a new provider that surfaces the live 5-hour and weekly usage windows plus the monthly USD credit balance for Command Code subscriptions (Go / GOAT / Pro / Max / Team) via the same Provider API key the user already uses for /provider/v1/models.

Why

Command Code is a frontier coding-agent subscription with usage-windowed plans (Go $1/$10 credit, GOAT $10/$70, Pro $20/$80, Max 10× $100/$150, Max 20× $200/$300, Team Pro $40/$40 — see docs/resources/pricing-limits#usage-limits). Users on every paid plan above Go today have no read-only way to surface their live quota in their DankBar without opening the web console — same UX gap that motivated this project for Codex, GLM, Kimi, and 9Router.

Proposed data source

Three endpoints under https://api.commandcode.ai, all authenticated with the Provider API key via Authorization: Bearer <key>. The key is the same one users already create in Studio > API Keys, the same one that hits /provider/v1/models today. No cookies, no dashboard scraping, no auth-file reads from ~/.commandcode/auth.json.

Endpoint Purpose Stability
GET /alpha/billing/credits live 5h + weekly windows, monthly USD balance ⚠️ /alpha/ namespace — no documented versioned contract, can change without notice
GET /alpha/billing/subscriptions planId + currentPeriodEnd ⚠️ same caveat
GET /provider/v1/models already-public fallback for key validity ✅ documented at commandcode.ai/docs/provider

Honest coverage level

Quota (primary: 5h remaining %, secondary: weekly remaining %, credits: monthly USD balance). Falls back to Auth / configured when /alpha/billing/credits is unreachable, with a clear note in the card that quota windows are unavailable.

Why this differs from the CodexBar precedent (issue #2629)

CodexBar maintainers declined a direct Command Code API source in steipete/CodexBar#2629, primarily because:

  1. Credential-boundary policy — CodexBar refused to read ~/.commandcode/auth.json. AiOverviewControl already follows the user-supplied-key pattern (Z.ai, MiniMax, GLM, etc.); users bring their own COMMAND_CODE_API_KEY.
  2. Alpha-namespace risk — acknowledged. The adapter will degrade to a documented /provider/v1/models check on alpha failures and never claim a quota number it couldn't fetch. The card label will read "Quota endpoint unavailable" so the failure is honest, not silent.
  3. Owner-mediated work — Command Code has no CLI usage-output command (verified against the official docs index at commandcode.ai/docs). The Provider API key is the only read-only channel.

Live verification

I have already verified the response shape against a live GOAT account:

// GET /alpha/billing/credits
{
  "credits": {
    "belowThreshold": false,
    "monthlyCredits": 50.2490682944,
    "purchasedCredits": 0,
    "freeCredits": 0
  },
  "windowLimits": {
    "limited": true,
    "exceeded": null,
    "fiveHour": { "used": 0.33, "cap": 14, "exceeded": false, "resetAt": 1787604583458 },
    "weekly":     { "used": 19.75, "cap": 35, "exceeded": false, "resetAt": 1787837142731 }
  }
}

resetAt is a Unix-ms timestamp that maps cleanly onto the existing resetsAt schema used by fetch_zai_native. used/cap yields usedPercent directly. monthlyCredits becomes credits.remaining in USD.

Implementation outline

Mirrors the existing fetch_zai_native structure:

  • providers/get-commandcode-usage → dispatches via the existing get-provider-wrapper
  • fetch_commandcode_native reads COMMAND_CODE_API_KEY, tries /alpha/billing/credits, falls back to /provider/v1/models for auth-only on alpha failure
  • Widget/Settings/docs updates identical in shape to the MiniMax entry, with primary = 5h, secondary = weekly, credits = monthly USD balance, console URL = https://commandcode.ai/billing?plan=…
  • Theme color: needs maintainer input; defaulting to Theme.primary if no objection
  • Plan-name detection via planId: individual-goat → "GOAT", individual-pro → "Pro", individual-go → "Go", individual-max-10x/individual-max-20x → "Max 10×"/"Max 20×", team-pro → "Team Pro", provider → "Provider API"

Questions for maintainers

  1. Comfortable with the /alpha/ dependency if labeled "experimental" in the docs?
  2. Preferred theme color? (Suggest Theme.primary to match the neutral brand palette.)
  3. Settings label — Command Code (display) vs commandcode (provider id) — confirm consistent with existing casing?

Happy to iterate on the PR per feedback before merge. The PR will be ready alongside this issue so you can review end-to-end.

Activity

  1. bernardopg commented on Aug 25, 2026

    @bernardopg
    Owner

    @Luna161 — thank you for one of the best-researched feature requests this repo has received! 🙌 The live-verified payload, the full plan matrix, and especially the CodexBar #2629 precedent analysis made triage trivial. Answers to your three questions:

    1. /alpha/ dependency — yes, accepted. It fits our honest-coverage philosophy precisely because you designed the degradation path up front: documented /provider/v1/models fallback, an explicit "quota endpoint unavailable" label, and never a fabricated number. The experimental caveat in docs/providers.md is exactly the right call.
    2. Theme color — Theme.primary approved. Neutral palette, consistent with the GLM/Z.ai family (Theme.primary there too).
    3. Casing — confirmed. Command Code (display) / commandcode (provider id) matches our conventions (Z.ai/zai, MiniMax/minimax), and cmd/cmdcode as dispatch aliases follow the canonical|alias1|alias2 pattern nicely.

    One design note for the record: surfacing quota via the user-supplied COMMAND_CODE_API_KEY — and never touching ~/.commandcode/auth.json — is exactly the credential boundary we enforce, so the CodexBar concerns don't transfer here.

    Detailed review feedback is over on PR #21 — a few blockers to work through (including one juicy find: a literal Bearer *** that slipped into the request headers 🙂), but nothing that diminishes the excellent groundwork. Thanks again! 🚀

  2. bernardopg commented on Aug 25, 2026

    @bernardopg
    Owner

    Shipped! 🎉 PR #21 is merged and Command Code is live in v1.13.0 — 5h/weekly windows, monthly USD credits, official logomark and all.

    @Luna161 — thank you again for the exceptional contribution: the live-verified payload, the honest-degradation design, and the CodexBar precedent analysis made this a pleasure to review and ship. You're now in the contributors list. 🙌

    Anyone on a Command Code plan: set COMMAND_CODE_API_KEY (Studio → API Keys) and the card lights up. Feedback welcome as always!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions