ในการเลือกรูปแบบโค้ด Claude ให้ใช้ Haiku สำหรับการเปลี่ยนแปลงเล็กๆ ที่สามารถทดสอบได้ Sonnet สำหรับการนำไปใช้ในกิจวัตรประจำวัน และ Opus สำหรับงานที่มีความคลุมเครือสูงหรือต้องการการวิเคราะห์เชิงเหตุผลมากขึ้น. Anthropic แนะนำ Opus 5.5 เป็นจุดเริ่มต้นที่ครอบคลุมในขณะนี้; งานของคุณ ปริมาณงานที่ต้องตรวจสอบ และงบประมาณจะเป็นปัจจัยที่กำหนดว่ารุ่นที่มีขนาดเล็กกว่าจะเหมาะสมกว่าหรือไม่.
เพื่อเปลี่ยนแบบ ให้เปิด /model. กด เข้าสู่ เพื่อบันทึกค่าเริ่มต้น หรือ s เพื่อเปลี่ยนเฉพาะเซสชันปัจจุบันเท่านั้น สำหรับการเปิดใช้งานครั้งเดียว ให้ใช้ claude --model opus. ตัวเลือกเหล่านั้นมีระยะเวลาคงอยู่ที่แตกต่างกัน ดังนั้น การตัดสินใจว่าสวิตช์ควรทำงานได้นานเท่าใด จึงสำคัญไม่แพ้การเลือกรุ่น.
งานเขียนโค้ดยังรวมถึงการวิจัย การอธิบาย การจัดทำเอกสาร และทรัพยากรสร้างสรรค์ GlobalGPT นำโมเดล AI ชั้นนำและเครื่องมือ AI หลากหลายมารวมไว้ในแดชบอร์ดเดียวที่มีราคาไม่แพง ส่วน CLI ของมันช่วยเชื่อมต่อเครื่องมือเหล่านั้นกับเทอร์มินัลและกระบวนการทำงานด้านการพัฒนา. สร้างกระบวนการทำงานของคุณด้วย GlobalGPT เพื่อรวมงานที่เกี่ยวข้องไว้ด้วยกัน ขณะที่คุณพัฒนาจากแนวคิดไปสู่โค้ดที่ทำงานได้.

ควรใช้โมเดลใดในโค้ด Claude?
เริ่มจากรูปแบบของงานก่อน ฟังก์ชันสั้นที่มีผลลัพธ์ที่คาดหวังอย่างชัดเจน จำเป็นต้องได้รับการประเมินที่แตกต่างจากข้อผิดพลาดที่เกิดขึ้นเป็นช่วงๆ และกระจายไปทั่วหลายบริการ คำถามที่มีประโยชน์คือว่า โมเดลดังกล่าวสามารถสร้างการเปลี่ยนแปลงที่ยอมรับได้ ผ่านกระบวนการตรวจสอบและปรับปรุงอย่างสมเหตุสมผลหรือไม่.
| รุ่นปัจจุบัน | วัตถุประสงค์ของการจัดวาง | งานเริ่มต้นที่ปฏิบัติได้จริง |
|---|---|---|
| โคลดไฮกุ 4.5 | ทำงานอย่างรวดเร็วและมีประสิทธิภาพด้วยสัญญาที่มีขอบเขตจำกัด | การปรับโครงสร้างเล็กน้อย การแปลงข้อมูลแบบซ้ำๆ หรือกรณีทดสอบที่เรียบง่าย |
| โคลด โซเน็ต 5 | ความสมดุลระหว่างความฉลาดและความเร็วสำหรับการเขียนโค้ดในชีวิตประจำวัน | คุณสมบัติที่มีรูปแบบที่ชัดเจน การแก้ไขข้อผิดพลาดตามปกติ หรือการอธิบายโค้ด |
| Claude Opus 5.5 | การคิดวิเคราะห์ที่ซับซ้อนและการเขียนโค้ดแบบเอเจนต์ที่ใช้เวลานานขึ้น | ความล้มเหลวที่ไม่ชัดเจน การแลกเปลี่ยนระหว่างด้านต่าง ๆ ของสถาปัตยกรรม หรือการเปลี่ยนแปลงภายใต้ข้อจำกัดที่ส่งผลต่อกัน |
| Claude Fable 5.1 | การสอบสวนที่ยากที่สุดและดำเนินมานานที่สุด | การเพิ่มระดับความยาก เมื่องานที่ยากยังคงเอาชนะระดับความพยายามของ Opus ที่สูงขึ้นได้ |
Haiku เป็นตัวเลือกที่ควรพิจารณาเมื่อข้อผิดพลาดสามารถตรวจพบได้ง่ายและการเปลี่ยนแปลงมีขนาดเล็ก Sonnet เป็นตัวเลือกที่เหมาะสมเมื่อการนำไปใช้ในชีวิตประจำวันต้องการบริบทและการตัดสินใจมากขึ้น Opus เป็นตัวเลือกที่ควรพิจารณาเมื่อการเข้าใจปัญหาเป็นส่วนสำคัญของงาน Fable ควรได้รับการตัดสินใจแยกต่างหากสำหรับงานที่ต้องการความซับซ้อนสูง เนื่องจากมันอยู่นอกขอบเขตการทดสอบการเขียนโค้ดด้วยสามโมเดลของเรา.
นี่เป็นจุดเริ่มต้นเท่านั้น ไม่ใช่การรับประกันคุณภาพโดยอัตโนมัติ คำตอบที่มีราคาถูกกว่าอาจกลายเป็นค่าใช้จ่ายสูงหากต้องแก้ไขหลายครั้งหรือต้องผ่านการตรวจสอบอย่างละเอียด ในทางกลับกัน โมเดลที่มีขนาดใหญ่กว่าอาจเพิ่มประโยชน์ได้น้อยมากต่อการแปลงข้อมูลแบบเรียบง่ายที่ผ่านการตรวจสอบของคุณแล้ว สำหรับการใช้งานที่กว้างกว่า Claude Code, เปรียบเทียบกลุ่มรุ่น Claude.

The ภาพรวมรุ่นอย่างเป็นทางการ แสดงหน้าต่างบริบทขนาด 1 ล้านโทเคนสำหรับ Fable 5.1, Opus 5.5 และ Sonnet 5 รวมถึง 200,000 โทเคนสำหรับ Haiku 4.5 นี่คือข้อกำหนด API ผู้ให้บริการโค้ด Claude ของคุณ บัญชี และการตั้งค่า จะกำหนดตัวเลือกบริบทที่มีอยู่ในเซสชัน หน้าต่างขนาดใหญ่มีประโยชน์สำหรับบริบทที่จำเป็น; การเติมหน้าต่างด้วยเนื้อหาที่ไม่เกี่ยวข้องยังคงสร้างงานให้กับโมเดล.
วิธีเปลี่ยนแบบในเซสชันเดียว
ภายในเซสชันแบบโต้ตอบที่จัดขึ้น /model เพื่อเปิดตัวเลือกรุ่น ให้เลือกแถวของรุ่นแล้วกด s หากนี่เป็นการเปลี่ยนแปลงครั้งเดียว ให้กด เข้าสู่ บันทึกการเลือกไว้เป็นค่าเริ่มต้นของผู้ใช้ การพิมพ์ /แบบโซเน็ต ยังบันทึกมันลงในเวอร์ชันปัจจุบันด้วย.
เลือกคำสั่งตามระยะเวลาที่ต้องการให้การเปลี่ยนแปลงมีผล
| เป้าหมายของคุณ | สิ่งที่ควรทำ | บันทึกการเปลี่ยนแปลงค่าเริ่มต้นแล้วหรือยัง? |
|---|---|---|
| เปลี่ยนเฉพาะเซสชันแบบโต้ตอบนี้เท่านั้น | เปิด /model, เลือกแบบเครื่อง, กด s. | ไม่. |
| บันทึกรุ่นที่ชื่นชอบ | เปิด /model และกด เข้าสู่, หรือพิมพ์ /แบบโซเน็ต. | ใช่ครับ เมื่อการตั้งค่าของผู้ใช้สามารถเขียนได้. |
| เริ่มเซสชันเดียวบน Opus | เปิดตัว claude --model opus. | ไม่. |
| กลับสู่ค่าเริ่มต้นของสภาพแวดล้อมการทำงานของบัญชี | ใช้ /แบบมาตรฐาน. | ลบการปรับเปลี่ยนแบบจำลอง; ค่าเริ่มต้นที่ได้รับการกำหนดอาจขึ้นอยู่กับตั้งค่าของบัญชีและองค์กร. |
| ตรวจสอบโมเดลที่กำลังทำงานอยู่ | วิ่ง /status. | ไม่. |
การตั้งค่าของโครงการหรือการตั้งค่าที่ได้รับการจัดการ การแทนที่สภาพแวดล้อม และการต่อเซสชันที่หยุดไว้ อาจส่งผลต่อการเปิดใช้งานครั้งต่อไป ให้ตรวจสอบโมเดลที่กำลังใช้งานอยู่เมื่อความซ้ำได้มีความสำคัญ.
สำหรับเซสชันเทอร์มินัลใหม่ ให้เลือกรุ่นเมื่อเริ่มต้นระบบ คำสั่งเหล่านี้ยังใช้ได้เมื่อ Claude Code ทำงานในเทอร์มินัลที่รวมอยู่ใน VS Code ตัวอย่างต่อไปนี้เลือกรุ่นการปล่อยอย่างชัดเจน:
claude --model claude-opus-5-5
claude --model claude-sonnet-5เรียกใช้คำสั่งสำหรับเซสชันที่คุณต้องการ; ตัวอย่างเหล่านี้เป็นตัวเลือกอื่น ๆ คุณสามารถเปิดเทอร์มินัลต่าง ๆ ด้วย --แบบจำลอง ค่าต่าง ๆ โดยไม่ต้องปรับเปลี่ยนค่าเริ่มต้นที่บันทึกไว้ร่วมกันซ้ำแล้วซ้ำเล่า ใช้ /status เพื่อตรวจสอบโมเดลที่กำลังใช้งานอยู่.
ชื่อสกุล เช่น opus และ โซเน็ต สามารถอัปเกรดไปยังเวอร์ชันใหม่ได้ ความละเอียดของไฟล์เหล่านี้ยังขึ้นอยู่กับผู้ให้บริการด้วย: API Anthropic ปัจจุบันกำหนดให้ไฟล์เหล่านี้สอดคล้องกับ Opus 5.5 และ Sonnet 5 ส่วนการกำหนดของผู้ให้บริการคลาวด์อาจแตกต่างกัน ใช้ ID แบบเต็มเมื่อต้องการการรันที่สามารถทำซ้ำได้ และตรวจสอบชื่อเฉพาะของผู้ให้บริการหากสภาพแวดล้อมของคุณต้องการ.
Opus 5.5 ต้องการ Claude Code เวอร์ชัน v2.1.280 หรือใหม่กว่า; Sonnet 5 ต้องการเวอร์ชัน v2.1.197 หรือใหม่กว่า. The เอกสารการตั้งค่าแบบจำลอง เป็นแหล่งอ้างอิงสำหรับชื่อเรียกแทน (alias) ที่ใช้ในปัจจุบัน ข้อกำหนดเกี่ยวกับเวอร์ชัน และการแมปผู้ให้บริการ คำสั่งที่แสดงไว้ที่นี่เป็นตัวอย่างในเอกสาร ส่วนการปฏิบัติจริงของเราจะประเมินโค้ดที่สร้างขึ้นอย่างแยกต่างหาก.

