在 OpenCode 中使用 MiniMax M3:配置与价格

在 opencode.json 中添加 BigModel.io 服务商,即可在 OpenCode 中调用 MiniMax M3(minimax-m3)。输入 $0.30、输出 $1.20 / 百万 tokens,附可直接复制的配置。

模型 ID
minimax-m3
输入 / 百万
$0.30
输出 / 百万
$1.20
上下文
—

在 OpenCode 中配置 MiniMax M3

  1. 在 BigModel.io 控制台创建 API Key,并设置消费上限:Agent 会发送很长的上下文。
  2. 把下面的配置写入 ~/.config/opencode/opencode.json,并在终端里 export BIGMODEL_API_KEY。
  3. 运行 opencode;/models 中会在 BigModel.io 下列出 minimax-m3。

~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bigmodel": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "BigModel.io",
      "options": {
        "baseURL": "https://bigmodel.io/v1",
        "apiKey": "{env:BIGMODEL_API_KEY}"
      },
      "models": {
        "minimax-m3": {
          "name": "MiniMax M3"
        }
      }
    }
  },
  "model": "bigmodel/minimax-m3"
}

按开发商文档中的上下文长度添加 limit 配置,让 OpenCode 及时压缩历史。

先验证 Key 和模型

这个请求应该返回一句简短的回复。如果它失败,工具里也会以同样的方式失败。

curl https://bigmodel.io/v1/chat/completions \
  -H "Authorization: Bearer $BIGMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"minimax-m3","messages":[{"role":"user","content":"ping"}]}'

401 表示 Key 不对,404 表示模型 ID 不对;解决 401 · 解决 404

费用

MiniMax M3 输入 $0.30 / 百万 tokens,输出 $1.20 / 百万 tokens,缓存命中输入 $0.06 / 百万 tokens。一次典型 Agent 请求(输入 2 万、输出 2 千 tokens)约 $0.0084,100 次约 $0.840。 MiniMax M3 价格 →

其他组合