Skip to content

Conversation

@ratulsarna
Copy link
Collaborator

This PR follows up on and supersedes #277 (fix/minimax-global-region) which is now largely redundant on current main (region-specific endpoints landed via #234).

Changes:

  • Always show the MiniMax API region picker in settings (cherry-picked from fix: use region-specific API endpoint for MiniMax usage fetch #277).
  • When fetching MiniMax usage via API token with region defaulting to .global, retry the China mainland API host if the global host rejects the token (mitigates upgrade regression for existing CN users with no persisted region).

Credit: @apoorvdarshan for PR #277 and the investigation in #276.

Commands run:

  • swift test
  • pnpm check
  • ./Scripts/compile_and_run.sh

apoorvdarshan and others added 2 commits February 10, 2026 13:24
Global region users with API keys (sk-cp-...) were getting "credentials
invalid" errors because the fetcher used a hardcoded China endpoint.

- Add apiBaseURLString and apiRemainsURL to MiniMaxAPIRegion for
  region-specific API hosts (api.minimax.io vs api.minimaxi.com)
- Update fetchUsage(apiToken:) to accept region parameter
- Pass region from settings through MiniMaxAPIFetchStrategy
- Make API region picker always visible in settings UI
- Default to global when settings are absent (CLI/library contexts)

Fixes #276
When fetching with an API token and region defaults to .global, retry the China mainland API host if the global host rejects the token. This preserves upgrade behavior for users who previously depended on the China endpoint by default.

Credit: @apoorvdarshan (PR #277, issue #276 investigation).
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0422dd1b1c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

If global host rejects the API token and the China host is unreachable, keep returning invalidCredentials so the pipeline can fall back to web.
@ratulsarna ratulsarna merged commit a26a4bb into main Feb 10, 2026
4 checks passed
@ratulsarna ratulsarna deleted the codex/minimax-region-followup branch February 10, 2026 08:45
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.

2 participants