การเชื่อมต่อ API ของ Seedream 4.0
ใช้ Seedream 4.0 ผ่าน Rivya Public API v1 ด้วย model id seedream-4-0, input ที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่าง response
seedream-4-0
text, file
จำเป็นสำหรับโหมด reference
6
รูปภาพ
FIXED
5000 อักขระ
contract ของ request
ส่ง model id ที่ระดับบนสุด control เฉพาะโมเดลอยู่ใน params
| Key | Type | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|
| model | string | ใช่ | seedream-4-0 | ใช้ API model id seedream-4-0 |
| prompt | string | ใช่ | - | สูงสุด 5000 อักขระสำหรับโมเดลนี้ |
| params | object | ไม่ใช่ | - | object พารามิเตอร์เฉพาะโมเดล ใช้แถวด้านล่างสำหรับ key ที่อนุญาต |
| client_request_id | string | ไม่ใช่ | - | client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ |
พารามิเตอร์โมเดล
| Key | Type | จำเป็น | ค่าเริ่มต้น | ช่วง | ตัวเลือก | คำอธิบาย |
|---|---|---|---|---|---|---|
| image_size | select | ไม่ใช่ | square_hd | - | square, square_hd, portrait_4_3, portrait_3_2, portrait_16_9, landscape_4_3, landscape_3_2, landscape_16_9, landscape_21_9 | ควบคุมอัตราส่วนกรอบภาพ เมื่อใช้ร่วมกับความละเอียดเอาต์พุต จะกำหนดขนาดพิกเซลสุดท้าย |
| image_resolution | select | ไม่ใช่ | 1K | - | 1K, 2K, 4K | ระดับปัจจุบันคือ `1K`, `2K` และ `4K` ความละเอียดที่สูงขึ้นมักหมายถึงไฟล์ใหญ่ขึ้นและรอนานขึ้น |
| max_images | number | ไม่ใช่ | 1 | min 1 / max 6 / step 1 | - | ค่าที่ใช้ได้คือ 1 ถึง 6 ควบคุมจำนวนภาพที่งานหนึ่งงานส่งคืนได้ ดังนั้นควรทำให้พรอมป์สอดคล้องกับจำนวนนั้น |
| seed | number | ไม่ใช่ | - | min 0 / max 2147483647 / step 1 | - | เว้นว่างไว้เพื่อสร้างผลลัพธ์แบบสุ่มใหม่ทุกครั้ง การใช้เลขจำนวนเต็มเดิมซ้ำจะช่วยให้ทำซ้ำหรือปรับละเอียดจากผลลัพธ์ก่อนหน้าได้ง่ายขึ้น ผลลัพธ์จะใกล้เคียงขึ้นเมื่อพรอมป์และการตั้งค่าหลักอื่นยังคล้ายเดิมเท่านั้น และไม่รับประกันว่าจะตรงกันแบบ 1:1 |
| nsfw_checker | select | ไม่ใช่ | false | - | false, true | ควบคุมตัวกรองเนื้อหา การปิดจะทำให้ใกล้กับเอาต์พุตดิบมากขึ้น แต่ก็หมายถึงการยอมรับชั้นความปลอดภัยที่อ่อนลง |
policy การอัปโหลด
อัปโหลดไฟล์ reference ก่อน จากนั้นใส่ URL และ duration token ที่ได้กลับมาไว้ใน params.referenceMediaItems
ภาพอ้างอิง: อัปโหลดภาพได้สูงสุด 10 ภาพสำหรับเส้นทางแก้ไข Seedream 4.0
10
image
reference วิดีโอและเสียงควรมี durationToken จาก /api/v1/files เมื่อจำเป็นต้องตรวจ duration
| kind | ขนาดสูงสุด | MIME type |
|---|---|---|
| image | 10 MB | image/jpeg, image/png, image/webp |
request ขั้นต่ำ
{
"model": "seedream-4-0",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"image_size": "square_hd",
"image_resolution": "1K",
"max_images": 1,
"seed": 0,
"nsfw_checker": "false"
}
}request แบบไฟล์ reference
{
"model": "seedream-4-0",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"image_size": "square_hd",
"image_resolution": "1K",
"max_images": 1,
"seed": 0,
"nsfw_checker": "false",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}response จากการสร้าง
endpoint create ส่ง public task id กลับมา poll endpoint สถานะจนกว่างานจะสำเร็จหรือล้มเหลว
{
"id": "task_seedream_4_0_example",
"status": "queued",
"model": "seedream-4-0",
"reserved_credits": 6,
"final_credits": 0,
"created_at": "2026-05-11T00:00:00.000Z",
"updated_at": "2026-05-11T00:00:00.000Z",
"result": null,
"error": null
}error ทั่วไป
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
บางโหมดต้องใช้การอัปโหลด reference ผ่าน Files API