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

การเชื่อมต่อ API ของ Qwen2 Image

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

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

qwen2-image

Input

text, file

Files API

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

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

6

ความสามารถ

รูปภาพ

Billing

FIXED

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

800 อักขระ

contract ของ request

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

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

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

KeyTypeจำเป็นค่าเริ่มต้นช่วงตัวเลือกคำอธิบาย
image_sizeselectไม่ใช่16:9-1:1, 3:4, 4:3, 9:16, 16:9ขนาดรูปภาพ
output_formatselectไม่ใช่png-png, jpegรูปแบบเอาต์พุต
seednumberไม่ใช่-min 0-เว้นว่างไว้เพื่อสร้างผลลัพธ์แบบสุ่มใหม่ทุกครั้ง การใช้เลขจำนวนเต็มเดิมซ้ำจะช่วยให้ทำซ้ำหรือปรับละเอียดจากผลลัพธ์ก่อนหน้าได้ง่ายขึ้น ผลลัพธ์จะใกล้เคียงขึ้นเมื่อพรอมป์และการตั้งค่าหลักอื่นยังคล้ายเดิมเท่านั้น และไม่รับประกันว่าจะตรงกันแบบ 1:1
nsfw_checkerselectไม่ใช่false-false, trueตัวกรองเนื้อหา

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": "qwen2-image",
  "prompt": "A clean editorial product image on a soft studio background",
  "params": {
    "image_size": "16:9",
    "output_format": "png",
    "seed": 0,
    "nsfw_checker": "false"
  }
}

request แบบไฟล์ reference

{
  "model": "qwen2-image",
  "prompt": "A clean editorial product image on a soft studio background",
  "params": {
    "image_size": "16:9",
    "output_format": "png",
    "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_qwen2_image_example",
  "status": "queued",
  "model": "qwen2-image",
  "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