Skip to content

Commit 6da419d

Browse files
committed
feat: add MiniMax provider support with Anthropic-compatible API
- Add MiniMax provider supporting M2 model series - Create AnthropicCompatibleProvider base class for reusability - Support interleaved thinking, tool calling, and streaming - Add comprehensive tests (15 tests, 100% coverage) - Include usage examples and documentation - Bump version to 0.20251121.0 - Total providers now: 22
1 parent 13dc369 commit 6da419d

File tree

10 files changed

+872
-28
lines changed

10 files changed

+872
-28
lines changed

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
11
# CHANGELOG
22

3+
## 0.20251121.0 - MiniMax Provider Support
4+
5+
**Status**: Development Status :: 5 - Production/Stable
6+
7+
### New Provider
8+
9+
- **MiniMax**: Added support for MiniMax's M2 model series through their Anthropic-compatible API
10+
- **Provider name**: `minimax`
11+
- **API endpoint**: `https://api.minimax.io/anthropic` (international) or `https://api.minimaxi.com/anthropic` (China)
12+
- **Environment variable**: `MINMAX_API_KEY`
13+
- **Supported models**:
14+
- `minimax/MiniMax-M2` - Agentic capabilities with advanced reasoning
15+
- `minimax/MiniMax-M2-Stable` - Optimized for high concurrency and commercial use
16+
- **Key features**:
17+
- Interleaved thinking for complex reasoning tasks
18+
- Tool/function calling support
19+
- Streaming responses
20+
- Anthropic-compatible API format
21+
- **Documentation**: Added comprehensive example at `examples/providers/minimax_example.py`
22+
23+
### Architecture Improvements
24+
25+
- **Anthropic-Compatible Provider Base**: Created `AnthropicCompatibleProvider` base class
26+
- Enables easy integration of providers that implement Anthropic's API format
27+
- Similar architecture to `OpenAICompatibleProvider` for consistency
28+
- MiniMax is the first provider to use this new base class
29+
- Zero changes required to existing Anthropic provider (fully backward compatible)
30+
31+
### Configuration
32+
33+
```python
34+
# Using MiniMax
35+
from onellm import OpenAI
36+
37+
client = OpenAI()
38+
39+
# Basic chat completion
40+
response = client.chat.completions.create(
41+
model="minimax/MiniMax-M2",
42+
messages=[{"role": "user", "content": "Hello!"}],
43+
max_tokens=1000
44+
)
45+
46+
# With interleaved thinking for reasoning tasks
47+
response = client.chat.completions.create(
48+
model="minimax/MiniMax-M2",
49+
messages=[{"role": "user", "content": "Solve this problem: ..."}],
50+
max_tokens=500,
51+
thinking={"enabled": True, "budget_tokens": 20000}
52+
)
53+
```
54+
55+
### Testing
56+
57+
- Added 15 comprehensive unit tests for MiniMax provider
58+
- All tests passing with 100% coverage for new code
59+
- Verified Anthropic provider remains unaffected (17/17 tests passing)
60+
61+
### Documentation Updates
62+
63+
- Updated `examples/providers/README.md` to include MiniMax as provider #3
64+
- Added `examples/providers/minimax_example.py` with usage examples
65+
- Updated main README.md with MiniMax in provider list
66+
- Total supported providers now: **22**
67+
368
## 0.20251013.0 - Semantic Caching
469

570
**Status**: Development Status :: 5 - Production/Stable

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848

4949
The library follows the OpenAI client API design pattern, making it familiar to developers already using OpenAI and enabling easy migration for existing applications. **Simply change your import statements and instantly gain access to hundreds of models** across dozens of providers while maintaining your existing code structure.
5050

51-
With support for 21 implemented providers (and more planned), OneLLM gives you access to approximately 300+ unique language models through a single, consistent interface - from the latest proprietary models to open-source alternatives, all accessible through familiar OpenAI-compatible patterns.
51+
With support for 22 implemented providers (and more planned), OneLLM gives you access to approximately 300+ unique language models through a single, consistent interface - from the latest proprietary models to open-source alternatives, all accessible through familiar OpenAI-compatible patterns.
5252