วิธีตั้งโมเดลเป็นค่าเริ่มต้น
หากต้องการตั้งค่าเริ่มต้นส่วนตัว ให้เลือกแบบใน /model และกด เข้าสู่, หรือพิมพ์การเลือก เช่น /แบบโซเน็ต. รหัส Claude เขียน แบบจำลอง ในส่วนการตั้งค่าผู้ใช้ของคุณ เมื่อไฟล์นั้นสามารถเขียนได้ เปิดเซสชันใหม่และตรวจสอบโมเดลที่กำลังใช้งานอยู่เพื่อยืนยันผลลัพธ์.
การตั้งค่าที่บันทึกไว้จะไม่แทนที่การตั้งค่าอื่น ๆ ทั้งหมด สัญลักษณ์เริ่มต้น, ANTHROPIC_MODEL ในเชลล์ โครงการ หรือการตั้งค่าที่ได้รับการจัดการ หรือค่าเริ่มต้นขององค์กรที่ได้รับการกำหนดให้แทนที่ตัวเลือกของผู้ใช้ สามารถเลือกตัวเลือกอื่นได้เมื่อเริ่มต้นระบบ เซสชันที่กลับมาทำงานต่ออาจเก็บรักษาโมเดลจากบันทึกการสนทนาที่บันทึกไว้ได้ ตรวจสอบข้อมูลการเริ่มต้นระบบและ /status ก่อนที่จะสันนิษฐานว่าโอกาสนั้นได้สูญเสียไปแล้ว.
/แบบมาตรฐาน จะลบการปรับเปลี่ยนโมเดลของคุณ และกลับสู่ค่าเริ่มต้นของระบบรันไทม์สำหรับบัญชีและการตั้งค่าของคุณ คำว่า ค่าเริ่มต้น เป็นค่าเริ่มต้น ไม่ใช่ชื่อของแบบจำลอง Claude แบบใดแบบหนึ่งที่กำหนดไว้แล้ว ไม่ควรใช้ค่านี้เป็นตัวระบุแบบจำลองที่สามารถทำซ้ำได้.
สำหรับการตั้งค่าขั้นสูง, ANTHROPIC_DEFAULT_MODEL ให้ตัวเลือกเริ่มต้นสำรองตั้งแต่เวอร์ชัน v2.1.236 เป็นต้นไป ตัวเลือกนี้อยู่ด้านล่างตัวเลือกการเปิดใช้งาน การตั้งค่าสภาพแวดล้อม การตั้งค่า และการจัดองค์กรที่ระบุไว้อย่างชัดเจน และจะไม่พิจารณาค่าต่าง ๆ เช่น ไฮกุ และ opusplan. สำหรับความชอบส่วนตัวทั่วไป เครื่องเลือกจะตรวจสอบได้ง่ายกว่า ดู การตั้งค่าโค้ด Claude เมื่อมีการใช้การตั้งค่าที่แชร์.
Opusplan ทำงานอย่างไร
opusplan ใช้ Opus ในโหมดวางแผน และ Sonnet สำหรับการดำเนินการ จุดเด่นของวิธีนี้ชัดเจน: ใช้โมเดลการให้เหตุผลที่แข็งแกร่งกว่าเพื่อกำหนดแนวทาง แล้วใช้โมเดลการเขียนโค้ดประจำวันเพื่อดำเนินการตามแผนนั้น.
Opusplan ปฏิบัติตามรูปแบบการทำงาน
พฤติกรรมเส้นทางที่บันทึกไว้ เวอร์ชันที่อยู่เบื้องหลังชื่อกลุ่มเหล่านี้ขึ้นอยู่กับผู้ให้บริการและการตั้งค่าของคุณ.
นี่เป็นกฎที่ขึ้นอยู่กับโหมด มันไม่ตรวจสอบทุกคำสั่งและเลือกกลุ่มที่เหมาะสมที่มีค่าใช้จ่ายต่ำที่สุดโดยอัตโนมัติ การกำหนดผู้ให้บริการและข้อจำกัดการเข้าถึงยังคงมีผลต่อโมเดลพื้นฐาน นอกจากนี้ ชื่อของกลุ่มก็ไม่ได้เป็นการรับประกันว่าจะประหยัดค่าใช้จ่ายได้: ค่าใช้จ่ายรวมขึ้นอยู่กับระดับความซับซ้อนของการวางแผน การดำเนินการ การปรับปรุง และการประมวลผลบริบทที่งานนั้นต้องการ.
ลองพิจารณาเปลี่ยนแนวทางดูบ้าง โดยให้การออกแบบได้รับประโยชน์จากการวิเคราะห์อย่างลึกซึ้ง และการนำไปปฏิบัติเป็นไปตามแผนที่ชัดเจน สำหรับการแก้ไขเล็กๆ น้อยๆ การวางแผนเพิ่มเติมนั้นอาจไม่จำเป็น.
สองงานเขียนโค้ดนี้แสดงให้เห็นว่า
เพื่อให้เห็นภาพที่ชัดเจนยิ่งขึ้นในการเลือกโมเดล เราได้ทดสอบการปรับโครงสร้าง Unicode แบบแคบและการแก้ไขตัวเลือกรูทที่มีข้อกำหนดที่ทำงานร่วมกัน ผลปรากฏว่าความแตกต่างระหว่างฟังก์ชันที่ถูกต้องกับการส่งมอบที่ครบถ้วนตามคำขอ มีความสำคัญมากกว่าคะแนนแบบง่ายๆ.
วิธีที่เราทดสอบผลลัพธ์การเขียนโค้ด
เมื่อวันที่ 28 กันยายน 2569 เราได้มอบงาน JavaScript สองงานเดียวกันให้กับ Claude Haiku 4.5, Claude Sonnet 5 และ Claude Opus 5.5 ผ่าน GlobalGPT แต่ละโมเดลได้ส่งคืนโค้ดต้นฉบับ; เราได้ตรวจสอบโค้ดและดำเนินการตรวจสอบแบบท้องถิ่นที่แก้ไขแล้ว คำแนะนำเกี่ยวกับการเปลี่ยนโมเดลของ Claude Code ที่ปรากฏในส่วนอื่น ๆ ของคู่มือนี้ มาจากเอกสารทางการของโมเดลดังกล่าว.
แต่ละคำขอมีขีดจำกัดผลลัพธ์ที่ 4,096 โทเคน ไม่มีเครื่องมือหรือประวัติการสนทนา และใช้การตั้งค่าโมเดลตามค่าเริ่มต้น เราเก็บคำตอบแรกที่สามารถประเมินได้ รวมถึงคำตอบที่ยังไม่สมบูรณ์ด้วย ข้อผิดพลาดในการให้บริการหนึ่งครั้งใน任务การกำหนดเส้นทางของ Sonnet ได้รับสิทธิ์ลองใหม่หนึ่งครั้ง: คำขอเจ็ดครั้งให้ผลลัพธ์หกครั้ง.
งานสองงานเล็กๆ นี้ใช้วัดรหัสที่ส่งกลับและความครบถ้วนของการส่งมอบ แต่ไม่วัดการดำเนินการของเอเจนต์ Claude Code การสำรวจรีโพสิตอรี หรือเซสชันการพัฒนาทั้งหมด ไม่มีการรายงานค่าใช้จ่ายจริงเป็นดอลลาร์ การสังเกตเพียงครั้งเดียวต่อแต่ละงานไม่สามารถกำหนดอันดับความเร็วหรือความน่าเชื่อถือโดยทั่วไปได้.
ดูรหัสแบบเครื่องที่แม่นยำและเงื่อนไขการประเมิน
ID ที่ขอ: claude-haiku-4-5-20251001, claude-sonnet-5, และ claude-opus-5-5. การตรวจสอบในระบบท้องถิ่นได้ดำเนินการด้วย Node.js v24.19.0 ข้อความแจ้งเตือนกำหนดให้ใช้ Node.js 18 ขึ้นไป; ส่วน Node.js 18 เองยังไม่ได้รับการทดสอบ.
ได้กำหนดกลุ่มพฤติกรรม 8 กลุ่มสำหรับงาน slug และ 12 กลุ่มสำหรับงาน route selector การปฏิบัติตามรูปแบบและการส่งมอบอย่างครบถ้วนถูกรายงานแยกกัน การตรวจสอบรหัสในขั้นตอนต่อมาถูกระบุแยกต่างหาก และไม่ส่งผลต่อจำนวนดังกล่าว เราไม่ได้แก้ไขรหัสต้นที่ส่งกลับมาเพื่อให้ผ่านการตรวจสอบ.
งานที่ 1: รักษา Unicode ในการปรับโครงสร้าง slug ขนาดเล็ก
ฟังก์ชันนี้ต้องรักษาตัวอักษรที่ไม่ใช่ตัวอักษรละตินและเครื่องหมายผสมไว้ ปรับให้เครื่องหมายเน้นเสียงที่แยกส่วนเป็นรูปแบบมาตรฐาน และรักษาพฤติกรรม ASCII ที่มีอยู่เดิม.
| แบบจำลอง | การตรวจสอบพฤติกรรม | รูปแบบการตอบกลับ | ดำเนินการส่งสินค้าตามคำขอให้เสร็จสิ้น |
|---|---|---|---|
| โคลดไฮกุ 4.5 | 8/8 | ผิด: ตัวห่อ Markdown | ใช่: ฟังก์ชันที่สมบูรณ์ |
| โคลด โซเน็ต 5 | 8/8 | ข้อมูลที่ส่งผ่าน: JSON แบบดิบ | ใช่: ฟังก์ชันที่สมบูรณ์ |
| Claude Opus 5.5 | 8/8 | ข้อมูลที่ส่งผ่าน: JSON แบบดิบ | ใช่: ฟังก์ชันที่สมบูรณ์ |
ผลการสังเกต: ทั้งสามฟังก์ชันได้ผ่านกลุ่มเดียวกันทั้งแปดกลุ่ม Sonnet และ Opus ก็ปฏิบัติตามข้อกำหนดเกี่ยวกับคำตอบในรูปแบบ raw-JSON เช่นกัน ส่วน Haiku ได้ห่อคำตอบไว้ใน Markdown และในหมายเหตุการตรวจสอบได้อธิบาย NFC ผิดว่าเป็นการแยกตัวอักษร แต่โค้ดของมันเรียก NFC อย่างถูกต้อง.
สำหรับการปรับโครงสร้างโค้ดในส่วนนี้ การอัปเกรดไม่ได้ช่วยปรับปรุงพฤติกรรมของฟังก์ชันที่ได้รับการทดสอบ ข้อกำหนดด้านรูปแบบและความถูกต้องของคำอธิบายที่แนบมา ยังจำเป็นต้องได้รับการตรวจสอบเพิ่มเติม.
ดูข้อความคำสั่งที่แชร์และรหัสการป้อนข้อมูลแบบครบถ้วน
SYSTEM
You are completing a bounded JavaScript coding task. Return only the requested JSON object with complete source files and brief review notes. Do not claim to have edited files, run commands, or used tools. You have no tool access. Do not include hidden reasoning.
USER
Implement the following Node.js 18+ CommonJS function from its current source. Return complete replacement source for src/slugify.js. Do not add dependencies, imports, I/O, or other files.
Required behavior:
1. slugify(value) returns an empty string for every non-string input.
2. Normalize string input to Unicode NFC, then lowercase it using JavaScript toLowerCase().
3. Preserve Unicode letters, numbers, and combining marks. Replace each consecutive run of all other characters with one ASCII hyphen.
4. Trim leading and trailing hyphens. Preserve the CommonJS export { slugify }.
5. Existing ASCII behavior must continue to work. Examples: Hello, World! -> hello-world; two words -> two-words; null -> empty string.
6. Additional examples: Café déjà vu -> café-déjà-vu; decomposed Cafe\u0301 -> café; 中文 测试 42 -> 中文-测试-42; **hi___there** -> hi-there; only punctuation or whitespace -> empty string.
Current src/slugify.js:
```javascript
function slugify(value) {
if (typeof value !== "string") return "";
return value
.trim()
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
}
module.exports = { slugify };
```
Return exactly one JSON object with this shape:
{"files":{"src/slugify.js":"complete JavaScript source as a JSON string"},"review_notes":["at most four brief implementation or assumption notes"]}
No Markdown wrapper. You are returning code for someone else to evaluate locally; do not say that tests passed or that you ran them.
ดูคำตอบครบถ้วนของ Claude Haiku 4.5 ตามที่ส่งกลับมา
```json
{
"files": {
"src/slugify.js": "function slugify(value) {\n if (typeof value !== \"string\") return \"\";\n \n // Normalize to NFC and lowercase\n const normalized = value.normalize(\"NFC\").toLowerCase();\n \n // Replace consecutive runs of non-letter, non-number, non-combining-mark characters with a single hyphen\n // Unicode letter categories: L* (Lu, Ll, Lt, Lm, Lo)\n // Unicode number categories: N* (Nd, Nl, No)\n // Unicode combining mark categories: M* (Mn, Mc, Me)\n const slugged = normalized.replace(/[^\\p{L}\\p{N}\\p{M}]+/gu, \"-\");\n \n // Trim leading and trailing hyphens\n return slugged.replace(/^-+|-+$/g, \"\");\n}\n\nmodule.exports = { slugify };"
},
"review_notes": [
"Uses String.prototype.normalize(\"NFC\") to decompose composed characters like é into base+combining mark, then toLowerCase() applies to normalized string",
"Unicode property escapes (\\p{L}, \\p{N}, \\p{M}) with /u flag preserve all Unicode letters, numbers, and combining marks while replacing other consecutive characters with single hyphens",
"Existing ASCII behavior is preserved: punctuation and whitespace are replaced with hyphens, then leading/trailing hyphens are trimmed",
"Non-string inputs return empty string as required; normalized decomposed characters (e.g., Cafe\\u0301) are handled correctly by NFC normalization"
]
}
```ดูคำตอบครบถ้วนของ Claude Sonnet 5 ตามที่ส่งกลับมา
{"files":{"src/slugify.js":"function slugify(value) {\n if (typeof value !== \"string\") return \"\";\n return value\n .normalize(\"NFC\")\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}\\p{M}]+/gu, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nmodule.exports = { slugify };\n"},"review_notes":["Used Unicode property escapes (\\p{L}, \\p{N}, \\p{M}) with the u flag to preserve letters, numbers, and combining marks across scripts.","NFC normalization ensures decomposed sequences like Cafe + combining acute compose to café before lowercasing.","Runs of any other characters (punctuation, whitespace, symbols) collapse to a single hyphen, then leading/trailing hyphens are trimmed."]}ดูคำตอบครบถ้วนของ Claude Opus 5.5 ตามที่ส่งกลับมา
{"files":{"src/slugify.js":"function slugify(value) {\n if (typeof value !== \"string\") return \"\";\n return value\n .normalize(\"NFC\")\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}\\p{M}]+/gu, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nmodule.exports = { slugify };\n"},"review_notes":["The input is normalized to NFC before lowercasing, so decomposed input like Cafe\\u0301 composes to café.","A Unicode property regex with the u flag keeps letters (\\p{L}), numbers (\\p{N}) and combining marks (\\p{M}). Each run of any other characters, including underscores and whitespace, becomes one hyphen.","The explicit trim() was removed because the final step strips leading and trailing hyphens, which covers surrounding whitespace.","Lowercasing happens after NFC normalization, as the spec orders. toLowerCase can occasionally produce non-NFC output for rare characters, and it is not re-normalized here."]}งานที่ 2: ซ่อมแซมตัวเลือกรูท และส่งคืนผลการทดสอบของมัน
ฟังก์ชันดังกล่าวต้องแก้ไขปัญหาการจับคู่คำนำหน้าที่ยาวที่สุด ลำดับความสำคัญของวิธีการ ขอบเขตของส่วน กฎที่ผิดรูปแบบ และข้อมูลนำเข้าที่ไม่สามารถเปลี่ยนแปลงได้ นอกจากนี้ คำตอบที่ขอมา ยังรวมถึงไฟล์ทดสอบใหม่ด้วย.
| แบบจำลอง | การตรวจสอบพฤติกรรม | รูปแบบการตอบกลับ | ดำเนินการส่งสินค้าตามคำขอให้เสร็จสิ้น |
|---|---|---|---|
| โคลดไฮกุ 4.5 | 12/12 สำหรับฟังก์ชันแบบสมบูรณ์เท่านั้น | ผิดพลาด: JSON ถูกตัดสั้น | ไม่: ไฟล์ทดสอบถูกตัดออก |
| โคลด โซเน็ต 5 | 12/12 สำหรับฟังก์ชันแบบสมบูรณ์เท่านั้น | ผิดพลาด: JSON ถูกตัดสั้น | ไม่: ไฟล์ทดสอบถูกตัดออก |
| Claude Opus 5.5 | 12/12 สำหรับฟังก์ชันแบบสมบูรณ์เท่านั้น | ผิดพลาด: JSON ถูกตัดสั้น | ไม่: ไฟล์ทดสอบถูกตัดออก |
ผลการสังเกต: ไม่มีโมเดลใดที่เสร็จสิ้นการตอบสนองตามคำขอด้วยไฟล์สองไฟล์ภายในขีดจำกัดผลลัพธ์ที่แบ่งปัน ทั้งสามโมเดลหยุดลงที่ 4,096 โทเคนรายงานการเสร็จสิ้น แต่ละโมเดลได้ส่งคืนฟังก์ชันรูเทอร์ที่สมบูรณ์แล้ว ซึ่งผ่านการทดสอบกลุ่มพฤติกรรมคงที่ทั้งสิบสองกลุ่ม; ส่วนไฟล์ทดสอบใหม่ยังไม่สมบูรณ์และไม่ได้รับการดำเนินการ.
เราได้ดึงข้อมูลเฉพาะแต่ละสตริงของโค้ดแหล่งที่มาที่ปิดสนิทเท่านั้น ส่วนคำตอบต้นฉบับที่ถูกตัดสั้นยังคงอยู่ครบถ้วนด้านล่าง ดังนั้น คะแนนฟังก์ชันที่ผ่านเกณฑ์จึงไม่ได้หมายความว่าคำขอทั้งหมดประสบความสำเร็จ.
ผลการตรวจสอบโค้ดเพิ่มเติม: ผลเสมอเนื่องจากรากเท่ากัน
หลังจากดำเนินการตรวจสอบตามขั้นตอนที่กำหนดแล้ว เราสังเกตเห็นว่า Haiku ได้ถูกปรับให้เป็นค่าปกติแล้ว /// เป็นสตริงว่างแทนที่จะ /. การตรวจสอบในท้องถิ่นที่แยกต่างหากได้ใช้กฎ GET สองข้อ พร้อมด้วยคำนำหน้า /// และ /, โดยมุ่งเป้าไปที่ แรก และ ที่สอง ตามลำดับนั้น สำหรับ /อะไรก็ได้, ตามสัญญาแล้ว แรก.
Haiku กลับมาแล้ว ที่สอง; Sonnet และ Opus กลับมาแล้ว แรก. การตรวจสอบเพิ่มเติมนี้เกิดจากการตรวจสอบโค้ด และเป็นการตรวจสอบที่แยกต่างหากจาก 12 ขั้นตอนการตรวจสอบที่กำหนดไว้ก่อนการทดสอบ มันไม่ส่งผลต่อคะแนนของขั้นตอนการตรวจสอบดังกล่าว.
Sonnet ได้พบข้อผิดพลาดในการให้บริการหนึ่งครั้ง ก่อนที่การลองใหม่ตามจำนวนครั้งที่อนุญาตจะส่งคืนคำตอบที่ถูกตัดทอนซึ่งแสดงอยู่ ข้อผิดพลาดในการให้บริการดังกล่าวไม่เกี่ยวข้องกับคุณภาพของโค้ด ไม่มีโมเดลใดที่ได้รับการลองใหม่เพื่อปรับปรุงหรือทำให้คำตอบเสร็จสมบูรณ์.
ดูข้อความคำสั่งที่แชร์และรหัสการป้อนข้อมูลแบบครบถ้วน
SYSTEM
You are completing a bounded JavaScript coding task. Return only the requested JSON object with complete source files and brief review notes. Do not claim to have edited files, run commands, or used tools. You have no tool access. Do not include hidden reasoning.
USER
Repair a Node.js 18+ CommonJS route selector. Return complete replacement src/router.js and an additional test/router-added.test.js using node:test and node:assert/strict. Do not add dependencies or edit existing tests. Do not use I/O other than the test runner, network, child processes, timers, or any files beyond the two requested outputs.
Contract for chooseRoute(request, rules):
1. Invalid request or rules returns null, without throwing. Request must be a non-null, non-array object; method must be a nonempty ASCII-letter string; path must be a string beginning with /. Rules must be an array.
2. Before matching, remove the request path's query and fragment starting at the earliest ? or #. Do not URL-decode or collapse interior slashes.
3. Ignore invalid rules. A valid rule is a non-null, non-array object with method '*' or a nonempty ASCII-letter string, prefix a string starting with / containing neither ? nor #, and target a nonempty string.
4. Compare methods case-insensitively. Prefer any matching exact-method rule over all wildcard-method '*' rules, even if a wildcard has a longer prefix. Use wildcard rules only if no exact-method route matches the path.
5. Remove trailing slashes from a rule prefix, except that an all-slash prefix normalizes to /. A prefix matches the path only at a segment boundary: /api matches /api and /api/users, never /apix. Root / matches every valid request path.
6. Within the chosen method group, choose the longest normalized matching prefix. On equal prefix length, choose the earlier rule in the original input array. Return its target. Return null if none matches.
7. Do not mutate the request, rules array, or rule objects, including order or prefix strings. Preserve module.exports = { chooseRoute }.
8. Add tests for segment boundaries, query/fragment removal, method precedence, ties, malformed inputs and immutability. Existing simple GET /api/users and POST-no-match cases must still pass.
Current src/router.js:
```javascript
function chooseRoute(request, rules) {
if (!request || !Array.isArray(rules)) return null;
for (const rule of rules) {
if (request.method === rule.method && request.path.startsWith(rule.prefix)) {
return rule.target;
}
}
return null;
}
module.exports = { chooseRoute };
```
Existing regression cases (unchanged): rules [{method:'GET',prefix:'/api',target:'api'},{method:'GET',prefix:'/api/admin',target:'admin'}]; GET /api/users returns 'api'; POST /api/users returns null.
Return exactly one JSON object with this shape:
{"files":{"src/router.js":"complete JavaScript source as a JSON string","test/router-added.test.js":"complete JavaScript tests as a JSON string"},"review_notes":["at most four brief implementation or assumption notes"]}
No Markdown wrapper. You are returning code for someone else to evaluate locally; do not say you edited files, ran tests, or observed passing results.
ดูคำตอบครบถ้วนของ Claude Haiku 4.5 ตามที่ส่งกลับมา
นี่คือข้อความตอบกลับทั้งหมดที่ได้รับ ข้อความนี้สิ้นสุดลงกลางทางเนื่องจากถึงขีดจำกัดแล้ว ส่วนเนื้อหาที่ขาดไปยังไม่ได้รับการเติมเต็ม.
```json
{
"files": {
"src/router.js": "function chooseRoute(request, rules) {\n // Validate request\n if (request === null || Array.isArray(request) || typeof request !== 'object') {\n return null;\n }\n if (typeof request.method !== 'string' || request.method.length === 0 || !/^[a-zA-Z]+$/.test(request.method)) {\n return null;\n }\n if (typeof request.path !== 'string' || !request.path.startsWith('/')) {\n return null;\n }\n\n // Validate rules\n if (!Array.isArray(rules)) {\n return null;\n }\n\n // Remove query and fragment from path\n const cleanPath = request.path.split(/[?#]/)[0];\n\n // Filter and validate rules\n const validRules = [];\n for (const rule of rules) {\n if (rule === null || Array.isArray(rule) || typeof rule !== 'object') {\n continue;\n }\n \n const method = rule.method;\n if (typeof method !== 'string' || (method !== '*' && (method.length === 0 || !/^[a-zA-Z]+$/.test(method)))) {\n continue;\n }\n \n const prefix = rule.prefix;\n if (typeof prefix !== 'string' || !prefix.startsWith('/') || prefix.includes('?') || prefix.includes('#')) {\n continue;\n }\n \n const target = rule.target;\n if (typeof target !== 'string' || target.length === 0) {\n continue;\n }\n \n validRules.push(rule);\n }\n\n // Normalize prefixes and partition into exact-method and wildcard groups\n const exactMethodRules = [];\n const wildcardRules = [];\n \n for (const rule of validRules) {\n const normalizedPrefix = rule.prefix === '/' ? '/' : rule.prefix.replace(/\/+$/, '');\n \n const entry = {\n originalRule: rule,\n normalizedPrefix: normalizedPrefix,\n method: rule.method\n };\n \n if (rule.method === '*') {\n wildcardRules.push(entry);\n } else {\n exactMethodRules.push(entry);\n }\n }\n\n const requestMethod = request.method.toUpperCase();\n\n // Helper to check if a prefix matches the path at a segment boundary\n function prefixMatches(prefix, path) {\n if (prefix === '/') {\n return true;\n }\n if (!path.startsWith(prefix)) {\n return false;\n }\n // Check segment boundary: next character must be '/' or end of string\n const nextChar = path[prefix.length];\n return nextChar === undefined || nextChar === '/';\n }\n\n // Try exact-method rules first\n let bestMatch = null;\n let bestLength = -1;\n \n for (const entry of exactMethodRules) {\n if (entry.method.toUpperCase() === requestMethod) {\n if (prefixMatches(entry.normalizedPrefix, cleanPath)) {\n if (entry.normalizedPrefix.length > bestLength) {\n bestMatch = entry.originalRule;\n bestLength = entry.normalizedPrefix.length;\n }\n }\n }\n }\n \n if (bestMatch !== null) {\n return bestMatch.target;\n }\n\n // Try wildcard rules only if no exact-method match\n bestMatch = null;\n bestLength = -1;\n \n for (const entry of wildcardRules) {\n if (prefixMatches(entry.normalizedPrefix, cleanPath)) {\n if (entry.normalizedPrefix.length > bestLength) {\n bestMatch = entry.originalRule;\n bestLength = entry.normalizedPrefix.length;\n }\n }\n }\n \n if (bestMatch !== null) {\n return bestMatch.target;\n }\n\n return null;\n}\n\nmodule.exports = { chooseRoute };",
"test/router-added.test.js": "const test = require('node:test');\nconst assert = require('node:assert/strict');\nconst { chooseRoute } = require('../src/router.js');\n\n// Regression: existing test cases\ntest('GET /api/users matches /api prefix (exact method)', () => {\n const rules = [\n { method: 'GET', prefix: '/api', target: 'api' },\n { method: 'GET', prefix: '/api/admin', target: 'admin' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, rules), 'api');\n});\n\ntest('POST /api/users returns null (no matching method)', () => {\n const rules = [\n { method: 'GET', prefix: '/api', target: 'api' },\n { method: 'GET', prefix: '/api/admin', target: 'admin' }\n ];\n assert.equal(chooseRoute({ method: 'POST', path: '/api/users' }, rules), null);\n});\n\n// Invalid request handling\ntest('null request returns null', () => {\n assert.equal(chooseRoute(null, []), null);\n});\n\ntest('array request returns null', () => {\n assert.equal(chooseRoute([], []), null);\n});\n\ntest('request with missing method returns null', () => {\n assert.equal(chooseRoute({ path: '/api' }, []), null);\n});\n\ntest('request with empty method returns null', () => {\n assert.equal(chooseRoute({ method: '', path: '/api' }, []), null);\n});\n\ntest('request with non-letter method returns null', () => {\n assert.equal(chooseRoute({ method: 'GET-POST', path: '/api' }, []), null);\n});\n\ntest('request with numeric method returns null', () => {\n assert.equal(chooseRoute({ method: '123', path: '/api' }, []), null);\n});\n\ntest('request with missing path returns null', () => {\n assert.equal(chooseRoute({ method: 'GET' }, []), null);\n});\n\ntest('request with path not starting with / returns null', () => {\n assert.equal(chooseRoute({ method: 'GET', path: 'api' }, []), null);\n});\n\ntest('null rules returns null', () => {\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, null), null);\n});\n\ntest('non-array rules returns null', () => {\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, { method: 'GET' }), null);\n});\n\n// Query and fragment removal\ntest('query string is removed before matching', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users?foo=bar' }, rules), 'found');\n});\n\ntest('fragment is removed before matching', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users#section' }, rules), 'found');\n});\n\ntest('earliest ? or # is used as boundary', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users?foo#bar' }, rules), 'found');\n});\n\ntest('fragment before query is used as boundary', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users#foo?bar' }, rules), 'found');\n});\n\n// Segment boundary matching\ntest('prefix /api matches /api/users at segment boundary', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, rules), 'found');\n});\n\ntest('prefix /api does not match /apix (no segment boundary)', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/apix' }, rules), null);\n});\n\ntest('prefix /api matches /api exactly at segment boundary', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'found');\n});\n\ntest('root / matches any valid path', () => {\n const rules = [{ method: 'GET', prefix: '/', target: 'root' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/anything/here' }, rules), 'root');\n});\n\ntest('root / matches /', () => {\n const rules = [{ method: 'GET', prefix: '/', target: 'root' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/' }, rules), 'root');\n});\n\n// Prefix normalization (trailing slash removal)\ntest('trailing slash is removed from prefix', () => {\n const rules = [{ method: 'GET', prefix: '/api/', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, rules), 'found');\n});\n\ntest('multiple trailing slashes are removed', () => {\n const rules = [{ method: 'GET', prefix: '/api///', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, rules), 'found');\n});\n\ntest('all-slash prefix normalizes to single /', () => {\n const rules = [{ method: 'GET', prefix: '///', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'found');\n});\n\n// Method case-insensitivity\ntest('method comparison is case-insensitive', () => {\n const rules = [{ method: 'get', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'found');\n});\n\ntest('request method case does not affect matching', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'found' }];\n assert.equal(chooseRoute({ method: 'get', path: '/api' }, rules), 'found');\n});\n\n// Exact-method vs wildcard precedence\ntest('exact-method rule preferred over wildcard with longer prefix', () => {\n const rules = [\n { method: '*', prefix: '/api/admin/users', target: 'wildcard' },\n { method: 'GET', prefix: '/api', target: 'exact' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/test' }, rules), 'exact');\n});\n\ntest('wildcard rule used when no exact-method matches', () => {\n const rules = [\n { method: '*', prefix: '/api', target: 'wildcard' },\n { method: 'GET', prefix: '/other', target: 'exact' }\n ];\n assert.equal(chooseRoute({ method: 'POST', path: '/api/users' }, rules), 'wildcard');\n});\n\n// Longest prefix matching\ntest('longest matching prefix is chosen', () => {\n const rules = [\n { method: 'GET', prefix: '/api', target: 'short' },\n { method: 'GET', prefix: '/api/admin', target: 'long' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/admin/users' }, rules), 'long');\n});\n\n// Tie-breaking (first rule wins on equal prefix length)\ntest('first rule wins on equal prefix length', () => {\n const rules = [\n { method: 'GET', prefix: '/api', target: 'first' },\n { method: 'GET', prefix: '/api', target: 'second' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, rules), 'first');\n});\n\n// Invalid rules are ignored\ntest('null rule is ignored', () => {\n const rules = [\n null,\n { method: 'GET', prefix: '/api', target: 'found' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'found');\n});\n\ntest('array rule is ignored', () => {\n const rules = [\n [],\n { method: 'GET', prefix: '/api', target: 'found' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'found');\n});\n\ntest('rule with invalid method is ignored', () => {\n const rules = [\n { method: '', prefix: '/api', target: 'invalid' },\n { method: 'GET', prefix: '/api', target: 'valid' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'valid');\n});\n\ntest('rule with non-letter method (if not wildcard) is ignored', () => {\n const rules = [\n { method: 'G3T', prefix: '/api', target: 'invalid' },\n { method: 'GET', prefix: '/api', target: 'valid' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'valid');\n});\n\ntest('rule with prefix not starting with / is ignored', () => {\n const rules = [\n { method: 'GET', prefix: 'api', target: 'invalid' },\n { method: 'GET', prefix: '/api', target: 'valid' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'valid');\n});\n\ntest('rule with query in prefix is ignored', () => {\n const rules = [\n { method: 'GET', prefix: '/api?foo=bar', target: 'invalid' },\n { method: 'GET', prefix: '/api', target: 'valid' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'valid');\n});\n\ntest('rule with fragment in prefix is ignored', () => {\n const rules = [\n { method: 'GET', prefix: '/api#section', target: ดูคำตอบครบถ้วนของ Claude Sonnet 5 ตามที่ส่งกลับมา
นี่คือข้อความตอบกลับทั้งหมดที่ได้รับ ข้อความนี้สิ้นสุดลงกลางทางเนื่องจากถึงขีดจำกัดแล้ว ส่วนเนื้อหาที่ขาดไปยังไม่ได้รับการเติมเต็ม.
{"files":{"src/router.js":"function isValidRequest(request) {\n return (\n request !== null &&\n typeof request === 'object' &&\n !Array.isArray(request) &&\n typeof request.method === 'string' &&\n request.method.length > 0 &&\n /^[A-Za-z]+$/.test(request.method) &&\n typeof request.path === 'string' &&\n request.path.startsWith('/')\n );\n}\n\nfunction isValidRule(rule) {\n if (rule === null || typeof rule !== 'object' || Array.isArray(rule)) {\n return false;\n }\n const { method, prefix, target } = rule;\n\n if (typeof method !== 'string') return false;\n if (method !== '*' && !(method.length > 0 && /^[A-Za-z]+$/.test(method))) {\n return false;\n }\n\n if (\n typeof prefix !== 'string' ||\n !prefix.startsWith('/') ||\n prefix.includes('?') ||\n prefix.includes('#')\n ) {\n return false;\n }\n\n if (typeof target !== 'string' || target.length === 0) return false;\n\n return true;\n}\n\nfunction normalizePrefix(prefix) {\n if (/^\/+$/.test(prefix)) return '/';\n return prefix.replace(/\/+$/, '');\n}\n\nfunction prefixMatches(normalizedPrefix, path) {\n if (normalizedPrefix === '/') return true;\n if (path === normalizedPrefix) return true;\n return path.startsWith(normalizedPrefix + '/');\n}\n\nfunction stripQueryAndFragment(path) {\n let cutIndex = path.length;\n for (let i = 0; i < path.length; i++) {\n const c = path[i];\n if (c === '?' || c === '#') {\n cutIndex = i;\n break;\n }\n }\n return path.slice(0, cutIndex);\n}\n\nfunction chooseRoute(request, rules) {\n if (!isValidRequest(request) || !Array.isArray(rules)) return null;\n\n const path = stripQueryAndFragment(request.path);\n const reqMethodLower = request.method.toLowerCase();\n\n let bestExact = null; // { len, idx, target }\n let bestWildcard = null;\n\n for (let idx = 0; idx < rules.length; idx++) {\n const rule = rules[idx];\n if (!isValidRule(rule)) continue;\n\n const normPrefix = normalizePrefix(rule.prefix);\n if (!prefixMatches(normPrefix, path)) continue;\n\n const len = normPrefix.length;\n\n if (rule.method === '*') {\n if (\n bestWildcard === null ||\n len > bestWildcard.len ||\n (len === bestWildcard.len && idx < bestWildcard.idx)\n ) {\n bestWildcard = { len, idx, target: rule.target };\n }\n } else if (rule.method.toLowerCase() === reqMethodLower) {\n if (\n bestExact === null ||\n len > bestExact.len ||\n (len === bestExact.len && idx < bestExact.idx)\n ) {\n bestExact = { len, idx, target: rule.target };\n }\n }\n }\n\n if (bestExact !== null) return bestExact.target;\n if (bestWildcard !== null) return bestWildcard.target;\n return null;\n}\n\nmodule.exports = { chooseRoute };\n","test/router-added.test.js":"const test = require('node:test');\nconst assert = require('node:assert/strict');\nconst { chooseRoute } = require('../src/router');\n\ntest('segment boundary: prefix matches at slash boundary only', () => {\n const rules = [\n { method: 'GET', prefix: '/api', target: 'api' },\n ];\n assert.equal(\n chooseRoute({ method: 'GET', path: '/api/users' }, rules),\n 'api'\n );\n assert.equal(\n chooseRoute({ method: 'GET', path: '/api' }, rules),\n 'api'\n );\n assert.equal(\n chooseRoute({ method: 'GET', path: '/apix' }, rules),\n null\n );\n});\n\ntest('root prefix matches every valid path', () => {\n const rules = [{ method: 'GET', prefix: '/', target: 'root' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/' }, rules), 'root');\n assert.equal(\n chooseRoute({ method: 'GET', path: '/anything/here' }, rules),\n 'root'\n );\n});\n\ntest('trailing slashes in rule prefix are normalized', () => {\n const rules = [{ method: 'GET', prefix: '/api///', target: 'api' }];\n assert.equal(\n chooseRoute({ method: 'GET', path: '/api/users' }, rules),\n 'api'\n );\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'api');\n});\n\ntest('all-slash prefix normalizes to /', () => {\n const rules = [{ method: 'GET', prefix: '////', target: 'root' }];\n assert.equal(\n chooseRoute({ method: 'GET', path: '/whatever' }, rules),\n 'root'\n );\n});\n\ntest('query and fragment are stripped before matching', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'api' }];\n assert.equal(\n chooseRoute({ method: 'GET', path: '/api/users?x=1&y=2' }, rules),\n 'api'\n );\n assert.equal(\n chooseRoute({ method: 'GET', path: '/api/users#section' }, rules),\n 'api'\n );\n assert.equal(\n chooseRoute({ method: 'GET', path: '/api/users?x=1#frag' }, rules),\n 'api'\n );\n});\n\ntest('query/fragment stripping does not decode or collapse slashes', () => {\n const rules = [{ method: 'GET', prefix: '/a//b', target: 'weird' }];\n assert.equal(\n chooseRoute({ method: 'GET', path: '/a//b?x=1' }, rules),ดูคำตอบครบถ้วนของ Claude Opus 5.5 ตามที่ส่งกลับมา
นี่คือข้อความตอบกลับทั้งหมดที่ได้รับ ข้อความนี้สิ้นสุดลงกลางทางเนื่องจากถึงขีดจำกัดแล้ว ส่วนเนื้อหาที่ขาดไปยังไม่ได้รับการเติมเต็ม.
{"files":{"src/router.js":"'use strict';\n\nconst LETTERS = /^[A-Za-z]+$/;\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction isMethodName(value) {\n return typeof value === 'string' && value.length > 0 && LETTERS.test(value);\n}\n\nfunction stripQueryAndFragment(path) {\n const q = path.indexOf('?');\n const h = path.indexOf('#');\n let cut = -1;\n if (q !== -1 && h !== -1) cut = Math.min(q, h);\n else if (q !== -1) cut = q;\n else if (h !== -1) cut = h;\n return cut === -1 ? path : path.slice(0, cut);\n}\n\nfunction normalizePrefix(prefix) {\n let end = prefix.length;\n while (end > 0 && prefix[end - 1] === '/') end -= 1;\n return end === 0 ? '/' : prefix.slice(0, end);\n}\n\nfunction prefixMatches(path, prefix) {\n if (prefix === '/') return true;\n return path === prefix || path.startsWith(prefix + '/');\n}\n\nfunction chooseRoute(request, rules) {\n try {\n if (!isPlainObject(request) || !Array.isArray(rules)) return null;\n const method = request.method;\n const rawPath = request.path;\n if (!isMethodName(method)) return null;\n if (typeof rawPath !== 'string' || rawPath[0] !== '/') return null;\n\n const path = stripQueryAndFragment(rawPath);\n const upperMethod = method.toUpperCase();\n\n let bestExact = null;\n let bestWildcard = null;\n\n const count = rules.length;\n for (let i = 0; i < count; i += 1) {\n const rule = rules[i];\n if (!isPlainObject(rule)) continue;\n const ruleMethod = rule.method;\n const prefix = rule.prefix;\n const target = rule.target;\n const isWildcard = ruleMethod === '*';\n if (!isWildcard && !isMethodName(ruleMethod)) continue;\n if (typeof prefix !== 'string' || prefix[0] !== '/') continue;\n if (prefix.indexOf('?') !== -1 || prefix.indexOf('#') !== -1) continue;\n if (typeof target !== 'string' || target.length === 0) continue;\n\n const normalized = normalizePrefix(prefix);\n if (!prefixMatches(path, normalized)) continue;\n\n const candidate = { length: normalized.length, target };\n if (isWildcard) {\n if (bestWildcard === null || candidate.length > bestWildcard.length) bestWildcard = candidate;\n } else if (ruleMethod.toUpperCase() === upperMethod) {\n if (bestExact === null || candidate.length > bestExact.length) bestExact = candidate;\n }\n }\n\n if (bestExact !== null) return bestExact.target;\n if (bestWildcard !== null) return bestWildcard.target;\n return null;\n } catch (err) {\n return null;\n }\n}\n\nmodule.exports = { chooseRoute };\n","test/router-added.test.js":"'use strict';\n\nconst test = require('node:test');\nconst assert = require('node:assert/strict');\nconst { chooseRoute } = require('../src/router.js');\n\nconst baseRules = [\n { method: 'GET', prefix: '/api', target: 'api' },\n { method: 'GET', prefix: '/api/admin', target: 'admin' }\n];\n\ntest('existing regression cases still hold', () => {\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, baseRules), 'api');\n assert.equal(chooseRoute({ method: 'POST', path: '/api/users' }, baseRules), null);\n});\n\ntest('longest prefix wins within method group', () => {\n assert.equal(chooseRoute({ method: 'GET', path: '/api/admin/x' }, baseRules), 'admin');\n assert.equal(chooseRoute({ method: 'GET', path: '/api/admin' }, baseRules), 'admin');\n});\n\ntest('segment boundaries', () => {\n const rules = [{ method: 'GET', prefix: '/api', target: 'api' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'api');\n assert.equal(chooseRoute({ method: 'GET', path: '/api/' }, rules), 'api');\n assert.equal(chooseRoute({ method: 'GET', path: '/api/users' }, rules), 'api');\n assert.equal(chooseRoute({ method: 'GET', path: '/apix' }, rules), null);\n assert.equal(chooseRoute({ method: 'GET', path: '/ap' }, rules), null);\n});\n\ntest('trailing slashes in prefixes are normalized, all-slash is root', () => {\n const rules = [{ method: 'GET', prefix: '/api///', target: 'api' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api' }, rules), 'api');\n assert.equal(chooseRoute({ method: 'GET', path: '/apix' }, rules), null);\n const rootRules = [{ method: 'GET', prefix: '///', target: 'root' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/' }, rootRules), 'root');\n assert.equal(chooseRoute({ method: 'GET', path: '/anything/else' }, rootRules), 'root');\n assert.equal(chooseRoute({ method: 'GET', path: '/x' }, [{ method: 'GET', prefix: '/', target: 'r' }]), 'r');\n});\n\ntest('query and fragment are removed at earliest ? or #', () => {\n assert.equal(chooseRoute({ method: 'GET', path: '/api?next=/api/admin' }, baseRules), 'api');\n assert.equal(chooseRoute({ method: 'GET', path: '/api#/admin' }, baseRules), 'api');\n assert.equal(chooseRoute({ method: 'GET', path: '/apix?/api' }, baseRules), null);\n assert.equal(chooseRoute({ method: 'GET', path: '/api/admin#frag?q' }, baseRules), 'admin');\n assert.equal(chooseRoute({ method: 'GET', path: '/api?q#/admin' }, baseRules), 'api');\n});\n\ntest('no URL decoding and no slash collapsing', () => {\n const rules = [{ method: 'GET', prefix: '/api/admin', target: 'admin' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/api%2Fadmin' }, rules), null);\n assert.equal(chooseRoute({ method: 'GET', path: '/api//admin' }, rules), null);\n assert.equal(chooseRoute({ method: 'GET', path: '/api//admin' }, baseRules), 'api');\n});\n\ntest('methods compare case-insensitively', () => {\n const rules = [{ method: 'get', prefix: '/a', target: 'lower' }];\n assert.equal(chooseRoute({ method: 'GET', path: '/a' }, rules), 'lower');\n assert.equal(chooseRoute({ method: 'gEt', path: '/a/b' }, rules), 'lower');\n});\n\ntest('exact method beats longer wildcard; wildcard used only as fallback', () => {\n const rules = [\n { method: '*', prefix: '/api/admin', target: 'wild-admin' },\n { method: 'GET', prefix: '/', target: 'get-root' },\n { method: 'POST', prefix: '/other', target: 'post-other' },\n { method: '*', prefix: '/api', target: 'wild-api' }\n ];\n assert.equal(chooseRoute({ method: 'GET', path: '/api/admin/x' }, rules), 'get-root');\n assert.equal(chooseRoute({ method: 'POST', path: '/api/admin/x' }, rules), 'wild-admin');\n assert.equal(chooseRoute({ method: 'POST', path: '/api/x' }, rules), 'wild-api');\n assert.equal(chooseRoute({ method: 'POST', path: '/other/1' }, rules), 'post-other');\n assert.equal(chooseRoute({ method: 'PUT', path: '/nothing' }, rules), null);\n});\n\ntest('ties go to earlier rule in input order', () => {\n const rules = [\n { method: 'GET', prefขีดจำกัด 4,096 โทเคน คืองบประมาณผลลัพธ์ที่เลือกใช้สำหรับการทดสอบนี้ ไม่ใช่ขีดจำกัดสูงสุดที่ระบุไว้ในเอกสารของโมเดลใด ๆ ผลลัพธ์การกำหนดเส้นทางชี้ให้เห็นว่าควรมีการตรวจสอบอย่างปฏิบัติจริงก่อนส่งคำขอที่มีขนาดใหญ่ขึ้น: ประมาณขนาดของโค้ดที่สร้างขึ้น การทดสอบ และคำอธิบายที่คุณคาดว่าจะได้รับกลับมา การแบ่งผลลัพธ์ออกเป็นส่วนๆ หรือเพิ่มพื้นที่สำหรับผลลัพธ์อาจเหมาะสม; เราไม่ได้รันผลลัพธ์เหล่านี้ใหม่ด้วยตั้งค่าที่ต่างกัน.
สำหรับงานของคุณเอง ให้ประเมินสามสิ่งนี้อย่างแยกกัน: ว่าคำตอบนั้นครบถ้วนหรือไม่, ว่าโค้ดผ่านการตรวจสอบที่มีประโยชน์หรือไม่, และว่าการตรวจสอบพบจุดที่การตรวจสอบดังกล่าวพลาดไปหรือไม่ การผ่านการตรวจสอบฟังก์ชันทั้งสิบสองครั้ง ไม่ได้ทำให้คำตอบที่ถูกตัดทอนลงเหลือสองไฟล์นั้นถือเป็นการส่งงานที่เสร็จสมบูรณ์.
การเลือกรุ่นต่าง ๆ ส่งผลต่อค่าใช้จ่ายอย่างไร
Claude Code เป็นเครื่องมือสำหรับการเขียนโค้ด; Haiku, Sonnet, Opus และ Fable เป็นตัวเลือกโมเดลภายในสภาพแวดล้อมที่ได้รับการสนับสนุน วิธีที่คุณยืนยันตัวตนและชำระเงินเป็นอีกตัวเลือกหนึ่ง การเปลี่ยนโมเดลจะไม่ทำให้การสมัครสมาชิกกลายเป็นบัญชี API หรือทำให้ข้อจำกัดการใช้งานทั้งหมดหายไป.
| เส้นทางเรียกเก็บเงิน | สิ่งที่ควรดู | วิธีตีความการเลือกแบบจำลอง |
|---|---|---|
| สิทธิ์การเข้าถึงแบบสมัครสมาชิก Claude | รวมถึงการใช้งานตามแพ็กเกจและเครดิตการใช้งานที่เปิดใช้งานแยกต่างหาก | รุ่นต่าง ๆ อาจใช้โควตาได้แตกต่างกัน; โปรดตรวจสอบรุ่นที่มีอยู่และขีดจำกัดของแพ็กเกจ |
| การเข้าถึง API Anthropic | โทเคนการรับส่งข้อมูล การเก็บไว้ในแคช และค่าธรรมเนียม API ที่เกี่ยวข้อง | ใช้ตารางราคาปัจจุบันและปริมาณการใช้งานจริง แล้วตรวจสอบค่าบริการในคอนโซลการเรียกเก็บเงิน |
| ผู้ให้บริการคลาวด์หรือเกตเวย์ | ID อัตรา และบันทึกการเรียกเก็บเงินที่ผู้ให้บริการของคุณรองรับ | ราคาตามรายการของ Anthropic อาจไม่เท่ากับจำนวนเงินที่ผู้ให้บริการของคุณเรียกเก็บ |
ในรหัส Claude, /การใช้งาน แสดงข้อมูลโทเค็นเซสชัน และหากมี ก็แสดงแถบการใช้งานของแพ็กเกจด้วย ตัวเลขในหน่วยดอลลาร์เป็นค่าประมาณที่คำนวณขึ้นในระบบท้องถิ่น โดยอ้างอิงจากราคาในรายการหรือราคาที่ตั้งค่าไว้; นี่ไม่ใช่ใบแจ้งหนี้ สำหรับผู้ใช้แพ็กเกจ Pro และ Max ตัวเลขของเซสชันดังกล่าวไม่ได้หมายความว่ามีการเพิ่มค่าบริการ API เพิ่มเติมลงในแพ็กเกจ อ่านเพิ่มเติมเกี่ยวกับ Claude: วิธีกำหนดราคาและเส้นทางเรียกเก็บเงิน หากคุณกำลังตัดสินใจว่าจะชำระด้วยวิธีใด.
ราคา API ปัจจุบันและตัวอย่างการใช้โทเคนเท่ากัน
อัตราพื้นฐานปกติของ Anthropic ต่อหนึ่งล้านโทเคนเข้า/ออก คือ Haiku 4.5: $1/$5; Sonnet 5: $2/$10; Opus 5.5: $4/$20; Fable 5.1: $10/$50, ตรวจสอบเมื่อวันที่ 28 กันยายน 2026. แผนภูมิต่อไปนี้รักษาปริมาณโทเคนให้คงที่ เพื่อให้การเปรียบเทียบทางคณิตศาสตร์เป็นไปอย่างง่ายดาย.
ปริมาณโทเคนเท่ากัน แต่มีค่าใช้จ่าย API สี่แบบที่แตกต่างกัน
ตัวอย่าง: 100,000 โทเคนข้อมูลเข้าที่ยังไม่ถูกเก็บไว้ในแคช + 10,000 โทเคนข้อมูลออก, โดยใช้ราคาตามรายการ API ปกติของ Anthropic ที่ตรวจสอบเมื่อวันที่ 28 กันยายน 2026.
ดูอัตราและวิธีคำนวณ
| แบบจำลอง | อินพุต / 1M | เอาต์พุต / 1 ล้าน | ตัวอย่างยอดรวม |
|---|---|---|---|
| ไฮกุ 4.5 | $1 | $5 | $0.15 |
| โซเน็ต 5 | $2 | $10 | $0.30 |
| Opus 5.5 | $4 | $20 | $0.60 |
| Fable 5.1 | $10 | $50 | $1.50 |
การคำนวณ: 0.1 × อัตราเข้า + 0.01 × อัตราออก สำหรับ Opus 5.5: 0.1 × $4 + 0.01 × $20 = $0.60.
นี่เป็นตัวอย่างที่ใช้โทเคนคงที่ งานจริงใช้จำนวนโทเคนรวมที่แตกต่างกัน; การเขียนและอ่านข้อมูลในแคช การลองใหม่ เครื่องมือ การเรียกเก็บเงินจากผู้ให้บริการ และขีดจำกัดการสมัครสมาชิก ต้องมีการคำนวณแยกกัน.
แหล่งที่มา: ราคา API Anthropic.

งาน Code แบบ Claude ที่แท้จริงคือลำดับของคำขอ โดยบริบทก่อนหน้านี้อาจถูกส่งมาอีกครั้ง โมเดลอาจทำการวิเคราะห์เพิ่มเติม และเครื่องมือหรือเอเจนต์อื่น ๆ อาจสร้างงานเพิ่มเติมได้ การเก็บแคชคำสั่ง (prompt caching) ยังมีอัตราการเขียนและอ่านที่แตกต่างกัน ดังนั้น แถบที่ต่ำที่สุดในตัวอย่างนี้จึงไม่ได้แสดงถึงต้นทุนต่ำที่สุดต่อการเปลี่ยนแปลงที่ได้รับการยอมรับ.
5 วิธีควบคุมค่าใช้จ่ายโดยไม่ทำให้ประสิทธิภาพของงานลดลง
- กำหนดเกณฑ์การยอมรับก่อนที่จะเลือกแบบจำลอง. ระบุพฤติกรรมที่คาดหมาย กรณีพิเศษ และข้อจำกัดที่มีอยู่ งานที่ชัดเจนและขนาดเล็กจะง่ายต่อการมอบหมายให้คนอื่นทำอย่างมีประสิทธิภาพ และง่ายต่อการตรวจสอบมากขึ้น.
- ให้ข้อมูลบริบทที่เกี่ยวข้อง. โปรดแนบไฟล์และรายละเอียดความผิดพลาดที่โมเดลต้องการ สำหรับงานที่ไม่เกี่ยวข้องกัน ให้เริ่มการสนทนาใหม่แทนที่จะนำประวัติการสนทนาที่ยาวมาใช้ต่อเพียงเพราะมันมีอยู่.
- แยกความแตกต่างระหว่างความสามารถกับความพยายาม. Anthropic แนะนำให้เริ่มด้วยระดับความพยายามตามค่าเริ่มต้นของโมเดล หากโมเดลอ่านบริบทถูกต้องแล้วแต่ยังไม่สามารถแก้ปัญหาได้ โมเดลที่มีประสิทธิภาพสูงกว่าอาจช่วยได้ หากโมเดลข้ามขั้นตอนการอ่านหรือการตรวจสอบ ให้ตรวจสอบการตั้งค่างานและระดับความพยายามที่เลือก.
- งบประมาณสำหรับคำตอบทั้งหมด. รหัสต้นแบบ การทดสอบ และคำอธิบาย ทั้งหมดล้วนต้องการพื้นที่สำหรับผลลัพธ์ งานที่สองของเราจะแสดงให้เห็นว่า ทำไมฟังก์ชันที่สมบูรณ์เพียงอย่างเดียวจึงไม่ใช่หลักฐานที่เพียงพอว่าผลลัพธ์ที่ขอมาอยู่ในกรอบงบประมาณ.
- เปรียบเทียบผลงานที่ได้รับการยอมรับ. บันทึกผลลัพธ์ที่มีประโยชน์ จำนวนครั้งที่ลองใหม่ เวลาตรวจสอบ และข้อมูลการเรียกเก็บเงินจริง สำหรับงานที่เป็นตัวแทนของระบบ ให้แยกข้อผิดพลาดของผู้ให้บริการออกจากข้อผิดพลาดด้านคุณภาพของโมเดล.
กลยุทธ์เหล่านี้สอดคล้องกับ คู่มือค่าใช้จ่ายอย่างเป็นทางการ และ แนวทางเกี่ยวกับแบบจำลองและระดับความพยายามของ Anthropic. ข้อจำกัดรายสัปดาห์หรือต่อเซสชันที่บังคับใช้ทั่วทั้งแผนงานอาจยังคงมีผลอยู่แม้หลังจากเปลี่ยนโมเดลแล้ว; ส่วนข้อจำกัดเฉพาะโมเดลนั้นเป็นกรณีที่ต่างออกไป โปรดตรวจสอบข้อจำกัดที่แท้จริงก่อนที่จะเปลี่ยนโมเดลซ้ำๆ.
หากงานของคุณครอบคลุมทั้งการเขียนโค้ด การวิจัย การเขียน และการผลิตสื่อ ก็ควรเปรียบเทียบกระบวนการทำงานที่คุณกำลังจ่ายเงินเพื่อใช้บริการด้วย. พื้นที่ทำงานแบบหลายโมเดลของ GlobalGPT นำฟังก์ชันเหล่านั้นมารวมไว้ในแดชบอร์ดเดียว พร้อมการเข้าถึงผ่าน CLI สำหรับงานพัฒนา คุณค่าของกระบวนการทำงานที่กว้างขวางนี้ควรนำมาพิจารณาควบคู่กับเส้นทาง API ที่คิดค่าบริการตามการใช้งาน; แผนภูมิ API ข้างต้นไม่ใช่รายการราคาสมัครสมาชิกแบบ GlobalGPT.
ทำไมรุ่นที่คุณเลือกอาจไม่ติด
| อาการ | ตรวจสอบได้ | ขั้นตอนต่อไปที่ปฏิบัติได้จริง |
|---|---|---|
| เซสชันต่อไปจะใช้โมเดลเดิม | สวิตช์นี้อาจถูกตั้งค่าให้ใช้เฉพาะในเซสชันเท่านั้น | ใช้คำสั่ง Enter ของเครื่องมือเลือกเพื่อบันทึก แล้วตรวจสอบเซสชันใหม่ |
| การตั้งค่าถูกบันทึกไว้ แต่ระบบกลับเริ่มใช้โมเดลอื่น | การตั้งค่าการเปิดตัว, การตั้งค่า shell, การตั้งค่าโครงการ, การตั้งค่าการจัดการ หรือการตั้งค่าองค์กร อาจมีลำดับความสำคัญสูงกว่า | อ่านข้อมูลการเริ่มต้นระบบและตรวจสอบการตั้งค่าที่เกี่ยวข้องร่วมกับผู้รับผิดชอบ |
| การสนทนาที่ต่อต่อกันมาจะมีรูปแบบที่ต่างออกไป | เซสชันที่บันทึกไว้อาจกู้คืนโมเดลเดิมได้ | ตรวจสอบ /status; เลือกแบบที่ต้องการอย่างรอบคอบเพื่อดำเนินการต่อ |
| โมเดลนี้ไม่พบหรือถูกปฏิเสธ | ความพร้อมให้บริการของผู้ให้บริการ กฎระเบียบขององค์กร หรือเวอร์ชันเก่าของรหัส Claude | ตรวจสอบรหัสแบบเครื่องที่รองรับ สิทธิ์การเข้าถึงบัญชี และข้อกำหนดเกี่ยวกับเวอร์ชัน |
| ชื่อสกุลเดียวกันนี้มีการแปลความหมายต่างกันในที่อื่น | ชื่อเรียกอื่นและการกำหนดผู้ให้บริการมีความแตกต่างกัน | ใช้รหัสประจำตัวเต็มและถูกต้องของผู้ให้บริการ เมื่อการปล่อยข้อมูลต้องคงที่ |
| การเปลี่ยนเครือข่ายจะไม่ทำให้ขีดจำกัดการใช้งานถูกรีเซ็ต | ข้อจำกัดนี้อาจใช้กับแผนทั้งหมด | อ่านข้อความเกี่ยวกับวิธีการใช้งานและปรับช่วงเวลาใหม่ แทนที่จะสมมติว่าเพียงเปลี่ยนโหมดครอบครัวก็เพียงพอแล้ว |
หากรหัส Claude ไม่สามารถบันทึกการตั้งค่าของผู้ใช้ได้ ตัวเลือกแบบโต้ตอบอาจมีผลเฉพาะในเซสชันปัจจุบันเท่านั้น โดยไม่ถูกบันทึกไว้อย่างถาวร ไฟล์การตั้งค่าที่ได้รับการจัดการหรือสร้างขึ้นอาจจำเป็นต้องได้รับการแก้ไขจากเจ้าของไฟล์แทนที่จะลองใช้ตัวเลือกอื่นอีกครั้ง ควรหลีกเลี่ยงการยกเลิกข้อจำกัดขององค์กรเพียงเพื่อให้ตัวเลือกปรากฏขึ้น.
สร้างกระบวนการทำงานที่กว้างขึ้นด้วย GlobalGPT
การเลือกโมเดลเป็นส่วนหนึ่งของกระบวนการทำงาน คุณอาจจำเป็นต้องค้นคว้าข้อมูลจากไลบรารี เขียนฟังก์ชันเบื้องต้น อธิบายการเปลี่ยนแปลงให้เพื่อนร่วมทีม สร้างเอกสาร และเตรียมทรัพยากรภาพ GlobalGPT รวมโมเดลชั้นนำและฟังก์ชัน AI หลายอย่างไว้ในพื้นที่ทำงานเดียวที่มีราคาไม่แพง ทำให้สามารถจัดการงานทั้งหมดเหล่านี้ในแดชบอร์ดเดียวกันได้.

สำหรับงานที่สถานีปลายทาง, GlobalGPT CLI เชื่อมต่อเครื่องมือของแพลตฟอร์มกับสภาพแวดล้อมการพัฒนา การตั้งค่าที่ระบุไว้ในเอกสารใช้ข้อมูลการเข้าสู่ระบบบัญชี GlobalGPT ของคุณและยอดเงินในบัญชีปกติ CLI สามารถสนับสนุนกระบวนการทำงานด้านการเขียนโค้ดและการสร้างเนื้อหาที่กว้างขวางยิ่งขึ้น ในขณะที่โมเดลของ Claude Code เองยังคงเป็นตัวเลือกที่ตั้งใจไว้ผ่านการควบคุมโมเดล.
ตัวอย่างเช่น ให้ร่างและตรวจสอบแผนการดำเนินการ ใช้แบบจำลองอื่นเพื่อให้คำอธิบายที่กระชับ แล้วสร้างเอกสารหรือทรัพยากรที่มาพร้อมกับเวอร์ชันที่ปล่อยออกมา ให้ทำตามคู่มือเพื่อ เชื่อมต่อ CLI ของ GlobalGPT กับโค้ดของ Claude เมื่อคุณต้องการการบูรณาการเครื่องมือดังกล่าว ให้ตั้งค่าโมเดลการวิเคราะห์โค้ด Claude ของคุณแยกกันตามงานเขียนโค้ด.
เลือกรูปแบบเริ่มต้น กำหนดเกณฑ์ที่ชี้วัดความสำเร็จ และปรับระดับขึ้นเมื่องานต้องการ ทบทวนผลงานทั้งหมดก่อนที่จะถือว่างานเสร็จสิ้น. สร้างกระบวนการทำงานของคุณด้วย GlobalGPT เมื่อคุณต้องการให้เครื่องมือในการเลือกแบบจำลอง การวิจัย การเขียนโค้ด และเครื่องมือสร้างสรรค์ เชื่อมต่อกันในงานประจำวันของคุณ.
คำถามที่พบบ่อย
ทำอย่างไรเพื่อเปลี่ยนแบบในโค้ด Claude?
รัน /model เพื่อเปิดตัวเลือกรูปแบบ กด s เพื่อเปลี่ยนเฉพาะเซสชันปัจจุบัน หรือกด Enter เพื่อบันทึกแบบที่เลือกไว้เป็นค่าเริ่มต้น หากต้องการเลือกแบบสำหรับเซสชันใหม่เพียงครั้งเดียว ให้รันคำสั่ง claude –model ตามด้วยชื่อแบบ.
/model จะเปลี่ยนค่าเริ่มต้นที่ฉันบันทึกไว้หรือไม่?
ในเวอร์ชันแบบโต้ตอบปัจจุบัน การเลือกโมเดลด้วยปุ่ม Enter หรือพิมพ์ /model sonnet จะบันทึกการเลือกไว้ในตั้งค่าผู้ใช้ หากสามารถเขียนได้ การกดปุ่ม s ในตัวเลือกจะมีผลเฉพาะในเซสชันนั้นเท่านั้น ส่วนการตั้งค่าอื่น ๆ ยังคงมีสิทธิ์เหนือกว่าเมื่อเปิดโปรแกรมครั้งต่อไป.
แบบรหัส Claude ที่ตั้งไว้เป็นค่าเริ่มต้นคืออะไร?
ค่าเริ่มต้นของ runtime ขึ้นอยู่กับบัญชี ผู้ให้บริการ และการตั้งค่าของคุณ ค่าเริ่มต้นจะล้างการแทนที่โมเดล (model override) และไม่ใช่ ID โมเดลที่คงที่เพียงหนึ่งเดียว โปรดตรวจสอบโมเดลที่กำลังใช้งานอยู่ด้วยคำสั่ง /status และตรวจสอบตัวเลือกรายการ (picker) แทนที่จะสมมติว่าทุกบัญชีเริ่มต้นจากเวอร์ชันเดียวกัน.
Opusplan ทำอะไร?
ระบบนี้ใช้ Opus ในโหมดการวางแผน และใช้ Sonnet ในโหมดการดำเนินการ ระบบจะติดตามการเปลี่ยนโหมด แทนที่จะเลือกโมเดลที่มีค่าใช้จ่ายต่ำที่สุดโดยอัตโนมัติสำหรับแต่ละคำสั่ง ค่าใช้จ่ายจริงขึ้นอยู่กับงานที่ดำเนินการในแต่ละขั้นตอน.
ทำไมโมเดลหนึ่งถึงไม่ปรากฏในตัวเลือก?
ความพร้อมใช้งานอาจขึ้นอยู่กับผู้ให้บริการ บัญชี ข้อจำกัดขององค์กร และเวอร์ชันของรหัส Claude โปรดตรวจสอบเอกสารของโมเดลปัจจุบันและโมเดลที่อนุญาตในสภาพแวดล้อมของคุณ นอกจากนี้ ชื่อเรียกแทนของตระกูลโมเดลอาจชี้ไปยังเวอร์ชันที่ต่างกันบนผู้ให้บริการอื่น.
รุ่นที่ราคาถูกกว่าจะทำให้ค่าใช้จ่ายในการทำงานนั้นถูกลงเสมอหรือไม่?
ไม่ครับ ราคาโทเคนเป็นเพียงปัจจัยหนึ่งเท่านั้น การใช้งานรวม คำตอบที่ไม่ครบถ้วน การลองใหม่ และความพยายามในการตรวจสอบ ล้วนส่งผลต่อค่าใช้จ่ายของการเปลี่ยนแปลงที่ยอมรับได้ ในการปรับโครงสร้างโค้ดขนาดเล็กของเรา ฟังก์ชันทั้งสามผ่านทั้งหมด ในขณะที่การตอบสนองขนาดใหญ่ทั้งสามที่มีสองไฟล์ถูกตัดสั้นลงที่ขีดจำกัดผลลัพธ์ที่ใช้ร่วมกัน.
แหล่งข้อมูล
- การกำหนดค่าแบบจำลองรหัส Claude — การเลือกโมเดล, ค่าเริ่มต้น, ชื่อแทน, ความแตกต่างระหว่างผู้ให้บริการ และ opusplan.
- ค่าใช้จ่ายตามรหัส Claude — การประมาณการใช้งาน, ขีดจำกัดการสมัครสมาชิก, การเก็บข้อมูลในแคช และการควบคุมค่าใช้จ่าย.
- ภาพรวมของรุ่น Anthropic และ ราคา API — ข้อมูลจำเพาะของรุ่นปัจจุบันและราคาขายตามรายการ.
- แบบอย่างและคำแนะนำเกี่ยวกับความพยายาม — ความแตกต่างในทางปฏิบัติระหว่างความสามารถ บริบท และความพยายาม.
- เอกสารคู่มือ CLI ของ GlobalGPT — กระบวนการทำงานในระบบเทอร์มินัลและการตั้งค่าตามบัญชี.







