Skip to content

Fix MiniMax CN Token Plan web fetch with token-plan endpoints (#254) - #262

Merged
Finesssee merged 2 commits into
mainfrom
fix/minimax-token-plan-254
Aug 6, 2026
Merged

Fix MiniMax CN Token Plan web fetch with token-plan endpoints (#254)#262
Finesssee merged 2 commits into
mainfrom
fix/minimax-token-plan-254

Conversation

@Finesssee

@Finesssee Finesssee commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

A MiniMax China-mainland Token Plan user (TokenPlanPlus annual membership) has no coding-plan subscription, so the legacy endpoint GET /v1/api/openplatform/coding_plan/remains answers HTTP 200 with base_resp.status_code=2062 / status_msg="no active token plan subscription". 0.47.0 surfaced that as a fatal fetch error.

Upstream (steipete/CodexBar) has zero support for the token-plan endpoints — this is implemented from the reporter's live evidence.

Fix (rust/src/providers/minimax only)

  • coding_plan::is_token_plan_without_coding_plan — matches ProviderError::Other messages containing "token plan" (case-insensitive), i.e. exactly the 2062 path through the existing remains parser.
  • fetch_with_cookie wraps the coding-plan call: on that error it falls back to a new token-plan path; auth rejection stays AuthRequired; when all token-plan endpoints are empty the original coding-plan error propagates unchanged.
  • New token-plan path (fetch_token_plan_with_cookie), all on the www host with the fetch_remains_once request envelope:
    • GET /v1/api/openplatform/charge/token_plan/usage — 401/403 → AuthRequired, other non-2xx/parse failures swallowed; body parsed with the shared parse_coding_plan_value (charge-API family shares the model_remains/services schema).
    • GET /backend/account/token_plan/usage_summary — lenient parse of total_days/active_days/total_token_consumed (numbers or numeric strings, root or "data") → informational "Token Plan" extra window (123,456 tokens · 5 / 30 days active) or summary-only snapshot.
    • GET /backend/account/token_plan_credit — plan title (current_subscribe_title/…/current_combo_card.title/title) → login method.
  • Same best-effort billing enrichment as the coding-plan path afterwards. Cookies never logged.

Fixes #254

Tests

  • cargo test --manifest-path rust/Cargo.toml minimax — 36 passed, 0 failed (8 new: predicate incl. the reporter's 2062 fixture, summary/title parsing, charge-usage fixture → 5h primary at 2% + unlimited weekly end-to-end, full/summary-only/row-less/all-absent assembly, original-error fallback).
  • Full cargo test --manifest-path rust/Cargo.toml — 926 passed, 0 failed.
  • cargo clippy --workspace --all-targets -- -D warnings — clean. cargo fmt --all applied.

View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.

@Finesssee
Finesssee merged commit d180b18 into main Aug 6, 2026
2 checks passed
@Finesssee
Finesssee deleted the fix/minimax-token-plan-254 branch August 6, 2026 05:15
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.

MiniMax CN active Token Plan not detected in v0.47.0 (legacy remains endpoint returns 2062)

1 participant