Skip to content

Qwen Cloud Team Token Plan support (GetSeatSubscriptionSummary) #3711

Description

@tavioto

Summary

CodexBar currently appears to support the Qwen Cloud Individual Token Plan, but not the newer Qwen Cloud Team Token Plan available directly at:

https://home.qwencloud.com/analytics/token-plan/team

I am using CodexBar 0.60.4 on macOS with an active Qwen Cloud Team subscription.

The Qwen Cloud provider successfully imports my Qwen Cloud browser session, but fetching usage fails with:

Failed to parse Qwen Cloud usage: Missing token plan data

This seems to happen because the Team plan uses a different API from the Individual plan.

Current plan

The subscription is a Qwen Cloud Team International plan.

Example plan information shown by the Qwen Cloud UI:

  • Plan: Standard
  • Seats: 1 / 1
  • Credits: 25,000
  • Remaining credits: ~6,374
  • Product code: sfm_tokenplanteams_dp_intl
  • Credits reset at the subscription cycle boundary

This is not an Alibaba Model Studio Team subscription. It is a Team subscription hosted directly on home.qwencloud.com.

Steps to reproduce

  1. Sign in to a Qwen Cloud Team account at:

    https://home.qwencloud.com/

  2. Open:

    https://home.qwencloud.com/analytics/token-plan/team

  3. In CodexBar:

    • Enable Qwen Cloud
    • Leave Cookie source on Auto
    • Refresh usage
  4. CodexBar successfully finds the browser session, but usage parsing fails with:

Failed to parse Qwen Cloud usage: Missing token plan data

API used by the Qwen Cloud Team dashboard

The Team dashboard retrieves the subscription/usage information using:

POST https://home.qwencloud.com/data/api.json?product=BssOpenAPI-V3&action=GetSeatSubscriptionSummary

Request Content-Type:

application/x-www-form-urlencoded

Query parameters:

product=BssOpenAPI-V3
action=GetSeatSubscriptionSummary

The form body sent by the official Qwen Cloud UI looks like this:

product=BssOpenAPI-V3
action=GetSeatSubscriptionSummary
sec_token=<redacted>
region=cn-hangzhou
language=zh-CN
params={"productCode":"sfm_tokenplanteams_dp_intl","Nbid":"<redacted>"}

Cookies from the existing Qwen Cloud browser session are also sent with the request.

Note that although the subscription is the International Team product:

sfm_tokenplanteams_dp_intl

the current Qwen Cloud frontend sends:

region=cn-hangzhou
language=zh-CN

for this request.

Sanitized response

The API returns a response like:

{
  "code": "200",
  "data": {
    "RequestId": "<redacted>",
    "Message": "Successful!",
    "Data": {
      "Uid": "<redacted>",
      "EndTime": 1790251200000,
      "ProductCode": "sfm_tokenplanteams_dp_intl",
      "StartTime": 1784894400000,
      "RemainingDays": "6",
      "SubscriptionGroupList": [
        {
          "SubscriptionAssignedNumber": 1,
          "EquityList": [
            {
              "EquityCode": "credit_value",
              "TotalValue": "25000.00000000",
              "EquityType": "CREDITS",
              "SurplusValue": "6373.93922996"
            }
          ],
          "SpecType": "standard",
          "SubscriptionTotalNumber": 1,
          "NextCycleFlushTime": 1790251200000
        }
      ]
    },
    "Code": "Success",
    "Success": true
  },
  "httpStatusCode": "200",
  "successResponse": true
}

Useful field mapping

Most of the data CodexBar needs appears to already be available directly in this response.

Plan / tier

SubscriptionGroupList[].SpecType

Example:

standard

Total credits

Find:

EquityList[].EquityCode == "credit_value"

Then use:

TotalValue

Example:

25000.00000000

Remaining credits

SurplusValue

Example:

6373.93922996

Used credits

Can be calculated as:

TotalValue - SurplusValue

For the sample above:

25000 - 6373.93922996 = 18626.06077004

Usage percentage

used / total

For the sample above:

~74.50%

Reset / next cycle

NextCycleFlushTime

This appears to be Unix time in milliseconds.

Subscription period

StartTime
EndTime
RemainingDays

Seats

SubscriptionAssignedNumber
SubscriptionTotalNumber

Product

ProductCode

Example:

sfm_tokenplanteams_dp_intl

Possible implementation direction

CodexBar already seems to have most of the infrastructure necessary for this.

The existing Qwen Cloud provider already handles:

  • home.qwencloud.com
  • Qwen Cloud browser cookies
  • One Console authentication / sec_token
  • Authenticated form-encoded requests
  • Usage snapshots

The current Qwen Cloud implementation appears to target the Individual Token Plan APIs under:

tokenplan/personal/api/v2/*

The Team plan could potentially be detected/fetched separately using:

product=BssOpenAPI-V3
action=GetSeatSubscriptionSummary

There also appears to be similar infrastructure already in AlibabaTokenPlanUsageFetcher, which uses:

BssOpenAPI-V3
GetSubscriptionSummary

So GetSeatSubscriptionSummary for Qwen Cloud Team may be reusable within the existing One Console / BSS request infrastructure rather than requiring a completely new provider.

Conceptually:

Qwen Cloud
├── Individual Token Plan
│   └── existing personal/api/v2/* flow
│
└── Team Token Plan
    └── BssOpenAPI-V3 / GetSeatSubscriptionSummary

The Team parser could produce a usage snapshot from:

SubscriptionGroupList
  -> SpecType
  -> EquityList[EquityCode == "credit_value"]
  -> TotalValue
  -> SurplusValue
  -> NextCycleFlushTime

Expected behavior

When the Qwen Cloud account has a Team Token Plan, CodexBar should detect it and display something equivalent to:

Qwen Cloud
Standard Team

18,626 / 25,000 credits used
74.5%

6,374 credits remaining

Resets: <NextCycleFlushTime>
Seats: 1 / 1

The exact UI does not matter to me; the important part is being able to see the Team credit pool and reset information in CodexBar.

Actual behavior

CodexBar currently imports the Qwen Cloud session successfully but fails while parsing usage:

Failed to parse Qwen Cloud usage: Missing token plan data

The Alibaba Token Plan provider also does not solve this, because this subscription exists on:

home.qwencloud.com

rather than the Alibaba Model Studio / Bailian console.

Environment

CodexBar: 0.60.4
OS: macOS
Qwen product: Qwen Cloud Team Token Plan
Plan tier: Standard
Product code: sfm_tokenplanteams_dp_intl
Dashboard: https://home.qwencloud.com/analytics/token-plan/team

I can provide additional sanitized request/response samples or test the implementation against a live Team account if useful.

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

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions