Skip to content

feat(minimax): refresh Token Plan usage display#472

Open
FrankieeW wants to merge 17 commits into
robinebers:mainfrom
FrankieeW:feat/minimax-plugin-refresh
Open

feat(minimax): refresh Token Plan usage display#472
FrankieeW wants to merge 17 commits into
robinebers:mainfrom
FrankieeW:feat/minimax-plugin-refresh

Conversation

@FrankieeW
Copy link
Copy Markdown
Contributor

@FrankieeW FrankieeW commented May 18, 2026

Summary

  • Refresh MiniMax Token Plan usage parsing for both GLOBAL and CN responses.
  • Show Session usage as a 0-100 percentage, while companion TTS/image quotas stay as raw counts.
  • Detect M2.7, M2.7-highspeed, and minimax_m session buckets by name instead of bucket order.
  • Keep Speech Turbo, Music, and Multimodal buckets out of Session classification.
  • Update MiniMax docs and README wording for Token Plan naming and percent/count display semantics.

Test plan

  • npm test passes (1094 total, 60 MiniMax tests).
  • CI passed: Lint, Type-check, Build, Test.
  • Regression tests cover CN/GLOBAL bucket order, companion quotas, Speech Turbo, and Music/Multimodal false matches.

Related

Fixes PR #317 review comments.

npm run tauri dev

Screenshot 2026-05-24 at 01 04 37

Summary by cubic

Refreshes the MiniMax Token Plan usage: Session now displays as a percent (0–100), and companion TTS/image quotas show as counts with correct labels, windows, and ordering across GLOBAL and CN.

  • New Features

    • Show Session as percent; companion buckets (Text to Speech HD/Turbo, image-01/Image Generation) as counts with chars/images, rendered in both regions.
    • Pick the session bucket by name (M2.7/M2.7-highspeed/minimax_m), not position; prefer it even if a companion bucket appears first.
    • Infer plans from model-call limits and companion quotas; normalize to Starter/Plus/Max/Plus-High-Speed/Max-High-Speed/Ultra-High-Speed with a (CN)/(GLOBAL) suffix.
  • Bug Fixes

    • Apply session-bucket selection to CN and switch CN primary endpoint to https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains with fallbacks.
    • Prevent “Speech 2.8 Turbo” from being classified as HD; extend Turbo matching to space-separated names.
    • Tighten matchers to avoid misclassifying MiniMax-Music/Multimodal as Session.
    • Improve remains_time parsing (seconds vs ms), prefer ms when it matches end_time, respect 5h (Session) vs 24h (companion) windows, and handle overflow.
    • Rename “Coding Plan” to “Token Plan”; update README and provider docs.

Written for commit 86d3f67. Summary will update on new commits. Review in cubic

- Extend isSessionUsageName to match M2.7, M2.7-highspeed, minimax_m patterns
- Rename pickGlobalSessionRemainItem to pickSessionRemainItem for CN reuse
- Apply session bucket selection to both GLOBAL and CN paths (was GLOBAL only)
- Remove unused endpointSelection parameter from classifyUsageEntry
- Update inferRemainsMs comment to reflect actual behavior (not just 5h Coding Plan)
- Add regression test for CN path with companion bucket appearing first

Fixes PR robinebers#317 review comments on session bucket selection
Copilot AI review requested due to automatic review settings May 18, 2026 00:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Follow-up to PR #317 fixing MiniMax plugin issues: expanding the session-bucket detection patterns, applying session-bucket selection to CN (not just GLOBAL), correcting a stale comment in inferRemainsMs, and adding a CN regression test.

Changes:

  • Extend isSessionUsageName patterns (m2.7, minimax_m) and apply orderRemainItemsForDisplay in CN path.
  • Update inferRemainsMs to accept an explicit expectedWindowMs and drop the inaccurate "Coding Plan resets every 5h" assumption.
  • Add CN-region regression test asserting the session entry is picked when a companion bucket appears first.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Updates MiniMax bullet to mention model-calls and CN TTS/image buckets.
docs/providers/minimax.md Documents new model-calls display, six-tier plan naming, CN endpoint, and companion-resource lines.
plugins/minimax/plugin.json Adds detail-scope lines for TTS HD/Turbo, Image Generation, and image-01.
plugins/minimax/plugin.js Refactors parser to emit multiple resource entries, infer plans via companion quotas, normalize CN endpoint order, and parameterize inferRemainsMs window.
plugins/minimax/plugin.test.js Adds extensive new tests for CN/GLOBAL companion buckets, session ordering, plan inference, and remains_time handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
- [**Kiro**](docs/providers/kiro.md) / credits, bonus credits, overages
- [**Kimi Code**](docs/providers/kimi.md) / session, weekly
- [**MiniMax**](docs/providers/minimax.md) / coding plan session
- [**MiniMax**](docs/providers/minimax.md) / coding plan session model-calls, CN TTS/image buckets
@FrankieeW FrankieeW marked this pull request as draft May 18, 2026 00:41
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Re-trigger cubic

