การเชื่อมต่อ API ของ GPT-5.3 Codex
ใช้ GPT-5.3 Codex ผ่าน Rivya Public API v1 ด้วย model id gpt-5-3-codex-chat, input ที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่าง response
gpt-5-3-codex-chat
text, file
ไม่จำเป็นสำหรับ request ขั้นต่ำ
4
แชต
Chat API: non-streaming + streaming แบบ SSE
TOKEN_BASED
20000 อักขระ
contract ของ request
คำขอแชตส่งครั้งละหนึ่งข้อความ session history ถูกเก็บโดย Rivya อย่าส่ง raw messages array
| Key | Type | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|
| model | string | ใช่ | gpt-5-3-codex-chat | ใช้ API model id gpt-5-3-codex-chat |
| session_id | string | ไม่ใช่ | - | chat session id ที่สร้างผ่าน API แบบเลือกได้ ไม่ต้องส่งเพื่อเริ่ม session ใหม่ |
| message | string | ใช่ | - | ข้อความผู้ใช้ถัดไป history ของ Chat API มาจาก session ฝั่ง server ไม่ใช่ raw messages array |
| attachments | array | ไม่ใช่ | - | ค่า image file_id แบบเลือกได้ที่ Files API ส่งกลับมา ไม่รับ URL ไฟล์แนบภายนอก |
| enable_web_search | boolean | ไม่ใช่ | false | ใช้เฉพาะเมื่อโมเดลแชตที่เลือกรองรับ web search |
| reasoning_effort | string | ไม่ใช่ | default | reasoning effort แบบเลือกได้: default, minimal, low, medium, high หรือ xhigh เมื่อรองรับ |
| client_request_id | string | ไม่ใช่ | - | client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ |
พารามิเตอร์โมเดล
โมเดลแชตนี้ใช้ฟิลด์ Chat API ร่วมด้านบน การรองรับเฉพาะโมเดลสำหรับ web search, ไฟล์แนบภาพ, thoughts และ reasoning สะท้อนอยู่ในข้อมูลความพร้อม
request ขั้นต่ำ
{
"model": "gpt-5-3-codex-chat",
"message": "Write a concise launch plan for a new product image campaign"
}request แบบไฟล์ reference
{
"model": "gpt-5-3-codex-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_3_codex_chat_example",
"object": "chat.completion",
"session_id": "chat_session_gpt_5_3_codex_chat",
"model": "gpt-5-3-codex-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
}
}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