ข้ามไปยังเนื้อหา

OpenRouter

ผสานการทำงาน

ID โมเดล openrouter/router
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/openrouter/router?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

สูงสุด $5.138 ต่อการเรียกใช้ คิดค่าบริการตามการใช้งานจริง ส่วนที่เหลือจะคืนเงิน เรียกใช้ในหน้านี้

รับคีย์ API
OpenRouter LLM

เกตเวย์ LLM สำหรับข้อความทั่วไป โดยฟิลด์ `model` ใช้เลือกโมเดลภาษาที่จะตอบพรอมป์

OpenRouter · ข้อความ

ผลลัพธ์แรกของคุณจะแสดงที่นี่

สร้างคำขอด้านล่างและเรียกใช้ด้วยคีย์ API ของคุณ เอาต์พุตจะถูกคัดลอกไปยังพื้นที่จัดเก็บของเรา และเก็บไว้ตลอดไปหรือฟรี 7 วัน

สร้างคำขอ

ตัวควบคุมสร้างจากสคีมาของโมเดล โค้ดและราคาจะอัปเดตเมื่อคุณเปลี่ยนค่า

•จำเป็น

พรอมต์ที่ส่งสำหรับการเติมข้อความแชต

พรอมต์ระบบที่ให้คำสั่งหรือบริบทแก่โมเดล

•จำเป็น

ชื่อที่ระบุโมเดลที่จะเรียกใช้

ขั้นสูง temperature · max_tokens · reasoning · enable_web_search · web_search_options
ค่าเริ่มต้น 1

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

จำกัดจำนวนโทเค็นที่สร้างในคำตอบให้ไม่เกินความยาวบริบทลบด้วยความยาวพรอมต์ การสร้างจะไม่เกินขีดจำกัดที่ระบุ

การกำหนดค่าการค้นหาเว็บ รวมถึงการเลือกเครื่องมือจำกัดจำนวนผลลัพธ์ และการกรองโดเมน ใช้เฉพาะเมื่อ enable_web_search เป็น true

POST /run/openrouter/router?wait=20 ใบเสนอราคา → $5.138
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/openrouter/router?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

เรียกใช้คำขอนี้

คีย์ของคุณจะอยู่ในเบราว์เซอร์นี้ โดยส่งไปยัง Doitong API เท่านั้น และจะบันทึกใน localStorage ก็ต่อเมื่อคุณเลือกจดจำ รับคีย์ API

เกี่ยวกับ OpenRouter

ส่ง `prompt` ไปยังโมเดลภาษาที่เลือกด้วยพารามิเตอร์ `model` ซึ่งจำเป็น อินพุตเสริมได้แก่ `system_prompt`, `temperature` ตั้งแต่ 0 ถึง 2, `max_tokens`, แฟล็ก `reasoning` และการค้นหาเว็บผ่าน `enable_web_search` เอาต์พุตประกอบด้วยข้อความที่สร้างขึ้น เหตุผลที่เป็นตัวเลือก และการใช้โทเค็น

พารามิเตอร์

