MiniMax 10 月 19 日发布的 M3.1 Flash,在 OpenCode 里有一个限时免费版,不登录、不填 Key 就能直接用。我在一个空的 Spring Boot 项目里让它写了个接口,代码编译运行都正常。但用 curl 不带 Key 直接请求 OpenCode 的推理接口,同一个免费模型返回 403。想在自己的程序里免费调用,可以看 OpenRouter 的 :free 版本。
免费的是哪个版本
MiniMax 的官方博客写明 M3.1 Flash 于 2026 年 10 月 19 日上线,按量价格是每百万 token 输入 0.15 美元、输出 0.60 美元、缓存输入 0.015 美元,可以通过 MiniMax API、M Plan 和 MiniMax Code 使用。博客还说模型权重会晚些发布。
OpenCode 的 Zen 文档把它列成 MiniMax M3.1 Flash Free,模型 ID 是 minimax-m3.1-flash-free,价格表里输入、输出和缓存读取都写着 Free。文档原话是 free on OpenCode for a limited time,没有给截止日期。数据方面写的是 Its provider follows a zero-retention policy and does not use your data for model training,也就是提供方不留存数据、不拿来训练。同一页里还有一份不提供服务的国家和地区名单,中国大陆、香港和澳门都在里面,不过这份名单是写在 Beam Free 这款模型下面的,MiniMax 这条没有附地区限制。
在 OpenCode 里实际跑一次
我用的是 npm 装的 OpenCode 1.19.3,没有登录任何账号。第一次列模型时本地缓存里还没有这款模型,加 --refresh 从 models.dev 刷新之后才出现。测试项目是一个只带 spring-boot-starter-web 的 Spring Boot 4.1.1 空项目,JDK 21。
opencode models --refresh | grep minimax
opencode run --model opencode/minimax-m3.1-flash-free "在这个 Spring Boot 项目里新增一个 HelloController,包名 com.example.demo,提供 GET /hello 接口,接收可选参数 name(默认 Spring),返回字符串 Hello, <name>!。只改代码,不要运行 mvn。" </dev/null
第一次运行时我没有关闭标准输入,进程停在初始化阶段,7 分钟没有任何输出,我手动结束了它。改成上面这样加上 </dev/null 再跑,前后 12 秒左右就结束了。OpenCode 的输出如下:
I'll explore the project structure first.
Simple Spring Boot project with `spring-boot-starter-web`. Creating the controller:
Created `src/main/java/com/example/demo/HelloController.java`:
- `@RestController` with `@GetMapping("/hello")`
- `@RequestParam(name = "name", defaultValue = "Spring")` for the optional param
- Returns `"Hello, " + name + "!"`
No `mvn` was run, per your instruction. Note: `spring-boot-starter-web` in Boot 4.x serves `String` returns as `text/plain` by default, so the response body will be exactly `Hello, Spring!` (or `Hello, <name>!`).
它生成的 HelloController.java:
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello(@RequestParam(name = "name", defaultValue = "Spring") String name) {
return "Hello, " + name + "!";
}
}
接着用 mvn package 打包并启动,启动日志里的两行:
2026-10-20T08:18:50.911+08:00 INFO 377926 --- [ main] o.s.boot.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2026-10-20T08:18:50.922+08:00 INFO 377926 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.271 seconds (process running for 1.642)
请求 /hello 和 /hello?name=spring4all,分别返回:
Hello, Spring!
Hello, spring4all!
绕开客户端直接调接口会怎样
Zen 文档给免费模型列的接口地址是 https://opencode.ai/inference/openai/v1/chat/completions,和收费的 MiniMax M3 等模型是同一个 OpenAI 兼容端点。我用 curl 直接请求,只带了 Content-Type,没有 Key,也没有模拟 OpenCode 客户端的任何请求头:
curl -s -w '\nHTTP %{http_code}\n' https://opencode.ai/inference/openai/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"minimax-m3.1-flash-free","messages":[{"role":"user","content":"用一句话介绍 Spring Boot"}],"max_tokens":200}'
返回的是:
{"type":"error","error":{"type":"FreeTierError","message":"OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building."}}
HTTP 403
错误类型是 FreeTierError,提示 OpenCode 的免费档只能在 OpenCode 里面用。Zen 文档的免费模型说明里没有写这条限制,依据就是这段返回信息,隔一段时间再请求一次结果相同。服务端具体靠什么识别客户端,这次没有去试。按这个提示,想把它接进 Spring AI 这类自己的程序,OpenCode 免费档这条路走不通。
想用 API 调就看 OpenRouter
OpenRouter 上同时有一个免费版本,模型 ID 是 minimax/minimax-m3.1-flash:free,见它的模型页。我查了 OpenRouter 公开的模型列表接口,这一条的输入输出价格都是 0,上下文 1,000,000 token,最大输出 524,288 token,创建时间换算过来是北京时间 10 月 19 日 11:12。模型页的数据策略写着不用于训练,但会保留提示词。
免费模型的限流规则在 OpenRouter 的限额文档里,所有以 :free 结尾的模型都适用:
| 累计购买额度 | 每分钟请求数 | 每天请求数 |
|---|---|---|
| 少于 10 credits | 20 | 50 |
| 至少 10 credits | 20 | 1000 |
文档还写了,账户余额为负时,免费模型也可能返回 402。调用要先在 OpenRouter 注册并创建 API Key,接口是 OpenAI 兼容的。这次我手上没有 OpenRouter 的 Key,没有实际调用这个免费版本。
OpenCode 这份免费名单里还有 Nemotron 3.5 Lightning Free,同一款模型在 Vercel AI Gateway 上也有免费试用端点,见 Vercel 免费 Nemotron 和 Arm 免费课那篇。OpenCode 本身的安装和配置,在 OpenCode 搭配 GitHub Copilot 那篇里讲过。
一起交流
分享你的思考,让讨论更进一步。