OpenThai 2.0 Legal ThaiLLM
OpenThai 2.0 Legal (iapp/openthai2.0-legal-thaillm-nemotron-3-nano-30b-a3b) เป็นโมเดล LLM กฎหมายไทยน้ำหนักเปิด (open-weight) ที่สร้างขึ้นบน NVIDIA Nemotron-3-Nano-30B-A3B โดยทีม OpenThai (AIEAT / บริษัท ไอแอพพ์เทคโนโลยี จำกัด) API ที่โฮสต์อยู่นี้ เชื่อมต่อ RAG มาพร้อมใช้งานทันที: ทุกคำขอจะทำการค้นหาแบบผสมผสาน (hybrid-search) ใน คลังข้อมูลกฎหมายไทย 39 ฉบับ จำนวน 6,300 มาตรา (BM25 + การค้นหาด้วย Qwen3 embedding + reranker) และอ้างอิงคำตอบจากข้อความกฎหมายปัจจุบัน — พร้อมส่งคืนมาตราที่ค้นพบเพื่อให้คุณแสดงผลหรือตรวจสอบได้
- 📄 หน้าโมเดลและเกณฑ์มาตรฐาน: OpenThai 2.0 Legal
- 🤗 น้ำหนักเปิด (Open weights): huggingface.co/iapp
- 🔗 โฮสต์ด้วย RAG ของคุณเอง: คู่มือ Open WebUI & OpenThaiRAG
ทดลองใช้งาน Demo
Try OpenThai 2.0 Legal — Live
FREE API · 1 MONTHReal model, real answers. Free with your iApp API key until 24 Aug 2026.
This API retrieves from a 39-law, 6,300-section Thai statute corpus (hybrid BM25 + embedding search + reranker) and grounds every answer in the current law text. The sections it selects are shown below each answer. Switch to Closed-book mode (rag: false in the API) to compare with the bare model.
Full legal analysis in prose, citing มาตรา — grounded in auto-retrieved current statute text.
🧑💻 Developer view — the API call behind this demo
This curl command updates live as you change the question, mode and toggles above. Run it in your terminal with your own API key — it is exactly what this page sends.
curl -s https://api.iapp.co.th/v3/llm/openthai2p0-legal/chat/completions \
-H "Content-Type: application/json" \
-H "apikey: YOUR_IAPP_API_KEY" \
-d '{
"model": "openthai2.0-legal",
"rag": true,
"rag_inject": "system",
"messages": [
{
"role": "system",
"content": "You are a Thai legal expert. Answer with legal analysis and cite the relevant มาตรา."
},
{
"role": "user",
"content": "จำเลยขีดฆ่าและฉีกเอกสารหลักฐานแห่งหนี้ แม้ยังอ่านได้ ถือเป็นความผิดสำเร็จหรือเพียงพยายามกระทำผิด"
}
],
"temperature": 0,
"top_p": 1,
"max_tokens": 4096,
"chat_template_kwargs": {
"enable_thinking": true
},
"stream": true,
"stream_options": {
"include_usage": true
}
}'Outputs are decision support, not legal advice. Verify every citation against the current law. Free with an iApp API key to 24 Aug 2026; standard pricing afterwards is 0.01/0.02 IC per 1K input/output tokens (same as Thanoy Legal AI).
เริ่มต้นใช้งาน
-
สิ่งที่ต้องมี
- คีย์ API ฟรีของ iApp — ลงทะเบียน → API Keys → Create New API Key
- คำถามเกี่ยวกับกฎหมายไทย
-
Endpoint
Base URL https://api.iapp.co.th/v3/llm/openthai2p0-legalEndpoint POST /chat/completions(เข้ากันได้กับ OpenAI)Model openthai2.0-legalAuth apikey: <key>header หรือAuthorization: Bearer <key>(OpenAI SDK ใช้งานได้ทันที)Rate limit 30 คำขอ/นาที ต่อ IP (ฟรี) -
พารามิเตอร์ RAG (ส่วนเสริมของ API นี้ นอกเหนือจาก schema ของ OpenAI)
Field Default ความหมาย ragtrueค้นหาส่วนของกฎหมายไทยบนเซิร์ฟเวอร์และอ้างอิงคำตอบ false= โมเดลเปล่า (closed-book)rag_top_k8 (สูงสุด 20) จำนวนส่วนที่ค้นพบที่จะแทรกใน prompt (6 เมื่อ rag_inject: "system")rag_inject"user""user"= โครงสร้าง Provided context ที่โมเดลถูกฝึกมา เหมาะสำหรับคำตอบที่มีการอ้างอิง JSON"system"= การอ้างอิงเป็นคำแนะนำใน system prompt เหมาะสำหรับบทความ/การวิเคราะห์แบบยาวทุกการตอบสนองจาก RAG จะมีอาร์เรย์
retrieved_documentsระดับบนสุด —{law, section, text, score}สำหรับแต่ละมาตราที่ใช้ในการตอบสนอง เมื่อใช้งานแบบสตรีมมิ่ง (streaming) จะปรากฏใน SSE chunk แรก
กรุณาไปที่หน้า API Key Management เพื่อดูคีย์ API ที่มีอยู่ของคุณ หรือขอคีย์ใหม่
ตัวอย่างโค้ด
cURL — RAG ทำงาน (ค่าเริ่มต้น)
curl -X POST 'https://api.iapp.co.th/v3/llm/openthai2p0-legal/chat/completions' \
-H 'apikey: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "openthai2.0-legal",
"messages": [
{"role": "user", "content": "ลักทรัพย์ในเวลากลางคืน ผิดมาตราใด"}
],
"max_tokens": 1024
}'
ผลลัพธ์ (ตัดทอน)
{
"id": "chatcmpl-...",
"model": "openthai2.0-legal-thaillm-nemotron-3-nano-30b-a3b",
"choices": [
{"message": {"role": "assistant", "content": "ลักทรัพย์ในเวลากลางคืน เป็นการกระทำความผิดตามมาตรา ๓๓๕ (๑) แห่งประมวลกฎหมายอาญา ..."}}
],
"usage": {"prompt_tokens": 2874, "completion_tokens": 17},
"rag": true,
"retrieved_documents": [
{"law": "ประมวลกฎหมายอาญา", "section": "335", "text": "ผู้ใดลักทรัพย์ (๑) ในเวลากลางคืน ...", "score": 0.9989},
{"law": "ประมวลกฎหมายอาญา", "section": "334", "text": "ผู้ใดเอาทรัพย์ของผู้อื่น ...", "score": 0.9936}
]
}