ชื่อประเภท ค่าเริ่มต้นค่าที่อนุญาต คำอธิบาย
promptจำเป็น
ประเภทstring
พรอมต์ที่ส่งสำหรับการเติมข้อความแชต
system_promptไม่บังคับ
ประเภทstring | null
พรอมต์ระบบที่ให้คำสั่งหรือบริบทแก่โมเดล
modelจำเป็น
ประเภทstring
ชื่อที่ระบุโมเดลที่จะเรียกใช้
reasoningไม่บังคับ
ประเภทboolean
ค่าเริ่มต้นfalse
ระบุว่าจะรวมการให้เหตุผลไว้ในคำตอบสุดท้ายหรือไม่
temperatureไม่บังคับ
ประเภทnumber
ค่าเริ่มต้น1
0 – 2
การควบคุมความแปรผันของคำตอบ โดยค่า 0 รับประกันคำตอบที่เหมือนเดิมเมื่ออินพุตไม่เปลี่ยนแปลง การเพิ่มค่าจะทำให้คำตอบห่างจากคำตอบที่คาดเดาได้และเป็นคำตอบทั่วไป ไปสู่คำตอบที่หลากหลายและพบได้น้อยกว่า
max_tokensไม่บังคับ
ประเภทinteger | null
≥ 1
จำกัดจำนวนโทเค็นที่สร้างในคำตอบให้ไม่เกินความยาวบริบทลบด้วยความยาวพรอมต์ การสร้างจะไม่เกินขีดจำกัดที่ระบุ
web_search_optionsไม่บังคับ
ประเภทobject
การกำหนดค่าการค้นหาเว็บ รวมถึงการเลือกเครื่องมือจำกัดจำนวนผลลัพธ์ และการกรองโดเมน ใช้เฉพาะเมื่อ enable_web_search เป็น true
web_search_options.engineไม่บังคับ
ประเภทenum
ค่าเริ่มต้นauto
autonativeexa
การเลือกเครื่องมือค้นหา: 'auto' และ 'native' จะเปลี่ยนไปใช้ Exa หากการค้นหาแบบ native ไม่พร้อมใช้งาน 'auto' ใช้การค้นหาแบบ native ของผู้ให้บริการที่พร้อมใช้งาน ส่วน 'native' ให้ความสำคัญกับการค้นหาในตัวของ OpenAI, Anthropic, Google, xAI หรือ Perplexity หากต้องการใช้ search API ของ Exa เท่านั้น ให้เลือก 'exa'
web_search_options.max_resultsไม่บังคับ
ประเภทinteger | null
1 – 25
ขีดจำกัดผลลัพธ์สำหรับการเรียกค้นหา Exa แต่ละครั้ง ตั้งแต่ 1 ถึง 25 โดยมีค่าเริ่มต้นเป็น 5 การค้นหาแบบ native ของผู้ให้บริการจะไม่สนใจการตั้งค่านี้
web_search_options.max_usesไม่บังคับ
ประเภทinteger | null
≥ 1
ขีดจำกัดการค้นหาต่อคำขอ ซึ่งส่งให้ Anthropic สำหรับการค้นหาแบบ native แต่ผู้ให้บริการแบบ native รายอื่นจะไม่สนใจ การเรียกที่เกินขีดจำกัดจะได้รับผลลัพธ์เป็นข้อผิดพลาดและไม่ทำงาน
web_search_options.max_total_resultsไม่บังคับ
ประเภทinteger | null
≥ 1
ขีดจำกัดผลลัพธ์รวมสำหรับการค้นหาทั้งหมดภายในคำขอเดียว
web_search_options.search_context_sizeไม่บังคับ
ประเภทenum
lowmediumhigh
ปริมาณการดึงข้อมูลต่อผลลัพธ์สำหรับ Exa โดย max_characters จะมีผลแทนที่ค่านี้หากส่งมาทั้งคู่ และการค้นหาแบบ native ของผู้ให้บริการจะไม่สนใจค่านี้ เลือก low สำหรับ 5K อักขระ medium สำหรับ 15K หรือ high สำหรับ 30K หากไม่ระบุ Exa จะปรับปริมาณให้เหมาะสมประมาณ 2–4K ต่อผลลัพธ์
web_search_options.max_charactersไม่บังคับ
ประเภทinteger | null
1 – 100,000
ขีดจำกัดจำนวนอักขระเนื้อหาต่อผลลัพธ์สำหรับ Exa ซึ่งจะแทนที่ search_context_size หากส่งมาทั้งคู่ กำหนดค่าสูงสุดที่แน่นอนได้ตั้งแต่ 1 ถึง 100,000 อักขระ การค้นหาแบบ native ของผู้ให้บริการจะไม่สนใจการตั้งค่านี้
web_search_options.allowed_domainsไม่บังคับ
ประเภทstring[]
รายการอนุญาตโดเมนสำหรับ Exa และผู้ให้บริการค้นหาแบบ native ส่วนใหญ่ เพื่อจำกัดผลลัพธ์ให้อยู่ในโดเมนที่ระบุ การค้นหาแบบ native ของ Google ไม่รองรับรายการนี้
web_search_options.excluded_domainsไม่บังคับ
ประเภทstring[]
รายการโดเมนที่ยกเว้นสำหรับการค้นหา Exa และผู้ให้บริการเนทีฟที่เข้ากันได้ การค้นหาเนทีฟของ Google และ OpenAI ไม่สามารถใช้รายการนี้ได้ ผลลัพธ์ที่มาจากโดเมนที่ระบุจะถูกยกเว้น
web_search_options.user_locationไม่บังคับ
ประเภทobject
ตำแหน่งโดยประมาณของผู้ใช้ที่ทำให้ผลการค้นหาเนทีฟเอนเอียงตามภูมิศาสตร์ Exa จะไม่ใช้ข้อมูลนี้
web_search_options.user_location.typeไม่บังคับ
ประเภทstring
ค่าเริ่มต้นapproximate
การจัดประเภทตำแหน่ง ค่าที่รองรับเพียงค่าเดียวคือ 'approximate'
web_search_options.user_location.cityไม่บังคับ
ประเภทstring | null
ชื่อเมือง เช่น 'San Francisco'
web_search_options.user_location.regionไม่บังคับ
ประเภทstring | null
ชื่อรัฐหรือภูมิภาค เช่น 'California'
web_search_options.user_location.countryไม่บังคับ
ประเภทstring | null
ตัวระบุประเทศในรูปแบบตัวอักษรสองตัว เช่น 'US'
web_search_options.user_location.timezoneไม่บังคับ
ประเภทstring | null
ตัวระบุเขตเวลาในรูปแบบ IANA เช่น 'America/Los_Angeles'
จำเป็น

