Codex 是 OpenAI 官方的桌面端 AI 编程 Agent。
安装 Codex
如果使用下方一键配置向导,可跳过 Codex CLI 的安装。向导检测不到codex 命令时,会询问是否安装官方 @openai/codex npm 包。
从 OpenAI Codex 页面 下载并安装 Codex 桌面客户端。
配置 MiniMax API
- 方式一:一键配置向导
- 方式二:手动配置
直接运行:在工具列表中选择 Codex。如果 Codex CLI 尚未安装,向导会提示安装。建议使用 Codex CLI 0.146.0 或更高版本。向导会配置
npx -y mmx-cli@latest agent setup
~/.codex/config.toml 和 ~/.codex/mmx-model-catalog.json。运行向导前,请关闭 Codex 以及正在打开 ~/.codex/config.toml 的编辑器,避免其他进程用旧内容覆盖刚写入的配置。配置完成后重启 Codex。详细参数和备份说明请见 MiniMax CLI。1
编辑配置文件
打开
~/.codex/config.toml,加入或更新以下内容,并将 <MINIMAX_API_KEY> 替换为你从 MiniMax 开放平台 获取的 Key:model = "MiniMax-M3.1-Flash-Preview"
model_provider = "minimax"
model_context_window = 524288
preferred_auth_method = "apikey"
forced_login_method = "api"
[model_providers.minimax]
name = "MiniMax"
base_url = "https://api.minimax.cn/v1"
experimental_bearer_token = "<MINIMAX_API_KEY>"
wire_api = "responses"
preferred_auth_method 和 forced_login_method 指定 API Key 认证。如需在 /model 中显示模型能力和思考档位,可继续配置下方的可选模型目录。2
重启 Codex 并开始使用 MiniMax-M3.1-Flash-Preview
重启 Codex,即可开始使用 MiniMax-M3.1-Flash-Preview。
配置模型能力目录(可选)
手动配置时,可以添加模型能力目录,让 Codex 在/model 中显示 MiniMax-M3.1-Flash-Preview 及其思考档位。在 ~/.codex/config.toml 中增加一行:model_catalog_json = "~/.codex/model-catalogs/custom-catalog.json"
~/.codex/model-catalogs/custom-catalog.json,写入模型配置:{
"models": [
{
"slug": "MiniMax-M3.1-Flash-Preview",
"display_name": "MiniMax-M3.1-Flash-Preview",
"description": "MiniMax M3.1 Flash Preview",
"default_reasoning_level": "max",
"supported_reasoning_levels": [
{ "effort": "low", "description": "Low" },
{ "effort": "medium", "description": "Medium" },
{ "effort": "high", "description": "High" },
{ "effort": "xhigh", "description": "Extra high" },
{ "effort": "max", "description": "Maximum" }
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 0,
"base_instructions": "You are Codex, a coding agent based on MiniMax-M3.1-Flash-Preview. You and the user share the same workspace and collaborate to achieve the user's goals.",
"supports_reasoning_summaries": true,
"default_reasoning_summary": "none",
"support_verbosity": false,
"truncation_policy": { "mode": "tokens", "limit": 10000 },
"supports_parallel_tool_calls": true,
"experimental_supported_tools": [],
"prefer_websockets": false,
"apply_patch_tool_type": "freeform",
"web_search_tool_type": "text",
"supports_image_detail_original": false,
"tool_mode": "code_mode_only",
"multi_agent_version": "v2",
"use_responses_lite": false,
"input_modalities": ["text", "image"],
"context_window": 524288,
"max_context_window": 524288,
"effective_context_window_percent": 95,
"auto_compact_token_limit": null,
"reasoning_summary_format": "experimental",
"supports_search_tool": true
}
]
}
不要在
supported_reasoning_levels 中加入 { "effort": "none" }。MiniMax-M3.1-Flash-Preview 始终会思考,选择该档位会让 Codex 发送 reasoning: {"effort": "none"},API 将返回 400。slug/display_name:模型在 Codex 配置与/model列表中的标识和展示名称,需与 API 中使用的模型名保持一致。default_reasoning_level:默认 reasoning effort。MiniMax-M3.1-Flash-Preview 默认使用max。supported_reasoning_levels:在/model中可切换的 reasoning 选项。MiniMax-M3.1-Flash-Preview 支持low、medium、high、xhigh和max,不支持none。base_instructions:Codex 使用该模型时附加的基础 system prompt,可用于声明模型身份和协作方式。supports_reasoning_summaries:开启 Codex 对该模型的 Responses API reasoning 路径。设置为true后,Codex 才会发送reasoning.effort;否则即使配置了default_reasoning_level,Codex 也会省略reasoning字段。示例中将default_reasoning_summary设为none,表示不额外请求 reasoning summary。shell_type:声明模型适配的 shell 工具调用类型,示例中使用shell_command。visibility/supported_in_api/priority:控制模型是否出现在列表中、是否可通过 API 使用,以及在模型列表中的排序优先级。supports_parallel_tool_calls:声明模型支持并行工具调用,便于 Codex 处理多个工具请求。experimental_supported_tools:预留的实验性工具能力列表;没有额外工具时保持空数组即可。input_modalities:声明模型支持的输入模态。["text", "image"]表示支持文本和图片输入。truncation_policy:控制内容截断策略,示例按 tokens 计数。context_window/max_context_window:示例中的客户端上下文窗口为推荐的 512K(524288 tokens),详见512K 配置建议。effective_context_window_percent/auto_compact_token_limit:以窗口的 95% 作为有效上下文预算,不另设固定的自动压缩阈值。
上下文窗口与费用优化(可选)
MiniMax-M3.1-Flash-Preview 最高支持 1M tokens 上下文。日常编程等多轮任务,可尝试将工具使用的上下文窗口设置为 512K,通过更早管理和压缩历史内容,减少后续请求携带的历史 token。需要持续保留大量代码或文档细节时,可使用 1M。为什么可以尝试 512K?
在使用 MiniMax-M3.1-Flash-Preview 进行的一次 ProgramBench 对比测试中,512K 与 1M 窗口下的平均模型表现接近,512K 的估算费用低约 20%。可以考虑将 512K 作为日常编程的可选配置。不同上下文窗口下的模型测试表现与消耗| 对比项 | 1M 窗口 | 512K 窗口 | 512K 相比 1M |
|---|---|---|---|
| 评测任务数 | 200 | 200 | 相同 |
| 模型表现 | 接近 | 接近 | 暂未检出明确差异 |
| 平均每任务总 token | 136.76 百万 | 111.42 百万 | 减少 18.5% |
| 用量计费预估 | 100% | 80.1% | 降低 19.9% |