在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 "你是谁"
相关推荐
濮水大叔11 小时前
AI Vibe Coding 实战:SMS 套件提示词与开发方案
ai编程·全栈·vibecoding
review4454315 小时前
拿到 codex 第一步
前端·agent·vibecoding
Logic6473 天前
我给 12 家 AI 编码 agent 造了个本地记忆库:会话自动捕获 + MCP「连接即续接」(开源)
vibecoding
Behavior4 天前
Kimi K3.1 疑似现身 LMArena:匿名代号 Kibitz、SGLang 单日六条加固 PR,月底有望官宣
llm·aigc·vibecoding
Sunshine2104 天前
用 Tauri + Rust 做了个微信多开工具:macOS 副本克隆与 Windows 互斥体关闭的实现
vibecoding
程序员老刘5 天前
你会去Review AI写的代码吗?
ai编程·vibecoding
行者全栈架构师5 天前
我让 AI 独立开发了一款游戏:零依赖、188 个测试全绿、工期压到四分之一
typescript·canvas·vibecoding
feiyu_gao9 天前
可验证的 AI:如何让 Agent 用代码自证正确
aigc·ai编程·vibecoding
Behavior11 天前
Agent Skill 装过上百个,最后我只留下了这几个
aigc·agent·vibecoding
duanze11 天前
从零开始Android商业项目Vibe coding完全指南(十一)
app·vibecoding