Skip to content

OpenRouter Chat Model node#

ใช้ OpenRouter Chat Model node เพื่อใช้งานโมเดลแชทของ OpenRouter กับ conversational agents

ในหน้านี้จะมีพารามิเตอร์ของ node OpenRouter Chat Model และลิงก์ไปยังแหล่งข้อมูลเพิ่มเติม

Credentials

คุณสามารถดูข้อมูลการเชื่อมต่อสำหรับ node นี้ได้ ที่นี่

Parameter resolution in sub-nodes (การประมวลผล Parameter ใน sub-nodes)

Sub-nodes มีพฤติกรรมแตกต่างจาก node อื่นๆ เมื่อประมวลผลหลายรายการโดยใช้ expression

Node ส่วนใหญ่ รวมถึง root node จะรับ input กี่รายการก็ได้ ประมวลผลรายการเหล่านี้ และส่ง output ออกมา คุณสามารถใช้ expression เพื่ออ้างอิงถึง input item และ node จะประมวลผล expression สำหรับแต่ละ item ตามลำดับ ตัวอย่างเช่น หากมี input เป็นค่า name ห้ารายการ expression {{ $json.name }} จะถูกประมวลผลเป็นแต่ละชื่อตามลำดับ

ใน sub-nodes expression จะถูกประมวลผลเป็น item แรกเสมอ ตัวอย่างเช่น หากมี input เป็นค่า name ห้ารายการ expression {{ $json.name }} จะถูกประมวลผลเป็นชื่อแรกเสมอ

Node parameters#

Model#

เลือกโมเดลที่ต้องการให้สร้างข้อความตอบกลับ

n8n จะโหลดโมเดลจาก OpenRouter แบบ dynamic คุณจะเห็นเฉพาะโมเดลที่บัญชีของคุณเข้าถึงได้

Node options#

ตัวเลือกเหล่านี้จะช่วยให้คุณปรับแต่งการทำงานของ node ได้มากขึ้น

Base URL#

ใส่ URL เพื่อ override ค่า default ของ API

Frequency Penalty#

ปรับโอกาสที่โมเดลจะตอบซ้ำๆ ค่าเยอะจะลดการตอบซ้ำ

Maximum Number of Tokens#

กำหนดจำนวน tokens สูงสุดที่ใช้ ซึ่งจะเป็นการกำหนดความยาวของข้อความที่โมเดลจะตอบกลับ

Response Format#

เลือก Text หรือ JSON ถ้าเลือก JSON โมเดลจะตอบกลับเป็น JSON ที่ถูกต้องเสมอ

Presence Penalty#

ปรับโอกาสที่โมเดลจะพูดถึงหัวข้อใหม่ๆ ค่าเยอะจะเพิ่มโอกาสพูดเรื่องใหม่

Sampling Temperature#

ปรับความสุ่มของการสร้างข้อความ ค่า temperature สูงจะทำให้โมเดลตอบหลากหลายมากขึ้น แต่ก็เสี่ยงต่อการตอบแบบหลุดประเด็น

Timeout#

กำหนดเวลาสูงสุด (ms) ที่จะรอผลลัพธ์

Max Retries#

กำหนดจำนวนครั้งสูงสุดที่ระบบจะลองส่ง request ใหม่

Top P#

กำหนดความน่าจะเป็นรวมที่โมเดลจะใช้ในการเลือก token ถัดไป ค่า Top P ต่ำจะตัดตัวเลือกที่มีความน่าจะเป็นน้อยออก

Templates and examples#

Automate SEO-Optimized WordPress Posts with AI & Google Sheets

by Davide

View template details
Publish WordPress Posts to Social Media X, Facebook, LinkedIn, Instagram with AI

by Davide

View template details
AI Email Analyzer: Process PDFs, Images & Save to Google Drive + Telegram

by Davide

View template details
Browse OpenRouter Chat Model integration templates, or search all templates

OpenRouter ใช้ API แบบเดียวกับ OpenAI สามารถดูข้อมูลเพิ่มเติมได้ที่ LangChains's OpenAI documentation

ดูเอกสาร Advanced AI ของ n8n

AI glossary#

  • completion: Completions are the responses generated by a model like GPT.
  • hallucinations: Hallucination in AI is when an LLM (large language model) mistakenly perceives patterns or objects that don't exist.
  • vector database: A vector database stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.
  • vector store: A vector store, or vector database, stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.