หน้า API ของโมเดล
การเชื่อมต่อ API ของ Google Imagen4
ใช้ Google Imagen4 ผ่าน Rivya Public API v1 ด้วย model id google-imagen4, input ที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่าง response
พร้อมใช้งานผ่าน APItext input พร้อมรูปภาพ
ID โมเดล API
google-imagen4
Input
text
Files API
ไม่จำเป็นสำหรับ request ขั้นต่ำ
เครดิตพื้นฐาน
8
ความสามารถ
รูปภาพ
Billing
FIXED
ขีดจำกัดพรอมต์
5000 อักขระ
contract ของ request
ส่ง model id ที่ระดับบนสุด control เฉพาะโมเดลอยู่ใน params
| Key | Type | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|
| model | string | ใช่ | google-imagen4 | ใช้ API model id google-imagen4 |
| prompt | string | ใช่ | - | สูงสุด 5000 อักขระสำหรับโมเดลนี้ |
| params | object | ไม่ใช่ | - | object พารามิเตอร์เฉพาะโมเดล ใช้แถวด้านล่างสำหรับ key ที่อนุญาต |
| client_request_id | string | ไม่ใช่ | - | client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ |
พารามิเตอร์โมเดล
| Key | Type | จำเป็น | ค่าเริ่มต้น | ช่วง | ตัวเลือก | คำอธิบาย |
|---|---|---|---|---|---|---|
| aspect_ratio | select | ไม่ใช่ | 1:1 | - | 1:1, 16:9, 9:16, 3:4, 4:3 | อัตราส่วนภาพ |
| negative_prompt | text | ไม่ใช่ | - | - | - | พรอมป์เชิงลบ |
| seed | text | ไม่ใช่ | - | - | - | เว้นว่างไว้เพื่อสร้างผลลัพธ์แบบสุ่มใหม่ทุกครั้ง การใช้เลขจำนวนเต็มเดิมซ้ำจะช่วยให้ทำซ้ำหรือปรับละเอียดจากผลลัพธ์ก่อนหน้าได้ง่ายขึ้น ผลลัพธ์จะใกล้เคียงขึ้นเมื่อพรอมป์และการตั้งค่าหลักอื่นยังคล้ายเดิมเท่านั้น และไม่รับประกันว่าจะตรงกันแบบ 1:1 |
request ขั้นต่ำ
{
"model": "google-imagen4",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspect_ratio": "1:1",
"negative_prompt": "สิ่งที่ไม่ต้องการแบบไม่บังคับ",
"seed": "ค่า seed แบบไม่บังคับ"
}
}response จากการสร้าง
endpoint create ส่ง public task id กลับมา poll endpoint สถานะจนกว่างานจะสำเร็จหรือล้มเหลว
{
"id": "task_google_imagen4_example",
"status": "queued",
"model": "google-imagen4",
"reserved_credits": 8,
"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
endpoint create ส่ง public task id กลับมา poll endpoint สถานะจนกว่างานจะสำเร็จหรือล้มเหลว