在Codex中配置使用智谱、Ollama本地模型

编辑config.toml文件:

js 复制代码
# model_provider = "wenwen"
# model = "gpt-5.2"

model_provider = "glm"
model = "glm-4.7"

model_reasoning_effort = "medium"

# 定义 Codex 执行敏感操作(如删除文件、安装包)时是否询问。
approval_policy = "never"
# 沙箱模式。restricted (受限), danger-full-access (允许 AI 完全访问你的本地系统文件和网络)
sandbox_mode = "danger-full-access"
# 隐私保护。开启后,Codex 不会将对话历史和代码上下文存储在本地日志或云端缓存中。
disable_response_storage = true

# --- windows wsl 设置(系统兼容) --- 
windows_wsl_setup_acknowledged = true


[model_providers.glm]
name = "glm"
base_url="https://open.bigmodel.cn/api/coding/paas/v4"
env_key="GLM_API_KEY"
wire_api = "chat"

[model_providers.wenwen]
name = "wenwen"
base_url="https://code.wenwen-ai.com/v1"
wire_api = "responses"
requires_openai_auth = true

[model_providers.ollama]
name = "Ollama"
base_url="http://127.0.0.1:11434/v1"
env_key="ollama"

# --- 属性 ---
[profiles.use-glm]
model = "glm-4.7"
model_provider = "glm"

[profiles.use-wenwen]
model = "gpt-5.2"
model_provider = "wenwen"

[profiles.use-ollama]
model = "deepseek-r1:8b"
model_provider = "ollama"


[notice]
hide_gpt5_1_migration_prompt = true

[features]
# enable_experimental_windows_sandbox = true  # 旧版
experimental_windows_sandbox = true
streamable_shell = true          # enable the streamable exec tool
web_search_request = true        # allow the model to request web searches

切换模型:

使用智谱的模型:

js 复制代码
codex --profile use-glm "你是谁"

使用问问的模型:

js 复制代码
codex --profile use-wenwen "你是谁"
相关推荐
摆烂菜鸡沧99619 小时前
【需求分析】基于 GPT-5.6 + Codex 开发个人工具箱 Personal Toolbox 项目
gpt·ai编程·vibecoding
牧艺1 天前
别让 Agent 猜需求:前端用「一页 Spec」把返工砍掉一半
人工智能·agent·vibecoding
牧艺2 天前
别急着 Vibe Coding:AI 三小时写完需求后,我为什么宁愿多花一天
前端·agent·vibecoding
浮生望2 天前
Vibe Coding工程化指南:九步前置法告别AI屎山代码
vibecoding
cyadyx5 天前
【Vibe Coding】CodeGraph 使用文档
vibecoding·codegraph
To_OC7 天前
一次 git reset 翻车,让我彻底分清了 hard 和 soft,也想通了 Vibe Coding 的本质
git·程序员·vibecoding
编程小明7 天前
Hold Rein 代码图插件:让 AI 先看懂项目关系,再开始写代码
agent·vibecoding
浮生望7 天前
Vibe Coding 实战指南:先规划再编码,用胶水思维告别 AI 幻觉代码
vibecoding
Darling噜啦啦8 天前
Vibe Coding 工程化指南:9 步前置流程告别 AI 屎山代码
vibecoding
臼犀8 天前
大语言模型响应延迟对软件工程师尿液浓缩程度的影响 —— 一项基于水杯见底速度的观察性研究
程序员·ai编程·vibecoding