Skip to content

feat: migrate MiniMax accounting and support CN endpoint - #233

Open
niheaven wants to merge 4 commits into
slkiser:mainfrom
niheaven:fix-minimax-cn
Open

feat: migrate MiniMax accounting and support CN endpoint#233
niheaven wants to merge 4 commits into
slkiser:mainfrom
niheaven:fix-minimax-cn

Conversation

@niheaven

Copy link
Copy Markdown

Summary

Migrates MiniMax Coding Plan (international) and MiniMax Coding Plan (CN) from the pre-structured-accounting envelope to the standard QuotaProviderResult shape, fixing the CN provider not rendering on /quota.

What was changed:

  • Bucket selection: Old plan takes the minimax-m* row (coding usage counts); new plan takes the general row (percent only). The video row is dropped — video-generation quota, irrelevant to an OpenCode coding-plan user.
  • Basis unit uniformity: For the old-plan minimax-m* row, the 3-fact basis now uses one count: "request" unit. Previously the CN entry used mixed units, which the framework rejected.
  • New-plan general row is basis-less: current_interval_total_count = 0, percent only — percentRemaining is already conveyed at row level.
  • Structured accounting: Each emitted entry carries AccountingMetadata (quota / remote_api / maintained / provider_reported) and semantic (metric.kind = "window", prominence = "primary"), matching the upstream Accounting Result Contract.
  • Labels: Coding PlanToken Plan.

Linked Issue

Output

New token plan account: API returns general + video; plugin keeps general, drops video.

/quota toast:

[MiniMax Token Plan] (CN)
Five-hour quota    2h  ████████████░░░░░░░░░░░  33% left
Weekly quota      10d  █████████░░░░░░░░░░░░░░░  46% left

Old token plan (coding plan) account: API returns minimax-m* (+ minimax-h* etc. for image/video); plugin keeps minimax-m* only.

/quota toast:

[MiniMax Token Plan] (CN)
Five-hour quota    1d  ████████████████████░░░  95% left
  Used: 70 / Limit: 4500
Weekly quota       2d  ███████████████░░░░░░░░░  59% left
  Used: 44895 / Limit: 45000

OpenCode Validation

  • Current production released OpenCode version tested: 1.18.21

Quality Checklist

  • I ran pnpm run typecheck
  • I ran pnpm run build
  • I ran pnpm test
  • This change is focused and avoids unrelated behavior changes
  • I updated or added tests when behavior changed
  • I updated docs when user-facing workflow, command, or config behavior changed
  • For provider changes, I followed Provider Changes, or this does not apply

@niheaven

niheaven commented Aug 27, 2026

Copy link
Copy Markdown
Author

Hmm, not to migrate MiniMax to new accounting format?

btw, it IS MiniMax Token Plan in OpenCode now.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: MiniMax Token Plan (CN) does not display quota

2 participants