7b42e404f5f656d7bfb4aa5c7ddbcd1031264a86
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0ef2261681 |
minimax 0.2.2: the plan's windows and name from the console's own replies, within magpie's 20s (#705)
The usage card reads a plan's windows from the console's own token_plan/remains_percent (used and total per window, so a 150% week shows as "126 / 150 %"), with coding_plan/remains as the fallback (its share multiplied by weekly_boost_permille when that is over 1000). A general window at status 3 shows Unlimited; video windows show the console's counts. The plan is named by the console's current_subscribe_title, else by its tier: Plus, Max and Ultra as "Token Plan <tier>", the rest "M Plan <tier>". Time: magpie gives usage 20s. remains_percent and the title are asked together, each with a 5s timeout, and the fallback has 10s, so planQuota takes at most 15s, as 0.2.1 could. This answers the earlier review (30,030 ms with both console endpoints stalled). Review: both new paths are on the same host (site.platform) with the same bearer token and X-Group-Id coding_plan/remains already got; no new dependency or workflow change. 0.2.2 is free (main 0.2.1, npm 0.2.1, dist up to 0.2.1). Not mover-backed. Run at f383c5ea on mote (Bun 1.4.2): bun test packages/minimax 128 pass 0 fail; bun scripts/check.mjs exit 0. PR CI green. Broken by hand (usage.test.mjs): console timeout at 15s, or no timeout on remains_percent, turns the stall test red (15,001 ms); asking the title after the windows turns it red (10,006 ms); ignoring the console's used figure turns the two console-reply tests red. Not tried: MiniMax's real endpoints (no account here); the author ran one China-site account with a 150% week. |
||
|
|
d119f4f789 |
minimax: a site without the membership API shows its credits and no plan (#666)
hetingyi's side note on #666: on agent.minimax.io both /matrix/api/v1/user/get_user_extra_info and /matrix/api/v1/commerce/get_membership_info answer 404 "404 page not found", even through a proxy. membership() fell back from the first to the second and threw the second's "membership: HTTP 404", so the international account's whole usage card was that error, its credits ledger never shown. Both answering 404 is now "no membership API here": no plan is said (not Free, which nothing read), and the card goes on with the credits ledger as before. Any other failure of either call is still the card's error, and a refused sign-in still throws. Run at this commit on mote: bun test packages/minimax 88 pass, 0 fail. The new usage test (the reporter's 404 body) is red against origin/main's index.mjs. Not tried: a real global account; whether such an account's M Plan lives elsewhere on the international site is unknown. |
||
|
|
07e643018e |
minimax 0.1.6: the credits show how much of them is used, from MiniMax's credit details (#393)
moxuanchen's card showed MiniMax's credits as a bare balance ("1200
credits"), with no share or bar. The membership answer has only what is
left. MiniMax's own web client (agent.minimaxi.com, prod-web-sh-0.1.230)
lists every batch in Settings → Usage → Credit details (积分明细): GET
/minimax-cloud/api/v1/credit/details with page_number, page_size 20 and
include_expired, answering { details, total_count }; each batch has
credit_type 1 purchased / 2 check-in, granted/consumed/remaining_amount as
decimal strings (commas allowed, a remaining below 0 read as 0) and
expire_at_ms. That is the reporter's endpoint, checked in the client's
own bundle (the npm CLI @minimax-ai/code 0.6.12 doesn't have it).
usage now reads every page of it (signed, to the account host, as the
check-in's minimax-cloud calls go) and adds a Credits window of the
batches not yet expired: used = granted - remaining, amount/limit/unit
"credits", and runsOutAt/runsOut for the soonest batch with credits left.
Beside an M Plan it is aside. A ledger that can't be read whole (an error,
a list shorter than total_count, an amount that isn't one) adds no window
and leaves the balance as before: a part of it would tell a wrong share.
Run: bun test in packages/minimax (nonet, fake hosts): 62 pass 0 fail. On
the old index.mjs the three new tests fail. bun scripts/check.mjs:
minimax ok.
Not tried: a real MiniMax account (no vendor credentials used), so
whether the account host answers this path signed as the check-in is
signed is not seen; if it refuses, the card is as it was.
|
||
|
|
7c859cc532 |
minimax 0.1.0: MiniMax Code (mcode) accounts' credits and M Plan, China (minimax-code) and international (minimax-code-global), with MiniMax Code's own device sign-in (Magic_zero on Discord)
A new package, @magpie-community/opencode-minimax-auth, written from MiniMax Code 0.6.2's bundle. Sign-in: MiniMax Code's OAuth device flow, the same one mcode uses (account.minimax.cn / account.minimax.io, client mcode-public, scope agent.default, audience agent-backend, PKCE S256). It also handles MiniMax's own variant, where there is no device_code, the user_code is polled for, and expired_in may be an at-ms. The account is named from MiniMax's signed /v1/api/user/info. mcode's ~/.minimax sign-in is never read or written. Each account is a sign-in of its own, so magpie can hold several. Refresh: two minutes before the token ends, or once on a 401. One refresh runs per account (keyed by the refresh token it spends), and its result answers for the old token for a minute, so a late reader doesn't spend a rotated token twice. Only invalid_grant with HTTP 400 signs the account out (signIn: expired); any other failure keeps it and uses the token in hand while it lasts. Chats: Anthropic messages at <agent>/mavis/api/v1/llm/v1/messages, carrying: - Authorization: Bearer <token> - x-api-key sk-xxx (mcode's placeholder) - User-Agent MiniMaxAgent - X-Mavis-Agent-Id main - X-Mavis-Timezone-Offset - X-Mavis-Session-Id, from chat.headers' sessionID (otherwise a fixed id per run) A 402, 403 or 429 whose body says credits or quota ran out goes on as a 429 "usage limit reached". Models: the live config at GET /mavis/api/v1/models?region=&buildEnv=prod (asked again without auth on a 401/403), with mcode's built-in four as the fallback: MiniMax-M3.1-Flash-Preview, MiniMax-M3, MiniMax-M2.7 and MiniMax-M2.7-highspeed. Variants follow what mcode sends: adaptive thinking at an effort (output_config.effort), and none to turn thinking off. Usage: mcode's signed account API: user info, the type-0 workspace from get_user_extra_info, then get_membership_info. The card shows credits left (op_credit_summary / opcredit_balance), Free or "M Plan <tier>" with its end, and, for an M Plan, coding_plan/remains with X-Group-Id. That is read as magpie's readMiniMaxPlan reads it. There is no check-in. Tests: fakes only. nonet.mjs is imported first, so only 127.0.0.1 can be reached. They cover: - sign-in, the variant, refused, and other errors - refresh, a three-way race plus a late stale reader, per-account refreshes, invalid_grant, other failures, and 401 then refresh then retry - request headers and chat.headers - credits running out going on as a 429 - the live list, the retry without auth, and the fallback (the given object back) - signing, against fixed vectors and the bundle's formula - usage parsing (readMiniMaxPlan's own fixture), Free, M Plan, and a refused account bun test packages/minimax (27 pass) and bun scripts/check.mjs pass. End to end through magpie: origin/main b0486663, built with -tags nogui in a worktree since removed, under env -i with a sandbox HOME, a fake upstream on 127.0.0.1:47811, and a copy of the package with its hosts pointed there: - plugin add - plugin login minimax-code: the device flow and the account named; a second login of the same account merged into one - the live list: 2 models - provider test minimax-code: the chat went out with the headers above - quota: M Plan Plus, 321.5 credits, 5 hours and 7 days windows - an expired token refreshed and saved No request was made to MiniMax. |