如何将Codex接入本地QWen3.8模型
首先,使用llama.cpp建立QWen3.8-27B的服务器,笔者的API地址为http://192.168.3.13:8080
然后在~/.codex目录下新建local-llama.config.toml文件,写入以下配置
model="Qwen3.8-27B-UD-Q4_K_XL.gguf"# 模型标识名,llama.cpp 不校验,但建议写真实名model_provider="llama_cpp"model_context_window=128000# 跟 llama-server 的 -c 一致model_auto_compact_token_limit=100000model_reasoning_effort="low"model_reasoning_summary="detailed"# 显示详细推理摘要(auto/detailed/concise/hidden)hide_agent_reasoning=false# 不隐藏 agent 的推理过程show_raw_agent_reasoning=true# 显示原始推理内容(thinking blocks)model_supports_reasoning_summaries=true# 声明模型支持推理摘要approval_policy="never"# 或 "suggest",看你信任程度sandbox_mode="workspace-write"# 允许 Codex 写文件web_search="disabled"# 本地模型一般不支持联网搜索[features]apps=falseplugins=false[model_providers.llama_cpp]name="llama.cpp Local"base_url="http://192.168.3.13:8080/v1"#env_key = "LLAMA_API_KEY" # 从环境变量读取 API Key,不写死wire_api="responses"# 必须!Codex 2026 年初已移除 chat 支持request_max_retries=2stream_max_retries=5stream_idle_timeout_ms=300000[sandbox_workspace_write]network_access=true[tui]status_line=["model-with-reasoning","context-remaining","current-dir","git-branch"]下次启动codex的时候不要直接运行codex,而是运行
codex--profilelocal-llama