Files
Plexum-minimax-provider/README.md
hzhang b7fad6dd26 docs: clarify Token Plan vs pay-per-token billing (key + model matrix)
Field investigation against the live API:
- sk-cp- (Token Plan)  + MiniMax-M2.7           →  works
- sk-cp- (Token Plan)  + MiniMax-M2.7-highspeed →  "Token Plan Starter
  (0/0 used)" — the base Token Plan EXCLUDES the highspeed variant
- sk-api- (pay-per-token) + either model        →  structurally
  (needs balance > 0; otherwise "insufficient_balance (1008)")

Plugin code already handles both key types via the same
Authorization: Bearer header — no functional change needed. README now
makes the matrix explicit so operators don't try highspeed on a
plan-only key and wonder why "0/0 used" comes back.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 16:10:11 +01:00

86 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Plexum-minimax-provider
Plexum ProviderPlugin that serves **MiniMax** models via MiniMax's
Anthropic-compatible HTTP endpoint.
## Status
**v0.1 — current**: API key auth, streaming SSE, declared models
`MiniMax-M2.7` + `MiniMax-M2.7-highspeed`. Backend fixed to `api`
(global `https://api.minimax.io/anthropic` or CN `https://api.minimaxi.com/anthropic`).
**Deferred**: OAuth (Code Plan portal), MiniMax Portal provider, image /
TTS / video / music providers (separate plugins later if wanted).
## API key + model matrix
MiniMax issues two key types from the same Anthropic-compatible endpoint;
this plugin sends both with `Authorization: Bearer <key>` and lets the
server decide. The key prefix tells you which billing model you're on:
| key prefix | billing | `MiniMax-M2.7` | `MiniMax-M2.7-highspeed` |
|---|---|---|---|
| `sk-cp-...` | **Token Plan** (per-plan quota) | ✅ included | ❌ `Token Plan Starter (0/0 used)` — highspeed is NOT in the base Token Plan |
| `sk-api-...` | **pay-per-token** (per-request billed) | ✅ if balance > 0; else `insufficient_balance (1008)` | ✅ if balance > 0 |
**Takeaway**: if you only have a Token Plan key, set the agent's model
to `MiniMax-M2.7` (base). For the highspeed variant you need a funded
`sk-api-` key. The plugin doesn't reject highspeed at startup — the
error surfaces in the agent's response when the model is invoked.
## Install
```bash
cd ~/Plexum-minimax-provider
./scripts/install.sh
```
Then:
1. **Write API key** to `~/.plexum/plugins/plexum-minimax-provider/config.json`:
```json
{
"api_key": "sk-cp-..."
}
```
(`chmod 600` it.)
2. **Allow the plugin** in `~/.plexum/plexum.json`:
```json
{"plugins": {"allow": ["plexum-minimax-provider"]}}
```
3. **Point an agent at a MiniMax model**:
```bash
plexum agent-add --model MiniMax-M2.7 my-agent
```
4. **Restart** the gateway and talk:
```bash
systemctl --user restart plexum
plexum say --agent-id my-agent --session-id $(plexum new-session --agent-id my-agent) "hello"
```
## Config options
| Field | Default | Notes |
|---|---|---|
| `api_key` | (required) | `sk-cp-...` style key from MiniMax |
| `region` | `global` | `cn` switches to `api.minimaxi.com` |
| `base_url` | | override either region's default |
| `max_tokens_default` | `4096` | used when `TurnRequest.MaxTokens` is unset |
## Architecture
- `internal/anthropic/` — minimal HTTP+SSE Anthropic Messages client
- `internal/translate/` — `canonical.TurnRequest` ↔ Anthropic Messages,
SSE Event → `canonical.TurnEvent` per-block state machine
- `cmd/plexum-minimax-provider-plugin/` — Plexum SDK ProviderPlugin entry
Both `text`, `thinking`, and `tool_use` content blocks round-trip
losslessly (signatures preserved for thinking blocks).
## License
Same as Plexum.