feat(minimax): Add multi-service usage support#605
feat(minimax): Add multi-service usage support#605XWind18 wants to merge 1 commit intosteipete:mainfrom
Conversation
Implementation: - Add MiniMaxServiceUsage struct for multi-service tracking - Support Text Generation, TTS, Image, Video, and Music services - Parse API responses with service type mapping - Implement window type detection (5 hours, Today) - Add localization support (English/Chinese) - Three-window UI mapping (primary/secondary/tertiary) - Backward compatibility for legacy single-service mode Bug Fixes: - Fix minimaxAuthMode() call signature - Remove duplicate MiniMaxProviderSettings definition - Remove unused variables in MiniMaxUsageFetcher Verification: ✓ No compiler warnings ✓ Follows Swift Testing framework conventions ✓ Complies with docs/provider.md architecture
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c41b88c3fd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| func minimaxSettingsSnapshot() -> ProviderSettingsSnapshot.MiniMaxProviderSettings { | ||
| ProviderSettingsSnapshot.MiniMaxProviderSettings( | ||
| cookieSource: self.minimaxSnapshotCookieSource(tokenOverride: tokenOverride), | ||
| manualCookieHeader: self.minimaxSnapshotCookieHeader(tokenOverride: tokenOverride), | ||
| cookieSource: self.minimaxCookieSource, | ||
| manualCookieHeader: self.minimaxCookieHeader, | ||
| apiRegion: self.minimaxAPIRegion) |
There was a problem hiding this comment.
Preserve token-account overrides in MiniMax settings snapshot
UsageStore.refreshTokenAccounts relies on ProviderRegistry.makeSettingsSnapshot(..., tokenOverride:) to fetch each account with its own credentials, but this snapshot now always returns minimaxCookieSource and minimaxCookieHeader from global settings. Because MiniMax token accounts use cookie-header injection (not env injection), per-account refreshes will all use the same cookie (and may stay on .auto), so account switching and multi-account menu snapshots can no longer show distinct account usage.
Useful? React with 👍 / 👎.
| let payload = try MiniMaxUsageParser.decodePayload(data: data) | ||
| self.logCodingPlanStatus(payload: payload) | ||
| return try MiniMaxUsageParser.parseCodingPlanRemains(payload: payload, now: now) | ||
| let snapshot = try MiniMaxUsageParser.parseCodingPlanRemains(payload: payload, now: now) |
There was a problem hiding this comment.
Parse multi-service JSON in remains fallback path
The remains-web fallback still decodes JSON with decodePayload(data:) (legacy model_remains schema) before parsing, while multi-service support was added only in parseCodingPlanRemains(data:). If this endpoint returns the new data.services response, decoding fails immediately and the fallback fetch errors out instead of producing usage. This branch should go through the data-based parser (or try multi-service decode first) to keep fallback compatible.
Useful? React with 👍 / 👎.
Summary
Add comprehensive multi-service usage support for MiniMax Provider.
What's New
Multi-Service Support
Features
Testing
27 tests across 5 suites (existing test infrastructure):
Screenshots
Menu View
Shows three services with usage stats:

Settings View
Provider configuration and region selection:

Verification