Skip to content

feat(adapters): add MiniMax regional (CN) endpoint selection - #1576

Open
octo-patch wants to merge 2 commits into
i-am-bee:mainfrom
octo-patch:octo/20260729-parameter-refresh-recvqae97F5aEV
Open

feat(adapters): add MiniMax regional (CN) endpoint selection#1576
octo-patch wants to merge 2 commits into
i-am-bee:mainfrom
octo-patch:octo/20260729-parameter-refresh-recvqae97F5aEV

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Reason: The MiniMax adapters only defined the global endpoint, so CN users had to discover and type the regional base URL by hand; this adds a first-class global/CN region selection path.

What changed

MiniMax serves the same OpenAI-compatible API from two regional gateways:

  • global: https://api.minimax.io/v1 (unchanged default)
  • CN: https://api.minimaxi.com/v1

Both the Python and TypeScript adapters previously hard-coded only the global base URL. This PR adds an explicit region selection path in both languages while preserving the existing default behavior.

Python (beeai_framework/adapters/minimax)

  • Add MINIMAX_API_BASE_CN and a resolve_minimax_base_url() helper backed by a MINIMAX_REGION_BASE_URLS map (global/global_en and cn/cn_zh).
  • MiniMaxChatModel accepts a region argument, falling back to the MINIMAX_API_REGION environment variable.
  • Base URL precedence is explicit and unchanged for existing users: base_url argument -> MINIMAX_API_BASE env -> region endpoint -> global default.
  • Export the new constants and helper from the package.

TypeScript (typescript/src/adapters/minimax)

  • Export MINIMAX_API_BASE, MINIMAX_API_BASE_CN, MINIMAX_REGION_BASE_URLS, the MiniMaxRegion type, and resolveMiniMaxBaseURL().
  • MiniMaxClientSettings gains an optional region; the client resolves the base URL with the same precedence and strips region before forwarding settings to the underlying OpenAI-compatible provider.

Docs & examples

  • Document MINIMAX_API_REGION and the region option in the backend module docs.
  • Show the region option in the Python and TypeScript provider examples.

Tests

  • Add parity unit tests in both languages covering region resolution (global/CN aliases, case-insensitivity, empty default, unknown-region error) and the base-URL precedence rules.

Checks

  • Python: ruff check (clean), ruff format --check (clean), pytest tests/adapters/minimax/test_minimax_chat.py -> 27 passed.
  • TypeScript: tsc --noEmit (clean), vitest run tests/e2e/adapters/minimax.test.ts -> 16 passed, prettier --check (clean), eslint (clean).

Signed-off-by: octo-patch <266937838+octo-patch@users.noreply.github.com>
@octo-patch
octo-patch requested review from a team as code owners July 29, 2026 14:35
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 29, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation python Python related functionality typescript Typescript related functionality labels Jul 29, 2026
@Tomas2D

Tomas2D commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for adding MiniMax regional (CN) endpoint selection — appreciated.

Good news: the CI failure here isn't your code. Your changes passed lint, formatting, and type-checks cleanly. The only failing step is poetry build, which is dying on:

Invalid TOML file python/pyproject.toml: Key "lint" already exists.

That was a pre-existing TOML block-ordering bug in pyproject.toml on the base branch you forked from ([tool.pyrefly] was sitting between the [tool.ruff.lint.*] tables). It's already fixed on main.

To get a green build, please just rebase / merge the latest main into your branch:

git fetch upstream    # or 'origin' if you branched from the main repo
git rebase upstream/main
git push --force-with-lease

That should be all it takes — CI should go green afterward. Please don't be discouraged by the red ❌; your actual contribution is in good shape. Thanks for your patience, and looking forward to getting this merged! 🐝

@octo-patch

Copy link
Copy Markdown
Contributor Author

Updated the branch with the latest main to pick up the Python build configuration fix. I ran poetry build, the MiniMax Python tests (27 passed), the MiniMax TypeScript tests (16 passed), and tsc --noEmit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python Python related functionality size:L This PR changes 100-499 lines, ignoring generated files. typescript Typescript related functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants