← Back to PRs

#4734: fix: auto-detect China region for MiniMax API endpoint selection

by akramcodez open 2026-01-30 15:45 View on GitHub →
docs commands agents
### Summary Fixes #4647 - MiniMax provider now automatically uses the domestic endpoint (`api.minimaxi.com`) for China mainland users based on timezone detection. ### Changes - Add [isChinaRegion()](cci:1://file:///home/akram/openclaw/src/infra/region-utils.ts:26:0-51:1) utility for timezone-based region detection - Add [getMinimaxBaseUrl()](cci:1://file:///home/akram/openclaw/src/commands/onboard-auth.models.ts:8:0-23:1) helper for region-aware URL selection - Update MiniMax provider configs to auto-select appropriate endpoints - Update documentation with China mainland user guidance ### How it works - Detects China/Greater China timezones: `Asia/Shanghai`, `Asia/Hong_Kong`, `Asia/Taipei`, etc. - China users → `https://api.minimaxi.com/anthropic` - Overseas users → `https://api.minimax.io/anthropic` - Manual override still available via `openclaw config set` ### Files Changed - [src/infra/region-utils.ts](cci:7://file:///home/akram/openclaw/src/infra/region-utils.ts:0:0-0:0) (new) - [src/commands/onboard-auth.models.ts](cci:7://file:///home/akram/openclaw/src/commands/onboard-auth.models.ts:0:0-0:0) - [src/commands/onboard-auth.config-minimax.ts](cci:7://file:///home/akram/openclaw/src/commands/onboard-auth.config-minimax.ts:0:0-0:0) - [src/agents/minimax-vlm.ts](cci:7://file:///home/akram/openclaw/src/agents/minimax-vlm.ts:0:0-0:0) - [src/agents/models-config.providers.ts](cci:7://file:///home/akram/openclaw/src/agents/models-config.providers.ts:0:0-0:0) - [docs/providers/minimax.md](cci:7://file:///home/akram/openclaw/docs/providers/minimax.md:0:0-0:0) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds timezone-based region detection (`isChinaRegion`) and uses it to choose a MiniMax base URL automatically, preferring the domestic `api.minimaxi.com` endpoint for China/HK/TW timezones. The logic is wired into MiniMax-related onboarding/config defaults, plus the MiniMax VLM helper, and the MiniMax provider docs are updated with China-specific guidance and override instructions. The main risk is endpoint inconsistency: different parts of the code now default to different overseas domains (`api.minimax.io`, `api.minimax.chat`) and different API variants (`/v1` vs `/anthropic`), which can lead to surprising behavior or broken requests depending on which path constructs the provider config. <h3>Confidence Score: 3/5</h3> - Mostly safe to merge, but endpoint/domain inconsistencies could cause MiniMax to break or behave differently across code paths. - Changes are small and localized, but MiniMax base URL selection now varies between implicit providers, onboarding defaults, and VLM host coercion (`.io` vs `.chat`), which is easy to miss and could impact real users. - src/agents/models-config.providers.ts; src/commands/onboard-auth.config-minimax.ts; src/agents/minimax-vlm.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs