เอกสาร Rivya AI
หน้า API ของโมเดล

การเชื่อมต่อ API ของ GPT-5.4

ใช้ GPT-5.4 ผ่าน Rivya Public API v1 ด้วย model id gpt-5-4-chat, อินพุตที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่างคำตอบ

พร้อมใช้งานผ่าน APIอินพุตข้อความพร้อมแชต
ID โมเดล API

gpt-5-4-chat

อินพุต

text, file

Files API

ไม่จำเป็นสำหรับคำขอขั้นต่ำ

เครดิตพื้นฐาน

4

ความสามารถ

แชต

ความพร้อม

Chat API: non-streaming + streaming แบบ SSE

การชำระเงิน

TOKEN_BASED

ขีดจำกัดพรอมต์

20000 อักขระ

สัญญาของคำขอ

คำขอแชตส่งครั้งละหนึ่งข้อความ ประวัติเซสชันถูกเก็บโดย Rivya อย่าส่ง raw messages array

คีย์ประเภทจำเป็นค่าเริ่มต้นคำอธิบาย
modelstringใช่gpt-5-4-chatใช้ API model id gpt-5-4-chat
session_idstringไม่ใช่-ID เซสชันแชตที่สร้างผ่าน API แบบเลือกได้ ไม่ต้องส่งเพื่อเริ่มเซสชันใหม่
messagestringใช่-ข้อความผู้ใช้ถัดไป ประวัติของ Chat API มาจากเซสชันฝั่งเซิร์ฟเวอร์ ไม่ใช่ raw messages array
attachmentsarrayไม่ใช่-ค่า image file_id แบบเลือกได้ที่ Files API ส่งกลับมา ไม่รับ URL ไฟล์แนบภายนอก
enable_web_searchbooleanไม่ใช่falseใช้เฉพาะเมื่อโมเดลแชตที่เลือกรองรับ web search
reasoning_effortstringไม่ใช่defaultreasoning effort แบบเลือกได้: default, minimal, low, medium, high หรือ xhigh เมื่อรองรับ
client_request_idstringไม่ใช่-ID ฝั่งไคลเอนต์แบบเลือกได้สำหรับติดตามคำขอในระบบของคุณ

พารามิเตอร์โมเดล

โมเดลแชตนี้ใช้ฟิลด์ Chat API ร่วมด้านบน การรองรับเฉพาะโมเดลสำหรับ web search, ไฟล์แนบภาพ, thoughts และ reasoning สะท้อนอยู่ในข้อมูลความพร้อม

คำขอขั้นต่ำ

{
  "model": "gpt-5-4-chat",
  "message": "Write a concise launch plan for a new product image campaign"
}

คำขอแบบไฟล์อ้างอิง

{
  "model": "gpt-5-4-chat",
  "message": "Write a concise launch plan for a new product image campaign",
  "attachments": [
    {
      "file_id": "file_uploaded_image_id"
    }
  ]
}

คำตอบจากการสร้าง

endpoint Chat ส่งข้อความ assistant ที่เสร็จแล้ว การใช้โทเค็น และการสรุปเครดิตสุดท้ายของรอบนี้กลับมา

{
  "id": "chatcmpl_msg_gpt_5_4_chat_example",
  "object": "chat.completion",
  "session_id": "chat_session_gpt_5_4_chat",
  "model": "gpt-5-4-chat",
  "created_at": "2026-05-11T00:00:00.000Z",
  "message": {
    "id": "assistant_message_id",
    "role": "assistant",
    "content": "A concise launch plan with clear next steps."
  },
  "usage": {
    "input_tokens": 1200,
    "output_tokens": 320,
    "total_tokens": 1520
  },
  "credits": {
    "reserved": 4,
    "final": 4
  }
}

ข้อผิดพลาดทั่วไป

validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found, chat_model_not_supported, chat_session_conflict, chat_attachment_not_supported

Chat API รองรับรอบสนทนาแบบ non-streaming และ SSE streaming ใน Public API v1 ไฟล์แนบภาพต้องใช้ค่า file_id จาก Files API