Skip to main content

อ้างอิงการตั้งค่า

เอกสารนี้อธิบาย configuration keys ของ Codex อย่างครบถ้วน โดยเฉพาะ config.toml และ requirements.toml

ภาพรวม

User-level configuration อยู่ที่ ~/.codex/config.toml โดยมี project-scoped overrides ใน .codex/config.toml ภายใน projects Project-scoped configs โหลดเฉพาะเมื่อ project ได้รับความไว้วางใจ

Keys บางตัวไม่สามารถ override ได้ในระดับ project รวมถึง:

  • Provider settings
  • Authentication configuration
  • Notification routes
  • Telemetry keys

Configuration profiles อยู่ที่ $CODEX_HOME/profile-name.config.toml และเลือกใช้ผ่าน --profile profile-name

หมวด Configuration หลัก

Model Settings

ระบุ active model (เช่น gpt-5.5), context window, reasoning effort, และ provider selection

Features

สลับเปิด/ปิดความสามารถต่าง ๆ เช่น web search, multi-agent collaboration, networking, memories, hooks, และ shell snapshots

Sandbox & Security

ตั้งค่า filesystem access levels, network policies, approval workflows, และ permissions profiles

Authentication

ตั้งค่า MCP OAuth callbacks, credentials storage, และ custom provider authentication

MCP Servers

กำหนด Model Context Protocol server connections ด้วย tools, environment variables, และ timeouts

Shell Environment

ควบคุม subprocess environment variable inheritance และ filtering ผ่าน policies

Notifications

ตั้งค่า system notifications, feedback submission, และ telemetry export

TUI Settings

ปรับแต่ง terminal UI behavior, keymaps, themes, และ status displays

Configuration Keys ที่ใช้บ่อย

Keyประเภทคำอธิบาย
approval_policystringควบคุมว่า execution จะหยุดรอ user approval เมื่อใด
default_permissionsstringกำหนด default sandbox access profile
features.network_proxybooleanเปิดใช้งาน sandboxed networking ด้วย domain policies
model_reasoning_effortstringปรับ reasoning intensity สำหรับ models ที่รองรับ
shell_environment_policytableจัดการ subprocess environment variables
tui.keymaptableปรับแต่ง keyboard shortcuts ในแต่ละ context

ทุก configuration key มีการระบุ type (boolean, string, number, array, table) และคำแนะนำอย่างละเอียดเกี่ยวกับค่าที่เหมาะสมและค่าเริ่มต้น

ตัวอย่างโครงสร้าง config.toml

# Model
model = "gpt-5.5"
model_reasoning_effort = "high"

# Approval
approval_policy = "on-request"
default_permissions = "workspace"

# Features
[features]
hooks = true
memories = false
shell_snapshot = true
web_search = true

# Shell Environment
[shell_environment_policy]
inherit = "none"
include = ["PATH", "HOME", "EDITOR"]

# TUI
[tui.keymap.global]
open_transcript = "ctrl-t"

หมายเหตุสำคัญ

  • Root TOML keys ต้องปรากฏก่อน tables
  • Keys ที่ optional และค่าเริ่มต้นเป็น unset จะแสดงแบบ commented ในตัวอย่าง
  • ควรลบหรือแก้ไขตัวอย่างให้เหมาะกับการตั้งค่าของคุณ
  • สร้าง Config profiles ในไฟล์แยกต่างหากได้