Skip to content

feat(llm): add MiniMax provider support#619

Open
winsonwq wants to merge 1 commit intobrowseros-ai:mainfrom
winsonwq:feature/add-minimax-provider
Open

feat(llm): add MiniMax provider support#619
winsonwq wants to merge 1 commit intobrowseros-ai:mainfrom
winsonwq:feature/add-minimax-provider

Conversation

@winsonwq
Copy link
Copy Markdown

Summary

Add MiniMax as a new LLM provider option in the "Configure New Provider" dialog.

Changes

  • packages/shared/src/schemas/llm.ts: Add MINIMAX to LLM_PROVIDERS constant and LLMProviderSchema enum
  • apps/server/src/lib/clients/llm/provider.ts: Add createMinimaxModel() factory using OpenAI-compatible SDK
  • apps/agent/lib/llm-providers/types.ts: Add minimax to ProviderType union
  • apps/agent/lib/llm-providers/models-dev-data.json: Add MiniMax models (M2.7, M2.5, M2.1, M2-her) with context window 204800
  • apps/agent/lib/llm-providers/providerTemplates.ts: Add MiniMax template with default base URL https://api.minimaxi.com and API key guide link
  • apps/agent/entrypoints/app/ai-settings/NewProviderDialog.tsx: Add minimax to providerTypeEnum

Supported Models

Model Context Window Reasoning Tool Call
MiniMax-M2.7 204800 Yes Yes
MiniMax-M2.7-highspeed 204800 Yes Yes
MiniMax-M2.5 204800 Yes Yes
MiniMax-M2.5-highspeed 204800 Yes Yes
MiniMax-M2.1 204800 Yes Yes
MiniMax-M2.1-highspeed 204800 Yes Yes
M2-her 204800 No Yes

API Details

Testing

Verified API connectivity with MiniMax-M2.7 model using the OpenAI-compatible endpoint. Response: status_code: 0 (success).

Notes

  • MiniMax follows the same OpenAI-compatible pattern as Moonshot, making integration straightforward
  • Both Chinese domestic (api.minimaxi.com) and international (api.minimax.io) versions use the same API format — this PR targets the domestic version following the Moonshot precedent

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

All contributors have signed the CLA. Thank you!
Posted by the CLA Assistant Lite bot.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This PR adds MiniMax as a new LLM provider by following the existing OpenAI-compatible pattern used for Moonshot, wiring up all six required touch points: the shared schema, the server-side factory, the agent-side type union, the model catalogue, the provider template, and the dialog enum. The integration is clean and consistent with the rest of the codebase.

Key findings:

  • The default base URL for MiniMax is set to https://api.minimaxi.com in both DEFAULT_BASE_URLS (providerTemplates.ts) and the api field in models-dev-data.json. Both are missing the required /v1 suffix. Since enrichTemplate derives defaultBaseUrl from the api field when no override is supplied, every user who configures MiniMax will have a broken URL auto-populated, causing all API calls to fail. The fix is to append /v1 in both places, consistent with every other OpenAI-compatible provider (e.g. moonshot: 'https://api.moonshot.ai/v1').
  • All other aspects of the integration — factory function, schema registration, model capabilities data, and dialog validation — are correct and complete.

Confidence Score: 4/5

Not safe to merge as-is — the missing /v1 suffix will cause API calls to silently fail for all MiniMax users with the default base URL.

One P1 defect (missing /v1 in two places) would break the primary user path for every MiniMax user who relies on the auto-populated default URL. The fix is a two-character change in two files. Everything else in the PR is correct.

providerTemplates.ts (line 202) and models-dev-data.json (line 5406) both need /v1 appended to the MiniMax base URL.

Important Files Changed

Filename Overview
packages/browseros-agent/apps/agent/lib/llm-providers/providerTemplates.ts Adds MiniMax to providerTemplates and DEFAULT_BASE_URLS — base URL is missing the required /v1 suffix, causing the auto-populated URL to be invalid for API calls.
packages/browseros-agent/apps/agent/lib/llm-providers/models-dev-data.json Adds 7 MiniMax models with correct capabilities metadata; api field is missing /v1 suffix used to derive the default base URL via enrichTemplate.
packages/browseros-agent/apps/server/src/lib/clients/llm/provider.ts Adds createMinimaxModel factory following the identical pattern as Moonshot; correctly requires both baseUrl and apiKey, and registers in PROVIDER_FACTORIES.
packages/browseros-agent/packages/shared/src/schemas/llm.ts Adds MINIMAX: 'minimax' to LLM_PROVIDERS and extends LLMProviderSchema enum — straightforward and consistent with existing entries.
packages/browseros-agent/apps/agent/lib/llm-providers/types.ts Adds 'minimax' to the ProviderType union — correct and complete.
packages/browseros-agent/apps/agent/entrypoints/app/ai-settings/NewProviderDialog.tsx Adds 'minimax' to the local providerTypeEnum for form validation — consistent and no issues found.

Sequence Diagram

sequenceDiagram
    participant UI as NewProviderDialog
    participant Templates as providerTemplates.ts
    participant Schema as llm.ts (shared)
    participant Factory as provider.ts (server)
    participant API as MiniMax API

    UI->>Templates: getDefaultBaseUrlForProviders('minimax')
    Templates-->>UI: DEFAULT_BASE_URLS.minimax → https://api.minimaxi.com[/v1]
    UI->>UI: User fills form & submits
    UI->>Schema: Validate provider type via LLMProviderSchema
    Schema-->>UI: 'minimax' accepted
    UI->>Factory: createLLMProvider({ provider: 'minimax', baseUrl, apiKey, model })
    Factory->>Factory: PROVIDER_FACTORIES['minimax'] → createMinimaxModel()
    Factory->>Factory: createOpenAICompatible({ name: 'minimax', baseURL, apiKey })
    Factory->>API: POST {baseURL}/chat/completions
    API-->>Factory: Response
    Factory-->>UI: LanguageModel
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/lib/llm-providers/providerTemplates.ts
Line: 202

