Repository navigation
feat(minimax): add service region selection for the chat base URL - #234
Merged
Yifan Yang (Yif-Yang) merged 1 commit intoAug 20, 2026
Conversation
The minimax_chat backend hardcoded a single global OpenAI-compatible base URL, so there was no supported way to target the China-region service. Add a region-to-base-URL table with global_en and cn_zh entries, select the region from MINIMAX_REGION or the new model.minimax_region setting, and keep an explicitly configured base URL as the override. Document both regional base URLs and cover the resolution order with tests.
Yifan Yang (Yif-Yang)
added a commit
that referenced
this pull request
Aug 20, 2026
Two defects that shipped with the merged PRs: harvest_opencode: the APPDATA branch added by #230 was unreachable. `LOCALAPPDATA or APPDATA` resolves to the former in virtually every Windows session, so a database that really lives under Roaming was never found. Probe the candidate roots in order and pick the one that holds opencode.db, falling back to the Local root for messaging when no database exists yet; a relative OPENCODE_DB resolves below the same selected root. minimax_backend: configure_minimax_chat applied the region default unconditionally and wrote it into MINIMAX_BASE_URL, so a proxy or private gateway configured through the environment was silently discarded as soon as model.minimax_region was set — trainer and eval_only pass `cfg.get('minimax_base_url') or None`, i.e. None for the common case. Track whether the base URL was chosen explicitly and only fill in the region default when it was not, matching what the docs already state. Co-authored-by: Yif-Yang <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
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.
Reason: The first-class MiniMax chat backend only shipped and documented the global OpenAI-compatible base URL, so a run against the China-region service had no supported way to select the correct endpoint.
Changes
skillopt/model/minimax_backend.py: add a region-to-base-URL table (global_en->https://api.minimax.io/v1,cn_zh->https://api.minimaxi.com/v1) withnormalize_region()andbase_url_for_region()helpers. The region is read fromMINIMAX_REGIONat import time and can be switched at runtime throughconfigure_minimax_chat(region=...). Unsupported region names raise aValueErrorthat lists the supported values, and an explicitMINIMAX_BASE_URL/minimax_base_urlstill overrides the region default. Addedget_region()andget_base_url()accessors alongside the existingget_max_tokens().model.minimax_regionsetting through the existing configuration path:configs/_base_/default.yaml,skillopt/config.py,skillopt/model/__init__.py,skillopt/engine/trainer.py, andscripts/eval_only.py, plus a--minimax_regionflag inscripts/train.pyandscripts/eval_only.py..env.example,docs/guide/configuration.md(prose and the environment-variable table), anddocs/reference/config.md.tests/test_minimax_region.py: new tests covering the region table, blank/alias normalization, rejection of unknown regions, region selection from the environment at import time, the explicit base-URL override, and the runtimeconfigure_minimax_chat(region=...)path including the resulting chat URL.Behavior is unchanged when no region is configured: the default stays the global endpoint, and an explicitly configured base URL keeps priority.
Checks
python3 -m ruff check skillopt/model/minimax_backend.py skillopt/model/__init__.py skillopt/config.py skillopt/engine/trainer.py scripts/train.py scripts/eval_only.py tests/test_minimax_region.py— no new findings; the remaining warnings are identical to the base branch for these files.python3 -m pytest tests/ -q— 1108 passed, 8 skipped.