ใช้กับผู้ช่วย AI เขียนโค้ด
เอกสารชุดนี้มีไฟล์ที่ผู้ช่วย AI เขียนโค้ด (เช่น Claude Code, Cursor, GitHub Copilot, ChatGPT) อ่านได้โดยตรง ช่วยให้ AI ใช้ endpoint ชื่อฟิลด์ และวิธีเซ็น request ตามเอกสารปัจจุบัน แทนการเดา
| ไฟล์ | เนื้อหา | ใช้เมื่อ |
|---|---|---|
/llms.txt | สารบัญของทุกหน้าพร้อมลิงก์ (ตามมาตรฐาน llms.txt) | ให้ AI เลือกอ่านเฉพาะหน้าที่เกี่ยวข้อง |
/llms-full.txt | เนื้อหาทุกหน้า ทั้งภาษาไทยและอังกฤษ รวมเป็น Markdown ไฟล์เดียว | ให้ AI มีบริบทครบในครั้งเดียว |
/openapi.json | สเปก OpenAPI 3.0 ของ Partner API | สร้าง client, type หรือ mock และตรวจ request/response |
ในหน้าเว็บจัดการ เมนู คู่มือเชื่อมต่อด้วย AI (AI integration guide) จะเปิด llms-full.txt ให้โดยตรง
วิธีใช้
หัวข้อที่มีชื่อว่า “วิธีใช้”- ให้ AI อ่าน
https://docs.example.com/llms-full.txt(วาง URL ถ้าเครื่องมืออ่านเว็บได้ หรือดาวน์โหลดไฟล์ไว้ใน repository แล้วอ้างถึงไฟล์นั้น) - ถ้าต้องการ type หรือ client ที่สร้างอัตโนมัติ ให้ใช้
https://docs.example.com/openapi.json - บอกภาษาและ framework ที่ใช้ และสิ่งที่ต้องการให้ชัดเจน
- ตรวจโค้ดที่ได้ โดยเฉพาะฟังก์ชันเซ็น ให้ทดสอบกับ test vector ก่อนเรียก API จริง
ตัวอย่าง prompt
Read https://docs.example.com/llms-full.txt (Partner API section).Write a TypeScript module for Node.js 20 that:- signs requests exactly as described (X-Api-Key, X-Timestamp, X-Nonce, X-Signature), reading PARTNER_API_KEY and PARTNER_API_SECRET from environment variables,- creates a pay-in with the payer's bank account inline (payer: { bankCode, accountNumber, accountName }), and returns checkoutUrl, amount, payerId and payTo (incl. payTo.qrPayload),- exposes an Express route that verifies webhook signatures on the raw body and handles payin.succeeded idempotently (dedupe on data.id + data.status).Add a unit test that checks the signer against the documented test vectors.ข้อควรระวัง
หัวข้อที่มีชื่อว่า “ข้อควรระวัง”- ไฟล์เหล่านี้สร้างใหม่ทุกครั้งที่เอกสารอัปเดต ให้ดาวน์โหลดใหม่เมื่อมีการเปลี่ยนแปลง แทนการใช้สำเนาเก่า
- ถ้า AI ใช้ชื่อฟิลด์ header หรือ endpoint ที่ไม่มีในเอกสาร ให้ยึดตามเอกสารและ
openapi.json - อย่าให้เครื่องมือ AI เรียก API ด้วยคีย์ production โดยอัตโนมัติ เพราะ pay-in และ payout เป็นรายการเงินจริง