[Feature]: M Plan — expose the plan tier and per-capability model coverage so clients can show only what the key can call

Ouverte
#312 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
34/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript

Piste de recherche

Start with the M Plan quota response from GET /v1/token_plan/remains and compare it with the Token Plan behavior described in #173 and #205. The issue asks for API changes spanning quota, model discovery, and media error responses, but leaves the response design open. First establish which API surface this repository can change; done means clients can identify the key's plan coverage and distinguish an uncovered model from quota exhaustion.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Summary

GET /v1/token_plan/remains reports quota for M Plan subscriptions, but it does not report
which plan the key is on or which models that plan covers. M Plan has three tiers with
different model coverage (Go / Explore / Build — https://platform.minimax.io/docs/m-plan/intro),
and that distinction is invisible to any API client. The only place the plan appears anywhere in
the API is inside a rejected request's error text.

This was solvable with the previous Token Plan: the quota response carried one bucket per
capability, and a model your plan did not bundle came back with current_interval_total_count: 0
and current_*_status: 3, which clients rendered as "not in plan" (see #173 and the fix in #205).
M Plan replaced those per-capability buckets with a single general bucket that carries
percentages only, so the "not in plan" signal no longer exists in the response.

The practical consequence: a client cannot know that MiniMax-H3 (video) and
MiniMax-H3-Image-Highspeed are not included on the Go tier, so it lists them, the user picks
one, and the request is rejected with usage limit exceeded ... (0/0 used) — which reads like a
broken quota counter rather than "this model is not in your plan".

What we observe today

With an M Plan key (sk-cp-…):

$ curl -s https://api.minimax.io/v1/token_plan/remains -H "Authorization: Bearer $MINIMAX_API_KEY"
{
  "model_remains": [
    {
      "model_name": "general",
      "current_interval_total_count": ...,
      "current_interval_usage_count": ...,
      "current_interval_remaining_percent": 99,
      "current_weekly_total_count": ...,
      "current_weekly_usage_count": ...,
      "current_weekly_remaining_percent": 56,
      "current_interval_status": 1,
      "current_weekly_status": 1,
      ...
    }
  ]
}

One bucket named general. Percentages only. No tier, no per-capability buckets, no indication of
which models are callable. (current_*_status is 1 — the "normal" value — so it cannot be used
to distinguish "included" from "not included" the way it could under Token Plan.)

$ curl -s https://api.minimax.io/v1/models -H "Authorization: Bearer $MINIMAX_API_KEY"

returns the platform's text catalogue — 9 models. It is not account-aware: it lists
MiniMax-M2, MiniMax-M2.1, MiniMax-M2.5, MiniMax-M2.7 (not included in M Plan) and omits
MiniMax-H3-Image and MiniMax-H3 (both included). It is therefore actively misleading for a
plan key, and it is not the list of models the key can call.

The media endpoints do not report plan membership either. They report the endpoint's static model
list:

$ curl -s -X POST https://api.minimax.io/v1/images/generations \
    -H "Authorization: Bearer $MINIMAX_API_KEY" -H "Content-Type: application/json" \
    -d '{"model":"image-01","prompt":"a red cube","n":1}'
{
  "type": "error",
  "error": {
    "type": "bad_request_error",
    "message": "invalid params, unknown model \"image-01\", must be one of MiniMax-H3-Image, MiniMax-H3-Image-Highspeed (2013)",
    "http_code": "400"
  }
}

The "must be one of …" list is the endpoint's static list, not the key's plan. For a Go subscriber
it is wrong, and "unknown model" is the wrong diagnosis — the model is known, it is just not in
their plan.

The rejection path is the only place the plan is named at all:

HTTP 200
{"base_resp":{"status_code":2056,
  "status_msg":"usage limit exceeded, weekly usage limit reached for Token Plan Plus (0/0 used)"}}

Note that MiniMax answers HTTP 200 with base_resp.status_code set, so clients have to parse
the body to see the failure.

Why this matters
  • Third-party clients cannot hide what they cannot call. OpenCode already implements this for
    the ChatGPT and GitHub Copilot subscriptions — it fetches the account's model list up front and
    shows exactly that. The same approach for M Plan would need an endpoint that returns the plan's
    model list. This is the same gap as https://github.com/MiniMax-AI/MiniMax-M2/issues/60, but the
    blocker there was the existence of /v1/models; here the blocker is that the list is not
    plan-scoped.
  • The error message is misleading. usage limit exceeded ... (0/0 used) reads as a quota
    problem. For a model that is not in the subscriber's tier it is an entitlement problem, and the
    two need different remedies (wait vs. upgrade).
  • Quota UIs cannot show what is left. mmx quota show can only render the buckets the API
    returns, so on M Plan it shows a single general row. See also #92 and #176.
What we are asking for

In priority order — the first one is the one we would use immediately, the others follow from it.

  1. Report the plan tier in the quota response. For example an added field on the
    model_remains entry, or a sibling field on the response:

    { "plan": "explore", "plan_tier": "explore", "model_name": "general", ... }
    

    With the tier, a client can map it to the published coverage table
    (https://platform.minimax.io/docs/m-plan/intro) and offer exactly the right models.

  2. Restore a per-capability signal in the quota response. Even if it is only the two buckets
    that exist today, a video bucket that is absent (or flagged) would tell a client that video
    generation is not covered, without needing the tier name. Restoring the Token Plan shape —
    one entry per capability, with available: false / status for models the plan does not
    bundle — would also let the CLI's existing "not in plan" rendering work unchanged (see #173,
    #205).

  3. Make GET /v1/models account-aware, or add a plan-scoped variant. Either
    GET /v1/models returns the models the key can call, or GET /v1/models?plan=1 does. Today
    the response is the platform catalogue and is misleading for plan keys.

  4. Distinguish "unknown model" from "not in your plan" in the media endpoints, and make the
    allowed-model list plan-scoped when the caller is on a plan. A client that gets
    not included in your plan can act on it; a client that gets unknown model cannot.

What we can do on the client side meanwhile

We are happy to contribute the client-side half in this repository:

  • map status_code 2056 to a clear "this model is not included in your plan — upgrade at
    " message, instead of surfacing the raw usage limit exceeded ... (0/0 used) text
    (there is currently no handling for 2056 in src/errors/api.ts);
  • refresh the plan hints in src/errors/api.ts, which still describe the previous plan
    ("image-01 requires the Plus plan or above", "Video models (Hailuo-2.3 / 2.3-Fast) require the
    Max plan or above") and link to /subscribe/token-plan, whereas M Plan lives at
    https://www.minimax.io/m-plan with tiers Go / Explore / Build and the models
    MiniMax-H3-Image, MiniMax-H3-Image-Highspeed, MiniMax-H3;
  • a preflight check in mmx video generate / mmx image generate that fails fast with
    "not included in your plan" when the quota response says so (this was suggested as a bonus in
    #173 and never implemented).

Say the word and we will open a PR for that part.

Related issues
Reproduction
KEY=sk-cp-...

curl -s https://api.minimax.io/v1/token_plan/remains \
  -H "Authorization: Bearer $KEY" | jq

curl -s https://api.minimax.io/v1/models \
  -H "Authorization: Bearer $KEY" | jq '.data[].id'

curl -s -X POST https://api.minimax.io/v1/images/generations \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"model":"image-01","prompt":"a red cube","n":1}' | jq
Langage dominant
TypeScript
Étoiles
2.2k
Forks
200
Merge moyen
1 j 5 h
PR mergées (30 j)
3

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de MiniMax-AI/cli

Toutes les issues de MiniMax-AI/cli

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.