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

未關閉
#312 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
34/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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
主要語言
TypeScript
星號
2.2k
分支
200
平均合併
1 天 5 小時
30 天內合併 PR
3

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

MiniMax-AI/cli 的其他 Issue

查看 MiniMax-AI/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。