Nara Switch · การตั้งค่า

ปรับแต่ง
Nara Switch

Nara Switch ใช้ไฟล์ config.json ไฟล์เดียวในการตั้งค่าทุกอย่าง — proxy, failover, tracking, และ CLI profiles

ไฟล์ config

ตำแหน่งไฟล์ config.json

ตำแหน่งตามระบบปฏิบัติการ — ไฟล์จะถูกสร้างอัตโนมัติเมื่อใช้ครั้งแรก

macOS~/Library/Application Support/nara-switch/config.json
Windows%APPDATA%\nara-switch\config.json
Linux~/.config/nara-switch/config.json

Proxy & Failover

ตั้งค่า Proxy

Nara Switch รัน proxy ในเครื่อง — รับ request แล้วส่งต่อไปยัง provider ที่เลือก พร้อม failover อัตโนมัติ

port number
ค่าเริ่มต้น: 11434

พอร์ตที่ proxy รัน

failover.enabled boolean
ค่าเริ่มต้น: true

เปิด failover อัตโนมัติเมื่อ provider หนึ่งล่ม

failover.order string[]
ค่าเริ่มต้น: ["codex","claude","gemini"]

ลำดับ failover — ลอง provider ตามลำดับนี้

tracking.enabled boolean
ค่าเริ่มต้น: true

บันทึกสถิตการใช้งาน — token, cost, latency

tracking.log_file string
ค่าเริ่มต้น: ~/.nara-switch/usage.log

ที่เก็บไฟล์ log การใช้งาน

ตัวอย่าง config.json

{
  "proxy": {
    "port": 11434,
    "failover": {
      "enabled": true,
      "order": ["codex", "claude", "gemini"]
    }
  },
  "tracking": {
    "enabled": true,
    "log_file": "~/.nara-switch/usage.log"
  },
  "profiles": {
    "default": "codex",
    "codex": { "provider": "openai", "model": "gpt-5-codex" },
    "claude": { "provider": "anthropic", "model": "claude-sonnet-4-6" }
  }
}

คำสั่ง

คำสั่ง CLI

จัดการ config ผ่าน command line

nara-switch config showแสดง config ปัจจุบัน
nara-switch config set <key> <value>ตั้งค่า — เช่น proxy.port 8080
nara-switch config resetรีเซ็ตเป็นค่าเริ่มต้น
nara-switch profile add <name>เพิ่ม CLI profile ใหม่
nara-switch profile use <name>สลับ profile เริ่มต้น