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

การเชื่อมต่อ API ของ Flux Kontext Max

ใช้ Flux Kontext Max ผ่าน Rivya Public API v1 ด้วย model id flux-kontext-max, input ที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่าง response

พร้อมใช้งานผ่าน APIText หรือ URL พร้อม; โหมด reference ใช้ Files APIรูปภาพ
ID โมเดล API

flux-kontext-max

Input

text, file

Files API

จำเป็นสำหรับโหมด reference

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

8

ความสามารถ

รูปภาพ

Billing

FIXED

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

ยังไม่มีขีดจำกัดพรอมต์ในเอกสาร

contract ของ request

ส่ง model id ที่ระดับบนสุด control เฉพาะโมเดลอยู่ใน params

KeyTypeจำเป็นค่าเริ่มต้นคำอธิบาย
modelstringใช่flux-kontext-maxใช้ API model id flux-kontext-max
promptstringใช่-ข้อความพรอมต์สำหรับโมเดลที่รองรับ input แบบข้อความ
paramsobjectไม่ใช่-object พารามิเตอร์เฉพาะโมเดล ใช้แถวด้านล่างสำหรับ key ที่อนุญาต
client_request_idstringไม่ใช่-client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ

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

KeyTypeจำเป็นค่าเริ่มต้นช่วงตัวเลือกคำอธิบาย
aspectRatioselectไม่ใช่16:9-21:9, 16:9, 4:3, 1:1, 3:4, 9:16อัตราส่วนภาพ
outputFormatselectไม่ใช่jpeg-jpeg, pngJPEG มีขนาดเล็กกว่า ส่วน PNG เหมาะกับความโปร่งใสหรือขอบแบบไม่สูญเสียรายละเอียดที่สะอาดกว่า
enableTranslationselectไม่ใช่true-true, falseแปลพรอมป์อัตโนมัติ
promptUpsamplingselectไม่ใช่false-false, trueเมื่อเปิดใช้ Rivya จะให้โมเดลขยายและขัดเกลาพรอมป์ของคุณก่อนสร้างภาพ มักช่วยให้รายละเอียดดีขึ้น แต่อาจทำให้ผลลัพธ์ตีความมากกว่าพรอมป์ดิบของคุณ
safetyTolerancenumberไม่ใช่2min 0 / max 6-ควบคุมความเข้มงวดของการกลั่นกรองเนื้อหา โดยปกติการสร้างภาพจะยอมรับช่วงกว้างกว่าการแก้ไขภาพ; ค่าต่ำเข้มงวดกว่า และค่าสูงผ่อนปรนกว่า
watermarktextไม่ใช่---ลายน้ำ

policy การอัปโหลด

อัปโหลดไฟล์ reference ก่อน จากนั้นใส่ URL และ duration token ที่ได้กลับมาไว้ใน params.referenceMediaItems

กฎ reference

ภาพอ้างอิง: อัปโหลดไฟล์ภาพได้สูงสุด 1 ไฟล์สำหรับโปรเจกต์แก้ไขภาพ

ไฟล์สูงสุด

1

ชนิดไฟล์ที่รับ

image

Duration token

reference วิดีโอและเสียงควรมี durationToken จาก /api/v1/files เมื่อจำเป็นต้องตรวจ duration

kindขนาดสูงสุดMIME type
image10 MBimage/jpeg, image/png, image/webp

request ขั้นต่ำ

{
  "model": "flux-kontext-max",
  "prompt": "A clean editorial product image on a soft studio background",
  "params": {
    "aspectRatio": "16:9",
    "outputFormat": "jpeg",
    "enableTranslation": "true",
    "promptUpsampling": "false",
    "safetyTolerance": 2,
    "watermark": "ข้อความลายน้ำแบบไม่บังคับ"
  }
}

request แบบไฟล์ reference

{
  "model": "flux-kontext-max",
  "prompt": "A clean editorial product image on a soft studio background",
  "params": {
    "aspectRatio": "16:9",
    "outputFormat": "jpeg",
    "enableTranslation": "true",
    "promptUpsampling": "false",
    "safetyTolerance": 2,
    "watermark": "ข้อความลายน้ำแบบไม่บังคับ",
    "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_flux_kontext_max_example",
  "status": "queued",
  "model": "flux-kontext-max",
  "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

บางโหมดต้องใช้การอัปโหลด reference ผ่าน Files API