Featured image of post OMP M3 Model Patch: Adding MiniMax M3 to pi-ai

OMP M3 Model Patch: Adding MiniMax M3 to pi-ai

How to add MiniMax M3 model support to the bundled models.json in @oh-my-pi/[email protected] before upstream ships an official entry.

语速

MiniMax released M3 on 2026-06-01 (minimax/minimax-m3-20260531 on OpenRouter), but the upstream models.json shipped by @oh-my-pi/[email protected] hadn’t been updated to include it. This post documents the patch I applied to add M3 support across all five provider endpoints.

Target File

1
~/.bun/install/global/node_modules/@oh-my-pi/pi-ai/src/models.json

Provider Entries Added (5)

All entries are appended at the end of their respective provider object, mirroring the structure of the existing MiniMax-M2.7 entry.

1. minimax (Official Anthropic-compatible API)

  • key: MiniMax-M3
  • api: anthropic-messages
  • baseUrl: https://api.minimax.io/anthropic
  • contextWindow: 204800, maxTokens: 131072
  • cost: input 0.3, output 1.2, cacheRead 0.06, cacheWrite 0.375
  • thinking: budget mode, minimal..xhigh

2. minimax-cn (Official Anthropic-compatible API, China)

  • key: MiniMax-M3
  • api: anthropic-messages
  • baseUrl: https://api.minimaxi.com/anthropic
  • Same context/cost/thinking as minimax

3. minimax-code (Coding Plan, OpenAI-compatible)

  • key: MiniMax-M3
  • api: openai-completions
  • baseUrl: https://api.minimax.io/v1
  • cost: all 0 (Coding Plan flat-rate)
  • compat: supportsStore=false, supportsDeveloperRole=false, supportsReasoningEffort=false, reasoningContentField=reasoning_content
  • thinking: effort mode, minimal..high

4. minimax-code-cn (Coding Plan CN)

Mirror of minimax-code with baseUrl: https://api.minimaxi.com/v1 and provider minimax-code-cn.

5. openrouter (OpenRouter Passthrough)

  • key: minimax/minimax-m3-20260531
  • api: openai-completions
  • baseUrl: https://openrouter.ai/api/v1
  • cost: input 0.3, output 1.2, cacheRead 0.05, cacheWrite 0
  • thinking: effort mode, minimal..high

Verification

Searching for "MiniMax-M3|minimax-m3" in the patched file returns exactly 5 hits — one per provider block.

Caveats

  • omp update will overwrite the patch. Re-apply after updates, or pin the package version.
  • If upstream later ships an official M3 entry, our local copy may diverge (custom pricing/context) until the next update.
  • Pricing values for M3 were inferred from the M2.7 template and the OpenRouter listing ($0.30 / $1.20). Confirm against the official MiniMax pricing page if cost accuracy matters.
  • Context window (204800) and maxTokens (131072) mirror M2.7 — adjust if M3 differs at GA.

Addendum (2026-06-02): The proper route via OMP user config

The pi-ai patch above is a hack — any omp update re-pulls the package and the patch is gone. The proper OMP way is ~/.omp/agent/models.yml: a user-level file that OMP merges on top of the built-in catalog, with no bun-global dependency, and which omp update leaves alone.

Final config

Append to ~/.omp/agent/models.yml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# MiniMax M3 Code Plan
# Set MINIMAX_API_KEY in ~/.zshenv first
  minimax:
    baseUrl: https://api.minimaxi.com/anthropic
    apiKey: MINIMAX_API_KEY
    api: anthropic-messages
    authHeader: true
    disableStrictTools: true
    models:
      - id: MiniMax-M3
        name: MiniMax M3
        reasoning: true
        input: [text, image]
        contextWindow: 1000000
        maxTokens: 16384
        cost:
          input: 0
          output: 0
          cacheRead: 0
          cacheWrite: 0

apiKey: MINIMAX_API_KEY follows OMP’s resolution rule: try the value as an env-var name first, then fall back to a literal. I export MINIMAX_API_KEY=$MINIMAX_CODE_PLAN_KEY in ~/.zshenv, so the key is sourced at runtime and the dotfile stays clean for git.

Key choices

Why anthropic-messages, not openai-completions: M3 speaks both protocols. The openai-completions route had two friction points:

  • OMP’s openai-completions transport emits developer role + reasoning_effort for reasoning models. MiniMax’s schema check is stricter than OpenAI’s, and an empty reasoning field occasionally 400s
  • After switching to anthropic-messages, tool calls and streaming reasoning go through the Anthropic SDK normalization path — same as kimi and claude

Why disableStrictTools: true: The Anthropic SDK sends strict: true on every tool definition by default. Third-party Anthropic-fronted gateways (MiniMax, kimi, etc.) usually don’t recognize the field and 400. The kimi provider in the same file already sets this flag. The trade-off is that tool schemas are not server-side validated, so prompts have to carry the schema discipline.

Context 1M / maxTokens 16K: contextWindow: 1000000 matches OpenRouter’s spec for minimax/minimax-m3-20260531 (M2.7 was 204800, M3 is 5× that). maxTokens: 16384 carries over from M2.7 — I couldn’t find an official M3 number. cost is all zero because the Code Plan is flat-rate.

Switching to it

1
2
3
4
5
# At launch
omp --model minimax/MiniMax-M3

# Or in the TUI
/model minimax/MiniMax-M3

After the switch, /status should show ANTHROPIC_BASE_URL pointing at api.minimaxi.com/anthropic.

How the two routes compose

Dimensionpi-ai bundled models.json patchmodels.yml custom provider
Persistenceomp update wipes itPersistent
Cross-machine syncNo (bun-global path)Yes (dotfile in git)
Upgrade costRe-apply patchOMP merges automatically
Merge with built-inYesYes, last-write-wins

The two compose. models.yml providers enter through OMP’s “custom” channel; whatever pi-ai later ships in its bundled list (if M3 lands upstream) enters through the “built-in” channel. When both define the same provider/model with different baseUrl, OMP’s last-write-wins rule means models.yml always wins — which is exactly what you want for a CN endpoint override.