5353
> [!NOTE]
54-
> **Ready for Use**: OneLLM now supports 21 providers with 300+ models! From cloud APIs to local models, you can access them all through a single, unified interface. [Contributions are welcome](./CONTRIBUTING.md) to help add even more providers!
54+
> **Ready for Use**: OneLLM now supports 22 providers with 300+ models! From cloud APIs to local models, you can access them all through a single, unified interface. [Contributions are welcome](./CONTRIBUTING.md) to help add even more providers!
5555
5656
---
5757

@@ -124,9 +124,9 @@ For more detailed examples, check out the [examples directory](./examples).
124124

125125
## 🌐 Supported Providers
126126

127-
OneLLM currently supports **21 providers** with more on the way:
127+
OneLLM currently supports **22 providers** with more on the way:
128128

129-
### Cloud API Providers (19)
129+
### Cloud API Providers (20)
130130
- **Anthropic** - Claude family of models
131131
- **Anyscale** - Configurable AI platform
132132
- **AWS Bedrock** - Access to multiple model families
@@ -146,6 +146,7 @@ OneLLM currently supports **21 providers** with more on the way:
146146
- **Vercel AI Gateway** - Gateway to 100+ models from multiple providers
147147
- **Vertex AI** - Google Cloud's enterprise Gemini
148148
- **X.AI** - Grok models
149+
- **MiniMax** - M2 model series with advanced reasoning
149150

150151
### Local Providers (2)
151152
- **Ollama** - Run models locally with easy management

examples/providers/README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OneLLM Provider Examples
22

3-
This directory contains comprehensive examples for all 21 providers supported by OneLLM. Each example demonstrates the unique features and capabilities of that provider.
3+
This directory contains comprehensive examples for all 22 providers supported by OneLLM. Each example demonstrates the unique features and capabilities of that provider.
44

55
## 📚 Provider Examples
66

@@ -16,107 +16,112 @@ This directory contains comprehensive examples for all 21 providers supported by
1616
- Multi-turn conversations, code generation
1717
- Required: `ANTHROPIC_API_KEY`
1818

19-
3. **[Google AI Studio](google_example.py)** - Gemini models with multimodal support
19+
3. **[MiniMax](minimax_example.py)** - M2 models with interleaved thinking
20+
- Advanced reasoning, agentic capabilities
21+
- Anthropic-compatible API
22+
- Required: `MINMAX_API_KEY`
23+
24+
4. **[Google AI Studio](google_example.py)** - Gemini models with multimodal support
2025
- Vision capabilities, long context
2126
- JSON mode, safety settings
2227
- Required: `GOOGLE_API_KEY`
2328

24-
4. **[Mistral](mistral_example.py)** - European AI with multilingual support
29+
5. **[Mistral](mistral_example.py)** - European AI with multilingual support
2530
- Multiple model sizes, function calling
2631
- Code generation, multilingual capabilities
2732
- Required: `MISTRAL_API_KEY`
2833

29-
5. **[Cohere](cohere_example.py)** - Enterprise NLP with RAG capabilities
34+
6. **[Cohere](cohere_example.py)** - Enterprise NLP with RAG capabilities
3035
- Command models, structured generation
3136
- Summarization, code explanation
3237
- Required: `COHERE_API_KEY`
3338

3439
### Fast Inference Providers
3540

36-
6. **[Groq](groq_example.py)** - Ultra-fast LPU inference
41+
7. **[Groq](groq_example.py)** - Ultra-fast LPU inference
3742
- Llama 3, Mixtral models
3843
- Performance benchmarks, streaming
3944
- Required: `GROQ_API_KEY`
4045

41-
7. **[Together AI](together_example.py)** - Fast open model inference
46+
8. **[Together AI](together_example.py)** - Fast open model inference
4247
- Llama, Mixtral, CodeLlama models
4348
- Quantized models, long context
4449
- Required: `TOGETHER_API_KEY`
4550

46-
8. **[Fireworks](fireworks_example.py)** - Optimized model serving
51+
9. **[Fireworks](fireworks_example.py)** - Optimized model serving
4752
- Speed tests, batch processing
4853
- Multilingual support
4954
- Required: `FIREWORKS_API_KEY`
5055

51-
9. **[Anyscale](anyscale_example.py)** - Scalable inference with Ray
52-
- Open-source models, JSON with schema
53-
- Simple pricing model
54-
- Required: `ANYSCALE_API_KEY`
56+
10. **[Anyscale](anyscale_example.py)** - Scalable inference with Ray
57+
- Open-source models, JSON with schema
58+
- Simple pricing model
59+
- Required: `ANYSCALE_API_KEY`
5560

