Rivya AI Docs
หน้า API ของโมเดล

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

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

พร้อมใช้งานผ่าน APItext input พร้อมแชต
ID โมเดล API

gpt-5-2-chat

Input

text, file

Files API

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

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

3

ความสามารถ

แชต

ความพร้อม

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

Billing

TOKEN_BASED

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

20000 อักขระ

contract ของ request

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

KeyTypeจำเป็นค่าเริ่มต้นคำอธิบาย
modelstringใช่gpt-5-2-chatใช้ API model id gpt-5-2-chat
session_idstringไม่ใช่-chat session id ที่สร้างผ่าน API แบบเลือกได้ ไม่ต้องส่งเพื่อเริ่ม session ใหม่
messagestringใช่-ข้อความผู้ใช้ถัดไป history ของ Chat API มาจาก session ฝั่ง server ไม่ใช่ 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ไม่ใช่-client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ

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

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

request ขั้นต่ำ

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

request แบบไฟล์ reference

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

response จากการสร้าง

endpoint Chat ส่งข้อความ assistant ที่เสร็จแล้ว token usage และ credit settlement สุดท้ายของ turn นี้กลับมา

{
  "id": "chatcmpl_msg_gpt_5_2_chat_example",
  "object": "chat.completion",
  "session_id": "chat_session_gpt_5_2_chat",
  "model": "gpt-5-2-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": 3,
    "final": 3
  }
}

error ทั่วไป

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

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