Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
feat(providers): add MiniMax provider with M3 and M2.7 models (#1413)
Octopus3509cbb1c646
diff --git a/src/client/src/__tests__/lib/platform/chat/stream.test.ts b/src/client/src/__tests__/lib/platform/chat/stream.test.tsindex 2a15c627..7b49524b 100644--- a/src/client/src/__tests__/lib/platform/chat/stream.test.ts+++ b/src/client/src/__tests__/lib/platform/chat/stream.test.ts@@ -101,17 +101,25 @@ describe('getModelInstance', () => {expect(instance).toBeDefined();});- it('supports all 14 providers', () => {+ it('supports all built-in providers including MiniMax', () => {const providers = ['openai', 'anthropic', 'google', 'mistral', 'cohere','groq', 'perplexity', 'azure', 'together', 'fireworks',- 'deepseek', 'xai', 'huggingface', 'replicate',+ 'deepseek', 'xai', 'huggingface', 'replicate', 'minimax',];for (const p of providers) {expect(() => getModelInstance(p, 'key', 'model')).not.toThrow();}});+ it('supports MiniMax via the OpenAI-compatible endpoint', () => {+ const instance = getModelInstance('minimax', 'key', 'MiniMax-M3');+ expect(instance).toBeDefined();+ expect(createOpenAI).toHaveBeenCalledWith(+ expect.objectContaining({ baseURL: 'https://api.minimax.io/v1' })+ );+ });+it('throws when a provider factory returns a non-callable object instance', () => {(createOpenAI as jest.Mock).mockReturnValueOnce({ notAFunction: true });expect(() => getModelInstance('openai', 'key', 'model')).toThrow();diff --git a/src/client/src/__tests__/lib/platform/pricing/chat-cost.test.ts b/src/client/src/__tests__/lib/platform/pricing/chat-cost.test.tsindex bd8719a1..e9d00ea1 100644--- a/src/client/src/__tests__/lib/platform/pricing/chat-cost.test.ts+++ b/src/client/src/__tests__/lib/platform/pricing/chat-cost.test.ts@@ -72,6 +72,7 @@ describe("promptTokensIncludeCache", () => {it("treats openai and litellm as inclusive", () => {expect(promptTokensIncludeCache("openai", 6200, 5000, 1000)).toBe(true);expect(promptTokensIncludeCache("litellm", 6200, 5000, 1000)).toBe(true);+ expect(promptTokensIncludeCache("minimax", 6200, 5000, 1000)).toBe(true);});it("falls back to heuristic when provider unknown", () => {diff --git a/src/client/src/__tests__/lib/platform/providers/default-models.test.ts b/src/client/src/__tests__/lib/platform/providers/default-models.test.tsindex 6566049f..30cf6cc3 100644--- a/src/client/src/__tests__/lib/platform/providers/default-models.test.ts+++ b/src/client/src/__tests__/lib/platform/providers/default-models.test.ts@@ -1,4 +1,4 @@-import { DEFAULT_MODELS_BY_PROVIDER } from '@/lib/platform/providers/default-models';+import { DEFAULT_MODELS_BY_PROVIDER, DEFAULT_PROVIDERS } from '@/lib/platform/providers/default-models';describe('default-models', () => {it('exports a non-empty record of providers', () => {@@ -11,7 +11,7 @@ describe('default-models', () => {const expectedProviders = ['openai', 'anthropic', 'google', 'mistral', 'groq','perplexity', 'azure', 'cohere', 'together', 'fireworks',- 'deepseek', 'xai', 'huggingface', 'replicate',+ 'deepseek', 'xai', 'huggingface', 'replicate', 'minimax',];for (const provider of expectedProviders) {expect(DEFAULT_MODELS_BY_PROVIDER).toHaveProperty(provider);@@ -47,4 +47,48 @@ describe('default-models', () => {}}});++ it('seeds the MiniMax provider with its current models', () => {+ const minimaxProvider = DEFAULT_PROVIDERS.find((p) => p.providerId === 'minimax');+ expect(minimaxProvider).toEqual(+ expect.objectContaining({+ displayName: 'MiniMax',+ requiresVault: true,+ })+ );+ expect(minimaxProvider?.configSchema.temperature).toEqual(+ expect.objectContaining({ min: 0, max: 2, default: 1 })+ );+ expect(minimaxProvider?.configSchema.topP).toEqual(+ expect.objectContaining({ min: 0, max: 1, default: 0.95 })+ );++ const minimaxModels = DEFAULT_MODELS_BY_PROVIDER.minimax;+ expect(minimaxModels).toHaveLength(2);++ const m3 = minimaxModels.find((m) => m.id === 'MiniMax-M3');+ expect(m3).toMatchObject({+ contextWindow: 1000000,+ inputPricePerMToken: 0.3,+ outputPricePerMToken: 1.2,+ cacheReadPricePerMToken: 0.06,+ });+ expect(m3?.cacheCreationPricePerMToken).toBeUndefined();+ expect(m3?.capabilities).toEqual(+ expect.arrayContaining(['function-calling', 'vision', 'streaming', 'thinking'])+ );++ const m27 = minimaxModels.find((m) => m.id === 'MiniMax-M2.7');+ expect(m27).toMatchObject({+ contextWindow: 204800,+ inputPricePerMToken: 0.3,+ outputPricePerMToken: 1.2,+ cacheReadPricePerMToken: 0.06,+ cacheCreationPricePerMToken: 0.375,+ });+ expect(m27?.capabilities).toEqual(+ expect.arrayContaining(['function-calling', 'streaming', 'thinking'])+ );+ expect(m27?.capabilities).not.toContain('vision');+ });});diff --git a/src/client/src/clickhouse/migrations/create-provider-metadata-migration.ts b/src/client/src/clickhouse/migrations/create-provider-metadata-migration.tsindex 27b00e15..d10355a8 100644--- a/src/client/src/clickhouse/migrations/create-provider-metadata-migration.ts+++ b/src/client/src/clickhouse/migrations/create-provider-metadata-migration.ts@@ -6,7 +6,7 @@ import { DEFAULT_PROVIDERS } from "@/lib/platform/providers/default-models";const MIGRATION_ID = "create-provider-metadata-table";/**- * Creates the openlit_provider_metadata table and seeds it with the 14+ * Creates the openlit_provider_metadata table and seeds it with the* built-in providers. After this migration, providers are fully editable* and new ones can be added via the UI or import API.*/diff --git a/src/client/src/lib/platform/chat/stream.ts b/src/client/src/lib/platform/chat/stream.tsindex 23cd37f5..4905899f 100644--- a/src/client/src/lib/platform/chat/stream.ts+++ b/src/client/src/lib/platform/chat/stream.ts@@ -39,6 +39,7 @@ const providerFactories: Record<string, ProviderFactory> = {xai: (apiKey) => createOpenAI({ baseURL: "https://api.x.ai/v1", apiKey }),huggingface: (apiKey) => createOpenAI({ baseURL: "https://api-inference.huggingface.co/v1", apiKey }),replicate: (apiKey) => createOpenAI({ baseURL: "https://openai-proxy.replicate.com/v1", apiKey }),+ minimax: (apiKey) => createOpenAI({ baseURL: "https://api.minimax.io/v1", apiKey }),};const VALID_PROVIDERS = Object.keys(providerFactories);diff --git a/src/client/src/lib/platform/openground/ai-sdk-adapter.ts b/src/client/src/lib/platform/openground/ai-sdk-adapter.tsindex 597dc05b..64498200 100644--- a/src/client/src/lib/platform/openground/ai-sdk-adapter.ts+++ b/src/client/src/lib/platform/openground/ai-sdk-adapter.ts@@ -74,22 +74,25 @@ export class AISdkAdapter {baseURL: 'https://openai-proxy.replicate.com/v1',apiKey}),+ minimax: (apiKey: string) => createOpenAI({+ baseURL: 'https://api.minimax.io/v1',+ apiKey+ }),};+ private static readonly SUPPORTED_PROVIDERS = [+ 'openai', 'anthropic', 'google', 'mistral', 'cohere',+ 'groq', 'perplexity', 'azure', 'together', 'fireworks',+ 'deepseek', 'xai', 'huggingface', 'replicate', 'minimax',+ ];+/*** Get provider factory with strict validation* Uses explicit allowlist to prevent user-controlled method invocation*/private static getProviderFactory(providerId: string): ProviderFactory | null {// Explicit allowlist of valid provider IDs- const validProviders = [- 'openai', 'anthropic', 'google', 'mistral', 'cohere',- 'groq', 'perplexity', 'azure', 'together', 'fireworks',- 'deepseek', 'xai', 'huggingface', 'replicate'- ];-- // Check against allowlist first- if (!validProviders.includes(providerId)) {+ if (!this.SUPPORTED_PROVIDERS.includes(providerId)) {return null;}@@ -188,12 +191,7 @@ export class AISdkAdapter {* Get list of supported provider IDs*/static getSupportedProviders(): string[] {- // Return only allowlisted providers for security- return [- 'openai', 'anthropic', 'google', 'mistral', 'cohere',- 'groq', 'perplexity', 'azure', 'together', 'fireworks',- 'deepseek', 'xai', 'huggingface', 'replicate'- ];+ return [...this.SUPPORTED_PROVIDERS];}/**diff --git a/src/client/src/lib/platform/pricing/chat-cost.ts b/src/client/src/lib/platform/pricing/chat-cost.tsindex bd4c5ae1..700a5890 100644--- a/src/client/src/lib/platform/pricing/chat-cost.ts+++ b/src/client/src/lib/platform/pricing/chat-cost.ts@@ -43,6 +43,7 @@ const INCLUSIVE_CACHE_PROVIDERS = new Set(["langchain","cohere","xai",+ "minimax","claude_agent_sdk","claude-agent-sdk","pydo",diff --git a/src/client/src/lib/platform/providers/default-models.ts b/src/client/src/lib/platform/providers/default-models.tsindex 44430d44..d6da306d 100644--- a/src/client/src/lib/platform/providers/default-models.ts+++ b/src/client/src/lib/platform/providers/default-models.ts@@ -135,6 +135,14 @@ export const DEFAULT_PROVIDERS: DefaultProviderEntry[] = [topP: { min: 0, max: 1, step: 0.01, default: 0.9, description: "Nucleus sampling threshold" },},},+ {+ providerId: "minimax", displayName: "MiniMax", description: "MiniMax M-series language models", requiresVault: true,+ configSchema: {+ temperature: { min: 0, max: 2, step: 0.1, default: 1, description: "Sampling temperature" },+ maxTokens: { min: 1, max: 1000000, step: 1, default: 1000, description: "Maximum tokens to generate" },+ topP: { min: 0, max: 1, step: 0.1, default: 0.95, description: "Nucleus sampling threshold" },+ },+ },];export const DEFAULT_MODELS_BY_PROVIDER: Record<string, DefaultModelEntry[]> = {@@ -1073,4 +1081,26 @@ export const DEFAULT_MODELS_BY_PROVIDER: Record<string, DefaultModelEntry[]> = {capabilities: ["streaming"],},],+ minimax: [+ {+ id: "MiniMax-M3",+ displayName: "MiniMax M3",+ contextWindow: 1000000,+ // Standard pay-as-you-go ≤512k (permanent 50% off the $0.60/$2.40/$0.12 list).+ inputPricePerMToken: 0.3,+ outputPricePerMToken: 1.2,+ cacheReadPricePerMToken: 0.06,+ capabilities: ["function-calling", "vision", "streaming", "thinking"],+ },+ {+ id: "MiniMax-M2.7",+ displayName: "MiniMax M2.7",+ contextWindow: 204800,+ inputPricePerMToken: 0.3,+ outputPricePerMToken: 1.2,+ cacheReadPricePerMToken: 0.06,+ cacheCreationPricePerMToken: 0.375,+ capabilities: ["function-calling", "streaming", "thinking"],+ },+ ],};