feat(plugin): add MiniMax Token Plan OAuth provider#27460
Open
kapelame wants to merge 1 commit into
Open
Conversation
Adds an internal plugin that registers OAuth + API key auth methods
on the existing minimax-coding-plan and minimax-cn-coding-plan
providers. Both regions get a "Sign in with MiniMax" entry that
runs OAuth 2.0 Device Code Flow (RFC 8628) with PKCE against
account.{minimax.io,minimaxi.com}, plus a "Paste Token Plan key"
fallback for manual API-key entry.
The plugin handles token refresh proactively (5-min buffer before
expiry) and persists the new refresh_token to disk before updating
in-memory state, so a crash mid-refresh can't lose a rotated
refresh_token. Refresh requests retry on transient 5xx/network
errors but bail immediately on 4xx (the refresh_token is genuinely
invalid).
Promotes the four MiniMax providers in the TUI provider picker so
they appear together as a contiguous block, instead of being
scattered among other "non-popular" providers in the catalog tail.
Companion catalog rename PR at sst/models.dev rebrands the two
Token Plan entries from "Coding Plan" to "Token Plan" in display
labels.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #27011: feat(opencode): add MiniMax OAuth device code flow plugin This appears to be a related or possibly duplicate PR that also adds MiniMax OAuth support with Device Code Flow. Since both PRs target the same provider (MiniMax) and implement OAuth authentication, they may be addressing the same feature or there may be overlapping work. Recommendation: Check PR #27011 to see if it's already implementing this functionality or if it covers the same scope. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
N/A — new provider integration
Type of change
What does this PR do?
Adds an internal plugin that registers OAuth + API key auth methods on the existing
minimax-coding-planandminimax-cn-coding-planproviders (already inmodels.dev). Both regions get:account.{minimax.io,minimaxi.com}The plugin handles refresh proactively (5-min buffer before expiry) and persists the new refresh_token to disk before updating in-memory state — a crash mid-refresh can't lose a rotated refresh_token. Refresh requests retry on transient 5xx/network errors but bail immediately on 4xx (the refresh_token is genuinely invalid).
Also promotes the four MiniMax providers in the TUI provider picker (
PROVIDER_PRIORITY) so they appear together as a contiguous block, instead of being scattered among other "non-popular" providers in the catalog tail.How did you verify your code works?
bun typecheckcleantest/plugin/minimax.test.ts— 8 tests, all passing — covers refresh edge cases:expired_in: 0not treated as "infinite token, never refresh"refresh_tokenin OAuthsuccessresponse → fail loud (don't store empty string)bun dev: provider picker → "MiniMax Token Plan (minimax.io)" → "Sign in with MiniMax" → browser opens toaccount.minimax.iodevice-code page → returns to TUI → can chat withMiniMax-M2.7.Notes
client_idis from an official MiniMax-registered instance for this integration.Coding Plan→Token Planin the provider catalog: providers(minimax): rename Coding Plan → Token Plan in display labels models.dev#1776Checklist