Skip to content

feat: Support Qoder credit usage #340

Description

@huluxiaohuowa

What

Add Qoder (qoder.com / qoder.com.cn) as a provider, so the notch can show big-model credit usage the same way it shows Kimi's or Kiro's.

Why

Qoder meters agent usage in credits with a monthly window, and the only place to watch it today is the account dashboard in a browser. A ring for it fits the "borrow the session that is already on this Mac" model the rest of the app uses.

Data source

GET https://qoder.com/api/v2/me/usages/big_model_credits
GET https://qoder.com.cn/api/v2/me/usages/big_model_credits

The endpoint is behind a WAF that wants a browser-shaped request, so the headers matter:

Header Value
Cookie the signed-in web session
Accept application/json, text/plain, */*
Accept-Language en-US,en;q=0.9
User-Agent a desktop Chrome UA
Origin / Referer the matching site, https://qoder.com.cn/account/usage
X-Requested-With XMLHttpRequest
Bx-V front-end build tag (2.5.35 as of now — likely the field that rots first)

401 / 403 mean the session expired, which maps onto the existing needsAuth path.

The payload uses both camelCase and snake_case keys depending on the response, so each key needs a fallback:

  • totalQuota / total_quota → quotaSummary / quota_summary → usedValue, limitValue, remainingValue, usagePercentage, unit
  • sharedQuota / shared_quota → same shape; present alongside the total on some plans, and the two should be summed
  • nextResetAt / next_reset_at → an ISO string, or epoch seconds, or epoch milliseconds

One ring: used / total credits, percentage, reset time from nextResetAt.

Where the credential comes from

This is the only real design question, and it is not the same as Cursor or Codex. I checked a Mac signed into Qoder IDE 0.4.1:

  • the IDE's own cookie jar holds only anti-bot and analytics cookies (cna, isg, tfstk, acw_tc, arms_uid) — no login session;
  • ~/.qoder-cn/.auth/ holds only machine_id;
  • there is no qoder CLI on PATH, and the in-app /usage panel is a rendered panel with no machine-readable output.

So there is nothing to read off disk. Two options, both of which already have a precedent in the app:

  1. Sign in inside Codenotch's own WKWebView (the DeepSeek / QianwenAI pattern) — one login, the session lives in the app's website data and the request carries it automatically. Preferred: no Full Disk Access, and it survives cookie rotation.
  2. Paste a Cookie: header in Settings (the slot MiniMax uses for a pasted key) — least code, but needs re-pasting when the session expires.

Either way a site switch (qoder.com vs qoder.com.cn) is needed, since the two are separate accounts and separate origins.

Prior art

CodexBar ships a Qoder provider (MIT) that reads the same endpoint via imported Chrome cookies — Sources/CodexBarCore/Providers/Qoder/ and docs/qoder.md are worth a look for the response-shape quirks above, including the sharedQuota merge and the three date encodings.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions