Skip to content

Add MiniMax engine support - #175

Open
octo-patch wants to merge 1 commit into
michaelshimeles:mainfrom
octo-patch:octo/20260801-provider-add-recvqK87k1xWNz
Open

Add MiniMax engine support#175
octo-patch wants to merge 1 commit into
michaelshimeles:mainfrom
octo-patch:octo/20260801-provider-add-recvqK87k1xWNz

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: Add first-class MiniMax engine support through the Claude Code transport.

Changes

  • add --minimax engine selection with MiniMax-M3 as the default model
  • route Claude Code requests through the MiniMax endpoint and map MINIMAX_API_KEY to bearer authentication
  • add focused engine tests and usage documentation

Checks

  • bun test src/engines/minimax.test.ts
  • bun test
  • bun run build
  • bunx biome check src/cli/args.ts src/engines/claude.ts src/engines/index.ts src/engines/types.ts src/engines/minimax.ts src/engines/minimax.test.ts
  • git diff --check origin/main...HEAD

bun run check continues to report existing lint errors in execution and telemetry files outside this change.

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

@octo-patch is attempting to deploy a commit to the Goshen Labs Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot

dosubot Bot commented Aug 1, 2026

Copy link
Copy Markdown

📄 Knowledge review

✏️ Suggested updates

2 page suggestions need review.

Page Library Status
AI Engine Addition Process Goshen Labs's Space 🟡 Review
AI Engine Integration Goshen Labs's Space 🟡 Review
📝 AI Engine Addition Process
@@ -1,10 +1,10 @@
 ## Architecture and Extension Points
 AI engines in Ralphy are implemented as classes extending a shared `BaseAIEngine` abstract class. Each engine defines its name, CLI command, and execution logic. Engines are registered in `cli/src/engines/index.ts` and instantiated via the `createEngine` function, which maps engine names to their respective classes. This modular approach ensures consistent integration and simplifies extension for new engines ([source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/cli/src/engines/index.ts#L3-L56)).
 
-Supported engines include Claude Code, OpenCode, Cursor, Codex, Qwen-Code, Factory Droid, GitHub Copilot, Trae Agent, Gemini CLI, and Ollama (via Claude Code CLI). Each engine follows the same integration pattern, allowing for consistent behavior and easy extensibility.
+Supported engines include Claude Code, OpenCode, Cursor, Codex, Qwen-Code, Factory Droid, GitHub Copilot, Trae Agent, Gemini CLI, MiniMax, and Ollama (via Claude Code CLI). Each engine follows the same integration pattern, allowing for consistent behavior and easy extensibility.
 
 ## Adding Command-Line Flags
-To add a new engine, define a unique command-line flag in the CLI argument parser. Ralphy uses the `commander` library in its TypeScript CLI to declare flags such as `--droid` for Factory Droid, `--qwen` for Qwen-Code, `--trae` for Trae Agent, `--gemini` for Gemini CLI, and `--ollama` for Ollama. Update the argument parsing logic to set the engine name when the flag is present ([source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/cli/src/cli/args.ts#L26-L145)).
+To add a new engine, define a unique command-line flag in the CLI argument parser. Ralphy uses the `commander` library in its TypeScript CLI to declare flags such as `--droid` for Factory Droid, `--qwen` for Qwen-Code, `--trae` for Trae Agent, `--gemini` for Gemini CLI, `--minimax` for MiniMax, and `--ollama` for Ollama. Update the argument parsing logic to set the engine name when the flag is present ([source](https://github.com/michaelshimeles/ralphy/blob/fc2df589969b5fe16d31eccb4e7ff91314e31776/cli/src/cli/args.ts#L26-L145)).
 
 Example:
 ```typescript
@@ -13,6 +13,7 @@
   .option("--qwen", "Use Qwen-Code")
   .option("--trae", "Use Trae Agent")
   .option("--gemini", "Use Gemini CLI")
+  .option("--minimax", "Use MiniMax through Claude Code")
   .option("--ollama", "Use Ollama (local models via Claude Code)");
 ```
 Argument parsing:
@@ -26,6 +27,7 @@
 else if (opts.droid) aiEngine = "droid";
 else if (opts.trae) aiEngine = "trae";
 else if (opts.gemini) aiEngine = "gemini";
+else if (opts.minimax) aiEngine = "minimax";
 else if (opts.ollama) aiEngine = "ollama";
 ```
 

Accept · Edit · Decline

📝 AI Engine Integration
@@ -6,7 +6,7 @@
 **Engine-Specific Arguments:** You can pass arbitrary arguments to any engine using the `--` separator. Everything after `--` is forwarded directly to the engine CLI. See the 'Engine-Specific Arguments' section for details and examples.
 
 **Requirements:**
-- AI CLI: [Claude Code](https://github.com/anthropics/claude-code), [OpenCode](https://opencode.ai/docs/), [Cursor](https://cursor.com), Codex, Qwen-Code, [Factory Droid](https://docs.factory.ai/cli/getting-started/quickstart), [GitHub Copilot](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli), [Gemini CLI](https://github.com/google-gemini/gemini-cli), or [Ollama](https://ollama.com) (requires Claude Code CLI)
+- AI CLI: [Claude Code](https://github.com/anthropics/claude-code), [OpenCode](https://opencode.ai/docs/), [Cursor](https://cursor.com), Codex, Qwen-Code, [Factory Droid](https://docs.factory.ai/cli/getting-started/quickstart), [GitHub Copilot](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli), [Gemini CLI](https://github.com/google-gemini/gemini-cli), MiniMax (requires Claude Code CLI), or [Ollama](https://ollama.com) (requires Claude Code CLI)
 - **npm version (`ralphy-cli`)**: Node.js 18+ or Bun
 
 Each engine requires its CLI tool installed and available in the system PATH.
@@ -23,6 +23,7 @@
 | Trae Agent    | `trae`             | `--trae`            | `--print --force --output-format stream-json` | stream-json | tokens, duration (ms) | Model override via `--model`. Trae CLI must be in PATH. |
 | GitHub Copilot| `copilot`          | `--copilot`         | `--yolo`                            | plain text         | tokens (parsed from output) | Requires Copilot CLI. **Prompts are passed via temp files to preserve markdown. --yolo is always used for non-interactive mode. Only authentication errors with known output formats are detected and surfaced. Token usage is parsed and reported. Silent failures and infinite retry loops are fixed.** |
 | Gemini        | `gemini`           | `--gemini`          | `--output-format stream-json --yolo` | stream-json        | tokens + cost        | Model override via `--model`. Failed commands return error messages with exit codes. |
+| MiniMax       | `claude`           | `--minimax`         | `--dangerously-skip-permissions` | stream-json        | tokens + cost        | Uses Claude Code transport with MiniMax endpoint. Requires `MINIMAX_API_KEY` environment variable. Default model: `MiniMax-M3`. |
 | Ollama        | `claude`           | `--ollama`          | `--dangerously-skip-permissions` (Ollama env vars) | stream-json        | tokens + cost        | Runs local models via Claude Code CLI. Requires Ollama running locally and Claude Code CLI installed. Recommended models: `qwen3-coder`, `glm-4.7`, `gpt-oss:20b`, `gpt-oss:120b`. |
 
 ## Engine Integration Details
@@ -89,6 +90,15 @@
 Example:
 ```bash
 ralphy --gemini --model gemini-pro "implement feature"
+```
+
+### MiniMax
+Integrated as `MiniMaxEngine`. Uses the `claude` CLI with the MiniMax endpoint. Model override via `--model <name>`. Default model is `MiniMax-M3`. Requires `MINIMAX_API_KEY` environment variable for authentication. Token usage and cost are parsed from output. Failed commands return error messages with exit codes.
+
+Example:
+```bash
+export MINIMAX_API_KEY="..."
+ralphy --minimax "add feature"
 ```
 
 ### GitHub Copilot
@@ -166,6 +176,7 @@
 - **Claude Code**: Authentication/connectivity issues may occur depending on environment; not considered a bug in Ralphy.
 - **Codex**: No token reporting; uses temp files for output.
 - **GitHub Copilot**: Requires Copilot CLI installed and available in PATH. Prompts are passed via temp files. --yolo is always used for non-interactive mode. Only authentication errors with known output formats are detected and surfaced. Token usage is parsed and reported. Infinite retry loops on fatal errors are fixed.
+- **MiniMax**: Requires `MINIMAX_API_KEY` environment variable and Claude Code CLI installed. Uses Claude Code transport with MiniMax endpoint.
 - **Ollama**: Requires [Ollama](https://ollama.com) running locally and Claude Code CLI installed and available in PATH. Only models with at least 64k context window are supported. If either dependency is missing, tasks will fail with a clear error message.
 - **General**: Each engine requires its CLI tool installed and available in the system PATH.
 
@@ -180,6 +191,7 @@
 ralphy --trae "implement feature"              # Trae Agent
 ralphy --copilot "add feature"                 # GitHub Copilot
 ralphy --gemini "summarize document"           # Gemini CLI
+ralphy --minimax "add feature"                 # MiniMax (through Claude Code)
 ralphy --ollama "add feature"                  # Ollama (local models via Claude Code CLI)
 
 ralphy --opencode --model opencode/glm-4.7-free "custom model"

Accept · Edit · Decline


Leave Feedback Ask Dosu about ralphy Add Dosu to your team

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This change adds MiniMax as a Claude Code-backed engine, including CLI selection, endpoint configuration, model defaults, tests, and documentation.

Validation reproduced two issues:

  • MiniMax execution forwards an Anthropic token to the MiniMax endpoint when MINIMAX_API_KEY is absent.
  • The top-level help description omits MiniMax even though --minimax is available.

Confidence Score: 4/5

Security Review

MiniMax execution can disclose ANTHROPIC_AUTH_TOKEN to MiniMax when MINIMAX_API_KEY is unavailable. The MiniMax subprocess is configured for https://api.minimax.io/anthropic, so authentication must use a MiniMax-scoped credential and must not silently reuse an Anthropic bearer token.

T-Rex T-Rex Logs

What T-Rex did

  • The P1 credential-boundary finding was validated by running the credential-boundary runtime probe script and inspecting its output.
  • The P2 finding was posted, and the MiniMax visibility was demonstrated by the CLI help output showing the MiniMax option with no description entry.
  • A P1 finding proof was posted.
  • Contract-validation confirmed the child environment injected ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, with the probe exiting 0.
  • The CLI help surfaced MiniMax-related options but the description entry for MiniMax was missing, supporting the P2 review findings.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (3)

  1. cli/src/cli/args.ts, line 15 (link)

    P2 MiniMax omitted from help summary

    The top-level ralphy --help description names the supported engines but omits MiniMax, even though the same output exposes --minimax. Add MiniMax to the static description so users can discover the newly supported engine from the help summary.

    Artifacts

    MiniMax help visibility checker

    • Captured executable checker that runs the CLI help path and compares the supported-engine description with `--minimax` visibility; it defines the narrow validation performed.

    CLI help output with visible MiniMax option and omitted description entry

    • Captured output of the one executed CLI help check from `/home/user/repo`, including command, working directory, exit code, and full help output; it confirms the omission.

    View artifacts

    T-Rex Ran code and verified through T-Rex

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: cli/src/cli/args.ts
    Line: 15
    
    Comment:
    **MiniMax omitted from help summary**
    
    The top-level `ralphy --help` description names the supported engines but omits MiniMax, even though the same output exposes `--minimax`. Add MiniMax to the static description so users can discover the newly supported engine from the help summary.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  2. General comment

    P1 MiniMax execution forwards Anthropic fallback credential to MiniMax endpoint

    • Bug
      • When no MINIMAX_API_KEY is present, a configured ANTHROPIC_AUTH_TOKEN is copied into the MiniMax claude subprocess environment, despite that process being configured for https://api.minimax.io/anthropic.
    • Cause
      • cli/src/engines/minimax.ts:19 selects process.env.ANTHROPIC_AUTH_TOKEN as a fallback, and line 25 assigns the selected value to the subprocess ANTHROPIC_AUTH_TOKEN.
    • Fix
      • Do not fall back to ANTHROPIC_AUTH_TOKEN for the MiniMax engine; only inject a MiniMax-scoped credential such as MINIMAX_API_KEY.

    T-Rex Ran code and verified through T-Rex

  3. General comment

    P2 CLI help description omits the visible MiniMax engine

    • Bug
      • The program description rendered by ralphy --help does not name MiniMax even though the same help output presents the --minimax engine-selection option.
    • Cause
      • createProgram() hard-codes the supported-engine description without a MiniMax entry.
    • Fix
      • Add MiniMax to the static description passed to .description(...).

    T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
cli/src/engines/minimax.ts:19
**Cross-provider credential fallback**

When `--minimax` runs without `MINIMAX_API_KEY` while `ANTHROPIC_AUTH_TOKEN` is set, the engine passes the Anthropic bearer token to a Claude subprocess configured for `https://api.minimax.io/anthropic`. This exposes an unrelated provider credential to MiniMax and will generally fail MiniMax authentication. Require a MiniMax-scoped credential instead of falling back to `ANTHROPIC_AUTH_TOKEN`.

### Issue 2
cli/src/cli/args.ts:15
**MiniMax omitted from help summary**

The top-level `ralphy --help` description names the supported engines but omits MiniMax, even though the same output exposes `--minimax`. Add MiniMax to the static description so users can discover the newly supported engine from the help summary.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Add MiniMax engine support" | Re-trigger Greptile


protected getEnvironment(options?: EngineOptions): Record<string, string> {
const model = this.getModel(options);
const authToken = process.env.MINIMAX_API_KEY ?? process.env.ANTHROPIC_AUTH_TOKEN;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Cross-provider credential fallback

When --minimax runs without MINIMAX_API_KEY while ANTHROPIC_AUTH_TOKEN is set, the engine passes the Anthropic bearer token to a Claude subprocess configured for https://api.minimax.io/anthropic. This exposes an unrelated provider credential to MiniMax and will generally fail MiniMax authentication. Require a MiniMax-scoped credential instead of falling back to ANTHROPIC_AUTH_TOKEN.

Artifacts

Credential-boundary runtime probe script

  • A temporary fake Claude executable records the environment received from a real MiniMax engine invocation, proving the exact child-process boundary exercised.

MiniMax credential-boundary probe output with Anthropic fallback token

  • The executed probe exited successfully and recorded the MiniMax endpoint together with the injected Anthropic sentinel token, confirming the credential-boundary defect.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/engines/minimax.ts
Line: 19

Comment:
**Cross-provider credential fallback**

When `--minimax` runs without `MINIMAX_API_KEY` while `ANTHROPIC_AUTH_TOKEN` is set, the engine passes the Anthropic bearer token to a Claude subprocess configured for `https://api.minimax.io/anthropic`. This exposes an unrelated provider credential to MiniMax and will generally fail MiniMax authentication. Require a MiniMax-scoped credential instead of falling back to `ANTHROPIC_AUTH_TOKEN`.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

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.

1 participant