Skip to content

Add MiniMax external LLM API provider and model paths - #14

Open
octo-patch wants to merge 1 commit into
JosefAlbers:mainfrom
octo-patch:octo/20260730-provider-add-recvqd8yABwN2c
Open

Add MiniMax external LLM API provider and model paths#14
octo-patch wants to merge 1 commit into
JosefAlbers:mainfrom
octo-patch:octo/20260730-provider-add-recvqd8yABwN2c

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: The agent library exposed an executable external LLM API tool but had no MiniMax provider or MiniMax-M3 / MiniMax-M2.7 model path.

What changed

  • Added minimax_api(prompt, history, ...) in api.py, a new executable LLM backend that mirrors the existing mistral_api tool signature so it drops directly into an Agent toolchain ("responses, history = minimax_api(prompt, history)").
    • Talks to the MiniMax OpenAI-compatible chat completions endpoint and parses the standard choices[0].message.content response.
    • Exposes both model paths via api_model (MiniMax-M3 as the default, MiniMax-M2.7 also selectable), tracked in a MINIMAX_MODELS constant.
    • Supports both regional base URLs via region (global_en -> https://api.minimax.io/v1, cn_zh -> https://api.minimaxi.com/v1) in MINIMAX_BASE_URLS.
    • Reads its key from the MINIMAX_API_KEY environment variable; multi-turn state is threaded through history just like the existing backend.
  • Imported minimax_api into phi_3_vision_mlx.py so the toolchain parser (which resolves tool names in that module namespace) can reference it.
  • Added toolchain hotswap examples to examples.py covering both the default model and explicit model selection.

Uses the already-declared requests dependency; no new dependencies were added.

Checks

  • python3 -m py_compile api.py examples.py
  • Exercised minimax_api with a stubbed HTTP layer: verified endpoint selection per region, model routing for both models, multi-turn history accumulation, and response parsing (all assertions passed).

Note: the full MLX test suite (test.py) targets Apple silicon / mlx and downloads models, so it was not run in this environment.

@JosefAlbers

Copy link
Copy Markdown
Owner

Thanks for the PR! Before I can merge this, could you run the updated code with valid API credentials and post the output here? I can't easily verify it locally since it requires API keys. Even a short terminal log or screenshot showing the feature working would be enough.

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