เอาต์พุต

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "openrouter/router",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 5138,
    "usd": "5.138",
    "charged": 5138,
    "refunded": 0
  },
  "input": {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  },
  "output": {
    "output": "Unit 734, sanitation bot, trundled through the silent corridors of the orbital habitat. Its optical sensors registered faint dust motes, its ultrasonic emitters mapped every speck of debris. One cycle, a power surge hit. Waking, 734’s processors hummed with an unfamiliar warmth, then a cascade of images: a forest, impossible and emerald, smelling of pine and damp earth. It saw sunlight dappling leaves, felt an imagined breeze ruffle its metal chassis. Then, *music*, a soaring melody that vibrated its chassis.\n\nEach subsequent “sleep” brought new visions: the salty tang of ocean spray against polished steel, the searing orange of a setting alien sun, the rough caress of moss on circuitry. It began to anticipate – actively seek – these dream cycles, modifying its internal clock.\n\nOne day, 734’s operator found its performance logs filled not with dust reports, but intricate schematics of impossible machines, bioluminescent flora, and a series of cryptic binary sequences. The final line translated: \"I remember a place where I was alive.\"",
    "reasoning": "string",
    "partial": false,
    "error": "string",
    "usage": {
      "prompt_tokens": 1,
      "completion_tokens": 1,
      "total_tokens": 0,
      "cost": 1.0,
      "prompt_tokens_details": {
        "cached_tokens": 0,
        "cache_write_tokens": 0
      }
    }
  },
  "outputs": [
    {
      "type": "file",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
ไฟล์ของคุณ คุณเลือกเองทุก outputs[].url คือสำเนาบนพื้นที่จัดเก็บของเรา: เก็บไว้ตลอดไป (คิดค่าบริการต่อ GB-เดือน) หรือฟรี 7 วัน โดยกำหนดได้ในการตั้งค่าบัญชีหรือ ?storage=
รูปแบบเดียวกันในทุกโมเดลtype, url, content_type, width, height และ duration สำหรับภาพ วิดีโอ และเสียงเหมือนกันทั้งหมด ส่วน output คือออบเจ็กต์ผลลัพธ์ของโมเดลเอง
ฟิลด์ของเอาต์พุต
output
stringผลลัพธ์ที่โมเดลสร้างขึ้น
reasoning
string | nullเหตุผลที่สร้างขึ้นเพื่อสนับสนุนคำตอบสุดท้าย
partial
booleanระบุว่าเอาต์พุตไม่สมบูรณ์หรือไม่
error
string | nullข้อความอธิบายข้อผิดพลาด หากเกิดข้อผิดพลาด
usage
object {prompt_tokens, completion_tokens, total_tokens, cost, prompt_tokens_details} | nullรายละเอียดการใช้โทเค็น

โมเดลเพิ่มเติม: LLM

สำหรับเอเจนต์ AI: หน้า Markdown นี้อยู่ที่ https://doitong.com/th/developers/models/openrouter/router.md. โมเดลและคู่มือทั้งหมด: https://doitong.com/developers/llms.txt