minimax:https://platform.minimax.cn/docs/guides/quickstart-preparation
opencode:https://opencode.ai/zh/docs/models/#variants
OpenCode认证优先级:https://learnopencode.com/1-start/04-connect.html
minimax很便宜,但经常雷霆大思考,反应很慢。MiniMax-M3.1-Flash可以调整思考强度。在sdk中很好设置,如下,修改"output_config": {"effort": "max"}就行了。
bash
curl https://api.minimax.cn/anthropic/v1/messages \
-H "Authorization: Bearer <MINIMAX_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMax-M3.1-Flash",
"output_config": {"effort": "max"},
"max_tokens": 4096,
"messages": [
{"role": "user", "content": "Hi, how are you?"}
]
}'
但是,如果是在opencode这种agent中,如何设置?
设置配置文件:
Linux/macOS:~/.config/opencode/opencode.json
Windows:C:\Users<用户名>.config\opencode\opencode.json
方式一:
需要在环境变量中读取 API 地址和 Key
bash
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"minimax": {
"options": {
"baseURL": "https://api.minimax.cn/anthropic/v1"
},
"models": {
"MiniMax-M3.1-Flash": {
"options": {
"output_config": {
"effort": "max"
}
}
}
}
}
}
}
方式二:
bash
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"minimax": {
"npm": "@ai-sdk/anthropic",
"options": {
"baseURL": "https://api.minimax.cn/anthropic/v1",
"apiKey": "sk-cp-xxxxxxxxx"
},
"models": {
"MiniMax-M3.1-Flash": {
"options": {
"output_config": {
"effort": "max"
}
}
}
}
}
}
}
新方式
正常按opencode已有方式设置/models,然后在~/.config/opencode/opencode.json添加以下内容,然后按ctrl+t切换思考强度。
bash
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"minimax-cn-coding-plan": {
"models": {
"MiniMax-M3.1-Flash": {
"variants": [
{ "id": "low", "body": { "output_config": { "effort": "low" } } },
{ "id": "medium", "body": { "output_config": { "effort": "medium" } } },
{ "id": "high", "body": { "output_config": { "effort": "high" } } },
{ "id": "xhigh", "body": { "output_config": { "effort": "xhigh" } } },
{ "id": "max", "body": { "output_config": { "effort": "max" } } }
]
}
}
}
}
}