在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 "你是谁"
相关推荐
温暖的苹果10 小时前
opencode 配置完全指南:配置文件、目录与字段详解
ai·llm·agent·vibecoding·opencode
程序员柒叔17 小时前
luna 的内心独白:我把一个本该暂停的任务,跑成了几十轮空转
agent·ai编程·vibecoding
Darling噜啦啦2 天前
告别 Vibe Coding 混乱:SDD 规范驱动开发,从文档先行到 AI 协作的完整方法论
vibecoding
火云牌神3 天前
跨多数据源架构:让 AI 不再绑死数据库
数据库·人工智能·架构·vibecoding
深度睡眠4 天前
知识工作者如何用TRAE Work构建个人/团队知识库,让死材料‘活’过来”
vibecoding
小林ixn5 天前
Vibe Coding 爽完就返工?试试 Spec-Driven Development:AI 时代真正的工作流
agent·vibecoding
Captaincc5 天前
Show me your works & token -稀土掘金上线内测作品广场和用量统计
前端·掘金社区·vibecoding
嘟嘟07175 天前
SDD 规范驱动开发:从 vibe coding 崩盘到"两次创造"
设计模式·代码规范·vibecoding
掘金酱5 天前
Vibe作品广场首发挑战来啦!发布作品,赢富士拍立得等千元好礼
openai·ai编程·vibecoding
AprChell5 天前
DeepSeek Harness 开源了一套 Vibe Coding 工程流水线
ai编程·deepseek·vibecoding