在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 "你是谁"
相关推荐
山间小僧20 小时前
「AI学习笔记」Agent Memory(二)跨会话记忆:从聊天记录到可演化的长期记忆
aigc·agent·vibecoding
烽火戏诸诸诸侯1 天前
AI 让我的独门小工具焕发第二春
后端·ai编程·vibecoding
不会喷火的小火龙1 天前
实测 DeepSeek V4.1 Flash 做全栈项目:我用它写了个 draw.io 绘图工具
工具·draw.io·vibecoding
PeterHan_Enjoy2 天前
用 AI 做了半年项目,我把省下的时间算了笔账
ai编程·vibecoding
山间小僧2 天前
「AI学习笔记」Agent Memory(一)会话内记忆
aigc·agent·vibecoding
濮水大叔4 天前
舒服了,CabloyJS 的 AI Spec 驱动开发会自动生成甘特图和燃尽图
typescript·node.js·vibecoding
梦想的颜色5 天前
【AI速览】2026年 9月 GPT‑6 Astra 深度解析:Agent 时代的前沿旗舰,能力、成本、落地痛点与选型判断
人工智能·openai·agent·astra·vibecoding·大模型测评·gpt6
刘同学有点忙6 天前
为了实现设计师想要的按钮动画,我Vibe了一个可视化小工具
vibecoding
codeniu6 天前
用 GitHub Issues 当数据库,零成本搭一个「提示词归档库」
vibecoding
摆烂工程师6 天前
别只拿 GPT-6 Astra 聊天,它真正恐怖的是开始会“干活”了
人工智能·程序员·vibecoding