5661
### Specialized Providers
5762

58-
10. **[X.AI (Grok)](xai_example.py)** - Grok models with 128K context
63+
11. **[X.AI (Grok)](xai_example.py)** - Grok models with 128K context
5964
- Long context handling, reasoning
6065
- Creative writing, analysis
6166
- Required: `XAI_API_KEY`
6267

63-
11. **[Perplexity](perplexity_example.py)** - Search-augmented AI
68+
12. **[Perplexity](perplexity_example.py)** - Search-augmented AI
6469
- Real-time web access, fact checking
6570
- Research assistant capabilities
6671
- Required: `PERPLEXITY_API_KEY`
6772

68-
12. **[DeepSeek](deepseek_example.py)** - Chinese AI with multilingual support
73+
13. **[DeepSeek](deepseek_example.py)** - Chinese AI with multilingual support
6974
- Strong Chinese language capabilities
7075
- Mathematical reasoning, code generation
7176
- Required: `DEEPSEEK_API_KEY`
7277

73-
13. **[OpenRouter](openrouter_example.py)** - Gateway to 100+ models
78+
14. **[OpenRouter](openrouter_example.py)** - Gateway to 100+ models
7479
- Free tier models, premium models
7580
- Model routing, variety showcase
7681
- Required: `OPENROUTER_API_KEY`
7782

78-
14. **[Moonshot](moonshot_example.py)** - Kimi models with long-context capabilities
83+
15. **[Moonshot](moonshot_example.py)** - Kimi models with long-context capabilities
7984
- Up to 200K token context
8085
- Multilingual Chinese/English support
8186
- Required: `MOONSHOT_API_KEY`
8287

83-
15. **[GLM (Zhipu AI)](glm_example.py)** - Chinese AI with GLM-4 models
88+
16. **[GLM (Zhipu AI)](glm_example.py)** - Chinese AI with GLM-4 models
8489
- Strong Chinese language capabilities
8590
- Vision and function calling support
8691
- Required: `GLM_API_KEY` or `ZAI_API_KEY`
8792

8893
### Multi-Provider Gateways
8994

90-
16. **[Vercel AI Gateway](vercel_example.py)** - Gateway to 100+ models
95+
17. **[Vercel AI Gateway](vercel_example.py)** - Gateway to 100+ models
9196
- Access to OpenAI, Anthropic, Google, Meta models
9297
- Unified billing and streaming
9398
- Required: `VERCEL_AI_API_KEY`
9499

95100
### Enterprise Cloud
96101

97-
17. **[Azure OpenAI](azure_example.py)** - Microsoft-hosted OpenAI
102+
18. **[Azure OpenAI](azure_example.py)** - Microsoft-hosted OpenAI
98103
- Enterprise deployments, content filtering
99104
- Custom endpoints, DALL-E 3
100105
- Required: Azure configuration file
101106

102-
18. **[AWS Bedrock](bedrock_example.py)** - Multi-provider on AWS
107+
19. **[AWS Bedrock](bedrock_example.py)** - Multi-provider on AWS
103108
- Claude, Llama, Titan models
104109
- Streaming, embeddings
105110
- Required: AWS credentials in `bedrock.json`
106111

107-
19. **[Vertex AI](vertexai_example.py)** - Google Cloud enterprise AI
112+
20. **[Vertex AI](vertexai_example.py)** - Google Cloud enterprise AI
108113
- Gemini models, multimodal support
109114
- Enterprise features, batch processing
110115
- Required: Service account JSON
111116

112117
### Local Providers
113118

114-
20. **[Ollama](ollama_example.py)** - Local model management
119+
21. **[Ollama](ollama_example.py)** - Local model management
115120
- Dynamic endpoint routing
116121
- Model management, custom endpoints
117122
- Required: Ollama running locally
118123

119-
21. **[llama.cpp](llama_cpp_example.py)** - Direct GGUF execution
124+
22. **[llama.cpp](llama_cpp_example.py)** - Direct GGUF execution
120125
- Model loading, GPU acceleration
121126
- Token counting, performance tuning
122127
- Required: GGUF model files

0 commit comments

Comments
 (0)