Skip to content

quota text output interprets *_usage_count as used, but API appears to return remaining/available #53

@1khuang

Description

@1khuang

Body:

  ## Summary

  `mmx quota --output text` appears to display incorrect remaining quota values.

  The raw JSON from `mmx quota --output json` suggests that:

  - `current_interval_usage_count`
  - `current_weekly_usage_count`

  are actually **remaining/available counts**, not **used counts**.

  But the text dashboard subtracts them from `*_total_count`, which makes the displayed quota reversed.

  ## Environment

  - mmx-cli version: 1.0.5
  - region: cn
  - base URL: `https://api.minimaxi.com`

  ## Reproduction

Run:

mmx quota --non-interactive --output json --verbose
mmx quota --non-interactive --output text

Example raw JSON:

{
  "model_remains": [
    {
      "current_interval_total_count": 1500,
      "current_interval_usage_count": 1497,
      "model_name": "MiniMax-M*",
      "current_weekly_total_count": 0,
      "current_weekly_usage_count": 0
    },
    {
      "current_interval_total_count": 50,
      "current_interval_usage_count": 49,
      "model_name": "image-01",
      "current_weekly_total_count": 350,
      "current_weekly_usage_count": 349
    }
  ],
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

Text output shows:

MiniMax-M* 3 / 1,500
image-01 1 / 50

Why this looks wrong

If current_interval_usage_count means "used count", then the text output is correct.

But based on the actual quota behavior and the returned values, these fields appear to mean remaining count instead:

  • 1497 / 1500 seems to mean 1497 remaining, not 1497 used
  • 49 / 50 seems to mean 49 remaining, not 49 used
  • similarly for weekly values like 349 / 350

If so, the text dashboard is reversing the meaning.

Suspected source

In dist/mmx.mjs, the text renderer computes:

let { current_interval_usage_count: f, current_interval_total_count: g } = w,
M = Math.max(0, g - f)

and similarly for weekly counts.

So the dashboard assumes *_usage_count means "used", then calculates remaining as total - usage.

If the API is actually returning remaining/available counts, this should not subtract again.

Expected behavior

One of these should be fixed for consistency:

  1. Rename API fields to reflect that they are remaining counts, or
  2. Keep field names as-is but change the text dashboard logic so it does not subtract them again

Actual behavior

  • --output json appears to expose the raw values
  • --output text displays reversed remaining quota

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