Comment:
**Missing `/v1` suffix in default base URL**

The `DEFAULT_BASE_URLS` entry for `minimax` is `'https://api.minimaxi.com'`, which is missing the `/v1` path segment required by the OpenAI-compatible endpoint. Every other OpenAI-compatible provider in this map includes the full path (e.g. `moonshot: 'https://api.moonshot.ai/v1'`, `openai: 'https://api.openai.com/v1'`). As a result, when a user selects MiniMax, the auto-populated base URL will cause all API calls to fail with a 404 or similar HTTP error.

The same issue exists in `models-dev-data.json` (line 5406), where the `api` field is `"https://api.minimaxi.com"` — this is used by `enrichTemplate` to derive `defaultBaseUrl` when no explicit override is given.

```suggestion
  minimax: 'https://api.minimaxi.com/v1',
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/lib/llm-providers/models-dev-data.json
Line: 5406

Comment:
**Missing `/v1` suffix in `api` field**

The `api` value `"https://api.minimaxi.com"` is used by `enrichTemplate` as the `defaultBaseUrl` (since no `defaultBaseUrl` override is passed in `providerTemplates.ts`). All other OpenAI-compatible providers include `/v1` in this field. Without it, the template will populate an incomplete URL, mirroring the same problem in `DEFAULT_BASE_URLS`.

```suggestion
    "api": "https://api.minimaxi.com/v1",
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat(llm): add MiniMax provider support" | Re-trigger Greptile

lmstudio: 'http://localhost:1234/v1',
bedrock: '',
browseros: '',
minimax: 'https://api.minimaxi.com',
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 Missing /v1 suffix in default base URL

The DEFAULT_BASE_URLS entry for minimax is 'https://api.minimaxi.com', which is missing the /v1 path segment required by the OpenAI-compatible endpoint. Every other OpenAI-compatible provider in this map includes the full path (e.g. moonshot: 'https://api.moonshot.ai/v1', openai: 'https://api.openai.com/v1'). As a result, when a user selects MiniMax, the auto-populated base URL will cause all API calls to fail with a 404 or similar HTTP error.

The same issue exists in models-dev-data.json (line 5406), where the api field is "https://api.minimaxi.com" — this is used by enrichTemplate to derive defaultBaseUrl when no explicit override is given.

Suggested change
minimax: 'https://api.minimaxi.com',
minimax: 'https://api.minimaxi.com/v1',
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/lib/llm-providers/providerTemplates.ts
Line: 202

Comment:
**Missing `/v1` suffix in default base URL**

The `DEFAULT_BASE_URLS` entry for `minimax` is `'https://api.minimaxi.com'`, which is missing the `/v1` path segment required by the OpenAI-compatible endpoint. Every other OpenAI-compatible provider in this map includes the full path (e.g. `moonshot: 'https://api.moonshot.ai/v1'`, `openai: 'https://api.openai.com/v1'`). As a result, when a user selects MiniMax, the auto-populated base URL will cause all API calls to fail with a 404 or similar HTTP error.

The same issue exists in `models-dev-data.json` (line 5406), where the `api` field is `"https://api.minimaxi.com"` — this is used by `enrichTemplate` to derive `defaultBaseUrl` when no explicit override is given.

```suggestion
  minimax: 'https://api.minimaxi.com/v1',
```

How can I resolve this? If you propose a fix, please make it concise.

}
]
},
"minimax": {
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 Missing /v1 suffix in api field

The api value "https://api.minimaxi.com" is used by enrichTemplate as the defaultBaseUrl (since no defaultBaseUrl override is passed in providerTemplates.ts). All other OpenAI-compatible providers include /v1 in this field. Without it, the template will populate an incomplete URL, mirroring the same problem in DEFAULT_BASE_URLS.

Suggested change
"minimax": {
"api": "https://api.minimaxi.com/v1",
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/lib/llm-providers/models-dev-data.json
Line: 5406

Comment:
**Missing `/v1` suffix in `api` field**

The `api` value `"https://api.minimaxi.com"` is used by `enrichTemplate` as the `defaultBaseUrl` (since no `defaultBaseUrl` override is passed in `providerTemplates.ts`). All other OpenAI-compatible providers include `/v1` in this field. Without it, the template will populate an incomplete URL, mirroring the same problem in `DEFAULT_BASE_URLS`.

```suggestion
    "api": "https://api.minimaxi.com/v1",
```

How can I resolve this? If you propose a fix, please make it concise.

@winsonwq
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

- Add MINIMAX provider type to shared LLM schemas
- Add createMinimaxModel factory using OpenAI-compatible SDK
- Add MiniMax models to models-dev-data.json (M2.7, M2.5, M2.1, M2-her)
- Add MiniMax to provider templates with default base URL and API key guide
- Add 'minimax' option to NewProviderDialog enum

Models supported:
- MiniMax-M2.7 / MiniMax-M2.7-highspeed (context: 204800)
- MiniMax-M2.5 / MiniMax-M2.5-highspeed (context: 204800)
- MiniMax-M2.1 / MiniMax-M2.1-highspeed (context: 204800)
- M2-her (context: 204800)

API: https://api.minimaxi.com (OpenAI-compatible endpoint)
@winsonwq winsonwq force-pushed the feature/add-minimax-provider branch from 7bdfebe to 1edd4b8 Compare March 30, 2026 18:03
@winsonwq
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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