# Track Specification: MiniMax Provider Integration

## Overview
Add MiniMax as a new AI provider to Manual Slop. MiniMax provides high-performance text generation models (M2.5, M2.1, M2) with massive context windows (200k+ tokens) and competitive pricing.

## Documentation
See all ./doc_*.md files

## Current State Audit
- `src/ai_client.py`: Contains provider integration for gemini, anthropic, gemini_cli, deepseek
- `src/gui_2.py`: Line 28 - PROVIDERS list
- `src/app_controller.py`: Line 117 - PROVIDERS list
- credentials.toml: Has sections for gemini, anthropic, deepseek

## Integration Approach
Based on MiniMax documentation, the API is compatible with both **Anthropic SDK** and **OpenAI SDK**. We will use the **OpenAI SDK** approach since it is well-supported and similar to DeepSeek integration.

### API Details (from platform.minimax.io)
- **Base URL**: `https://api.minimax.chat/v1`
- **Models**:
  - `MiniMax-M2.5` (204,800 context, ~60 tps)
  - `MiniMax-M2.5-highspeed` (204,800 context, ~100 tps)
  - `MiniMax-M2.1` (204,800 context)
  - `MiniMax-M2.1-highspeed` (204,800 context)
  - `MiniMax-M2` (204,800 context)
- **Authentication**: API key in header `Authorization: Bearer <key>`

## Goals
1. Add minimax provider to Manual Slop
2. Support chat completions with tool calling
3. Integrate into existing provider switching UI

## Functional Requirements
- FR1: Add "minimax" to PROVIDERS list in gui_2.py and app_controller.py
- FR2: Add minimax credentials section to credentials.toml template
- FR3: Implement _minimax_client initialization
- FR4: Implement _list_minimax_models function
- FR5: Implement _send_minimax function with streaming support
- FR6: Implement error classification for MiniMax
- FR7: Add minimax to provider switching dropdown in GUI
- FR8: Add to ai_client.py send() function routing
- FR9: Add history management (like deepseek)

## Non-Functional Requirements
- NFR1: Follow existing provider pattern (see deepseek integration)
- NFR2: Support tool calling for function execution
- NFR3: Handle rate limits and auth errors
- NFR4: Use OpenAI SDK for simplicity

## Architecture Reference
- `docs/guide_architecture.md`: AI client multi-provider architecture
- Existing deepseek integration in `src/ai_client.py` (lines 1328-1520)

## Out of Scope
- Voice/T2S, Video, Image generation (text only for this track)
- Caching support (future enhancement)
