การตั้งค่า VS Code Extension

เอกสารนี้อธิบายวิธีการตั้งค่า VS Code Extension เพื่อเชื่อมต่อกับ GLM Coding Plan จาก z.ai โดยรองรับ Extensions ยอดนิยม 3 ตัว ได้แก่ Continue, Cline และ Roo Code

ข้อกำหนดเบื้องต้น

รายการ คำอธิบาย หมายเหตุ
z.ai Account บัญชี z.ai พร้อมการสมัครสมาชิก GLM Coding Plan สมัครสมาชิกที่นี่
API Key API Key จาก z.ai ดูได้จาก Dashboard > API Keys
VS Code Visual Studio Code เวอร์ชันล่าสุด ดาวน์โหลดที่นี่

Extensions ที่รองรับ

Extension คุณสมบัติหลัก แนะนำสำหรับ ราคา
Continue Free, Open-source, รองรับหลาย Provider การใช้งานทั่วไป, ผู้เริ่มต้น ฟรี
Cline Autonomous Coding Agent, MCP Support การทำงานขั้นสูง, Automation ฟรี
Roo Code Fork จาก Cline พร้อมฟีเจอร์เพิ่มเติม ทางเลือกแทน Cline ฟรี

การตั้งค่า Continue

ขั้นตอนการกำหนดค่า

1

เปิด Continue โดยคลิกไอคอน Continue ใน Activity Bar

2

คลิกไอคอน Gear (Settings) หรือกด Cmd + I

3

เลือก Open Config File

ไฟล์ config.json

{
  "models": [
    {
      "title": "GLM-4.7",
      "provider": "anthropic",
      "apiBase": "https://open.bigmodel.cn/api/anthropic",
      "apiKey": "your-api-key-here",
      "model": "GLM-4.7",
      "contextLength": 128000,
      "completionOptions": {
        "temperature": 0.7,
        "maxTokens": 4096
      }
    }
  ],
  "tabAutocompleteModel": {
    "title": "GLM-4-Flash",
    "provider": "anthropic",
    "apiBase": "https://open.bigmodel.cn/api/anthropic",
    "apiKey": "your-api-key-here",
    "model": "GLM-4-Flash"
  }
}

การตั้งค่า Cline

ขั้นตอนการกำหนดค่า

1

เปิด Cline โดยคลิกไอคอน Cline ใน Activity Bar

2

คลิก Settings (ไอคอนฟันเฟือง)

3

เลือก API Provider เป็น Anthropic

การตั้งค่าผ่าน VS Code Settings (JSON)

{
  "cline.apiProvider": "anthropic",
  "cline.anthropicBaseUrl": "https://open.bigmodel.cn/api/anthropic",
  "cline.anthropicApiKey": "your-api-key-here",
  "cline.modelId": "GLM-4.7",
  "cline.maxTokens": 4096,
  "cline.temperature": 0.7
}

การตั้งค่า Roo Code

การตั้งค่าผ่าน VS Code Settings (JSON)

{
  "rooCode.apiProvider": "anthropic",
  "rooCode.anthropicBaseUrl": "https://open.bigmodel.cn/api/anthropic",
  "rooCode.anthropicApiKey": "your-api-key-here",
  "rooCode.modelId": "GLM-4.7",
  "rooCode.maxTokens": 4096,
  "rooCode.temperature": 0.7,
  "rooCode.autoApprove": false,
  "rooCode.diffEnabled": true
}

เคล็ดลับการใช้งาน

เลือกโมเดลให้เหมาะสมกับงาน

GLM-4.7

สำหรับงานที่ซับซ้อน, Coding ขั้นสูง

GLM-4-Plus

สำหรับงานทั่วไป, สมดุลระหว่างคุณภาพและความเร็ว

GLM-4-Flash

สำหรับ Autocomplete, งานที่ต้องการความเร็ว

Slash Commands (Continue)

/explain อธิบายโค้ดที่เลือก
/refactor ปรับโครงสร้างโค้ด
/test สร้าง Unit Test
/doc สร้าง Documentation

การแก้ไขปัญหาทั่วไป

Invalid API Key

ตรวจสอบ API Key ที่ z.ai Dashboard และสร้าง API Key ใหม่หากจำเป็น

Connection Timeout

ตรวจสอบการเชื่อมต่ออินเทอร์เน็ต และตรวจสอบว่า Base URL ถูกต้อง: https://open.bigmodel.cn/api/anthropic

Rate Limit Exceeded

ตรวจสอบ Usage ที่ z.ai Dashboard รอสักครู่แล้วลองใหม่ หรือพิจารณาอัปเกรดแพ็กเกจ

Model Not Found

ตรวจสอบชื่อโมเดลที่ถูกต้อง: GLM-4.7, GLM-4-Plus, GLM-4-Flash

คำถามที่พบบ่อย

GLM Coding Plan แตกต่างจาก Claude อย่างไร?

GLM Coding Plan ใช้โมเดล GLM จาก z.ai ซึ่งเป็นโมเดลภาษาขนาดใหญ่ที่พัฒนาโดยทีมงานจีน รองรับภาษาไทยและภาษาอื่นๆ ได้ดี และมีราคาที่แข่งขันได้

สามารถใช้หลาย Extension พร้อมกันได้ไหม?

ได้ แต่แนะนำให้ใช้เพียงตัวเดียวเพื่อประสิทธิภาพสูงสุด และหลีกเลี่ยงการใช้ API Key ซ้ำซ้อน

รองรับภาษาโปรแกรมอะไรบ้าง?

รองรับทุกภาษาโปรแกรมหลัก รวมถึง JavaScript/TypeScript, Python, Java, C/C++, Go, Rust, PHP, Ruby, Swift, Kotlin และอื่นๆ

ลิงก์ที่เป็นประโยชน์