Skip to main content

เริ่มต้นใช้งาน Codex

เริ่มใช้ Codex ใน IDE, CLI หรือบน Cloud ได้เลย

ทุกแผน ChatGPT รวม Codex ไว้แล้ว นอกจากนี้ยังสามารถใช้ Codex ด้วย API credits โดย sign in ด้วย OpenAI API key

ตัวเลือกการติดตั้ง

เลือกช่องทางที่เหมาะกับคุณ: App, IDE Extension, CLI หรือ Cloud


ตัวเลือกที่ 1: App

Codex app รองรับ macOS และ Windows

ขั้นตอน

  1. ดาวน์โหลดและติดตั้ง Codex app

    • ดาวน์โหลดสำหรับ macOS (Apple Silicon)
    • ดาวน์โหลดสำหรับ macOS (Intel)
    • ดาวน์โหลดสำหรับ Windows
    • แจ้งเตือนเมื่อมีรุ่น Linux
  2. เปิด Codex และ sign in

    • Sign in ด้วย ChatGPT account หรือ OpenAI API key
    • หมายเหตุ: ฟีเจอร์บางอย่างอาจไม่พร้อมใช้เมื่อ sign in ด้วย API key
  3. เลือกโปรเจกต์

    • เลือกโฟลเดอร์โปรเจกต์ที่ต้องการให้ Codex ทำงาน
    • โปรเจกต์เก่าจะปรากฏหากเคยใช้งานไปแล้ว
  4. ส่งข้อความแรก

    • เลือก "Local" เพื่อทำงานบนเครื่องของคุณ
    • ตัวอย่าง prompt:
      • "Tell me about this project"
      • "Build a classic Snake game in this repo"
      • "Find and fix bugs in my codebase with minimal, high-confidence changes"

ตัวเลือกที่ 2: IDE Extension

  1. ติดตั้ง Codex extension

    • รองรับ Visual Studio Code, Cursor, Windsurf, VS Code Insiders
  2. เปิด Codex panel

    • Extension จะปรากฏใน sidebar; สามารถย้ายไปด้านขวาได้
  3. Sign in และเริ่ม task แรก

    • Codex เริ่มต้นใน Agent mode โดยค่าเริ่มต้น
    • สามารถอ่านไฟล์ รันคำสั่ง และบันทึกการเปลี่ยนแปลงได้
  4. ใช้ Git checkpoints

    • สร้าง checkpoint ก่อนและหลัง task เพื่อ revert ได้ง่าย

ตัวเลือกที่ 3: CLI

Codex CLI รองรับ macOS, Windows และ Linux

ขั้นตอน

  1. ติดตั้ง Codex CLI

    สำหรับ macOS/Linux:

    curl -fsSL https://chatgpt.com/codex/install.sh | sh

    สำหรับ Windows:

    powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

    ติดตั้งแบบ unattended: ตั้งค่า CODEX_NON_INTERACTIVE=1

    หรือใช้ทางเลือก:

    npm install -g @openai/codex
    # หรือ
    brew install --cask codex
  2. รัน codex และ sign in

    • ระบบจะแจ้งให้ sign in ด้วย ChatGPT account หรือ API key
  3. สั่งให้ Codex ทำงานใน directory ปัจจุบัน

    • ใช้ prompt เดียวกับตัวอย่างใน App
  4. ใช้ Git checkpoints

    • สร้าง checkpoint เพื่อ revert ได้ง่าย

ตัวเลือกที่ 4: Cloud

ใช้ Codex บน cloud ที่ chatgpt.com/codex

ขั้นตอน

  1. เปิด Codex ในเบราว์เซอร์

    • เข้าถึงได้ที่ chatgpt.com/codex
    • หรือแท็ก @codex ใน GitHub PR comment (ต้อง sign in ด้วย ChatGPT)
  2. ตั้งค่า environment

    • กำหนด environment settings
    • เชื่อมต่อ GitHub repository
  3. เริ่ม task และติดตามความคืบหน้า

    • ติดตามแบบ real-time ผ่าน logs
    • ปล่อยให้ task รันใน background
  4. รีวิวการเปลี่ยนแปลงและสร้าง pull request

    • รีวิว diff ใน diff view
    • แก้ไขเพิ่มเติมหรือสร้าง PR ตรงใน GitHub

ขั้นตอนต่อไป

  • ศึกษาเพิ่มเติมเกี่ยวกับ Codex app สำหรับการทำงานกับโปรเจกต์ local
  • Migrate ไปยัง Codex โดยย้ายไฟล์ instruction, การตั้งค่า MCP server, skills และ subagents