FrankieeW added 3 commits May 18, 2026 01:47
Update all references from CODING_PLAN_* constants to TOKEN_PLAN_*
for consistency with MiniMax API rename. Also normalize "MiniMax
Coding Plan" to "Token Plan" alongside existing "token plan" handling.
Add 8 new tests covering:
- M2.7 and M2.7-highspeed session bucket classification
- speech-hd and image-01 NOT classified as session
- session bucket selected by name pattern, not order (GLOBAL + CN)
- 5h token-plan window for session remains_time inference
- daily window for non-session companion buckets

Also fix isSessionUsageName to include highspeed pattern per official docs.
Session bucket now displays usage as percentage (used/limit*100)
with limit normalized to 100, matching plugins/claude and plugins/codex
style. Companion buckets (speech-hd, image-01) remain as counts.

Companion bucket assertions updated to use actual API values.
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Fix README:38 — "coding plan session model-calls" → "token plan model-calls"
  (resolves Copilot review comment discussion_r3255779189)
- Update quota table checked-on date to 2026-05-18 (re-verified vs official docs)

refactor(minimax): simplify normalizePlanName and tighten isSessionUsageName

- Merge duplicate coding/token-plan early-return into one condition
- Replace broad name.includes("coding") with name.includes("coding plan") |
  name.includes("token plan") to avoid future false matches on companion buckets

fix(minimax): const total in parseModelRemainEntry (was let)
@FrankieeW FrankieeW marked this pull request as ready for review May 18, 2026 09:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a42cece67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/minimax/plugin.js
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="plugins/minimax/plugin.js">

<violation number="1" location="plugins/minimax/plugin.js:107">
P2: GLOBAL plan inference no longer supports prompt-count totals, only exact model-call totals. If the GLOBAL API returns prompt-based `current_interval_total_count` values without an explicit `plan_name`, plan inference will silently fail.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread plugins/minimax/plugin.js
isSpeechHdUsageName matched anything containing "speech 2.8", so a payload
named "Speech 2.8 Turbo" (space-separated) would short-circuit to HD before
the turbo matcher ran. Its quota then polluted speechHdTotal and could flip
plan disambiguation (e.g. Plus -> Plus-High-Speed).

- Guard isSpeechHdUsageName with an early-return when name contains "turbo"
- Extend isSpeechTurboUsageName to also match space-separated form
  ("speech 2.8 turbo") in addition to the existing hyphen form
- Add regression test asserting label + plan tier remain correct
@validatedev validatedev requested a review from Copilot May 18, 2026 10:35
@validatedev
Copy link
Copy Markdown
Collaborator

@codex re-review please

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread docs/providers/minimax.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread docs/providers/minimax.md
FrankieeW added 2 commits May 18, 2026 13:56
…ping

Copilot autofix (fbda6a4) updated the Output contract to percent/limit:100
but left two earlier sections still describing Session as raw model-calls:

- Overview "Display note": now describes Session as percentage + companion
  buckets as raw counts (chars/images).
- Usage Mapping bullet: same alignment, clarifying that prompts conversion
  is intentionally skipped.
…l false matches

name.includes("minimax-m") would also match future non-text model names like
"MiniMax-Music-2.6" or "MiniMax-Multimodal", which would then be misclassified
as session — wrong label (Session vs Music), wrong window (5h vs daily, per
both official Token Plan docs), and wrong format (percent vs count).

Tighten the M-series patterns to require a digit after the M:
- name.includes("minimax-m") -> /minimax-m\d/
- name.includes("minimax_m") -> /minimax_m\d/

Existing "MiniMax-M*" wildcard tests still pass via the `index === 0` and
`pickSessionRemainItem` fallback paths. Add a regression test asserting
"MiniMax-Music-2.6" is rendered as its own non-session line.
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

validatedev
validatedev previously approved these changes May 19, 2026
Copy link
Copy Markdown
Collaborator

@validatedev validatedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't try the code, but the code looks good. Thanks!

@robinebers
Copy link
Copy Markdown
Owner

Generally open to merging this but would need much better PR name + description + screenshot/s

@FrankieeW FrankieeW changed the title fix(minimax): improve session bucket selection and CN path handling feat(minimax): refresh Token Plan usage display May 23, 2026
FrankieeW added 2 commits May 24, 2026 00:55
MiniMax can return coding-plan-vlm and coding-plan-search in arbitrary model_remains order. Keep the primary Session line first, then promote only those two coding-plan buckets directly below it while preserving all other resource rows in API order.

Constraint: User requested only Session, coding-plan-vlm, and coding-plan-search ordering; other rows must not be globally sorted.

Rejected: Sort all companion resources | would reorder unrelated TTS/image rows the user explicitly said not to manage.

Confidence: high

Scope-risk: narrow

Directive: Do not expand this ordering helper to unrelated MiniMax resources without a specific display requirement.

Tested: npm test -- plugins/minimax/plugin.test.js
@FrankieeW
Copy link
Copy Markdown
Contributor Author

Updated the PR title/description.

Also moved the two coding-related MiniMax buckets, coding-plan-vlm and coding-plan-search, directly under Session; other resource rows keep
their API order.

@FrankieeW FrankieeW requested a review from validatedev May 24, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants