Tích hợp API Flux 2 Flex
Dùng Flux 2 Flex qua Rivya Public API v1 với model id flux-2-flex, input được hỗ trợ, tham số, quy tắc Files API, tín dụng và ví dụ response.
flux-2-flex
text, file
Bắt buộc cho reference modes
14
Hình ảnh
FIXED
5000 ký tự
Hợp đồng yêu cầu
Gửi model id ở top level. Điều khiển riêng của mô hình nằm trong params.
| Key | Type | Bắt buộc | Default | Mô tả |
|---|---|---|---|---|
| model | string | Có | flux-2-flex | Dùng API model id flux-2-flex. |
| prompt | string | Có | - | Tối đa 5000 ký tự cho mô hình này. |
| params | object | Không | - | Object tham số riêng của mô hình. Dùng các dòng bên dưới để xem key được phép. |
| client_request_id | string | Không | - | Client-side id tùy chọn để trace request trong hệ thống của bạn. |
Tham số mô hình
| Key | Type | Bắt buộc | Default | Range | Options | Mô tả |
|---|---|---|---|---|---|---|
| aspectRatio | select | Không | 1:1 | - | 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3 | Tỷ lệ khung hình |
| resolution | select | Không | 1K | - | 1K, 2K | Độ phân giải |
Chính sách tải lên
Upload reference files trước, rồi đặt URL và duration token được trả về vào params.referenceMediaItems.
Ảnh tham chiếu: Tải lên tối đa 8 tệp ảnh cho dự án hình ảnh.
8
image
Tham chiếu video và audio nên mang durationToken từ /api/v1/files khi cần xác minh duration.
| kind | Kích thước tối đa | MIME types |
|---|---|---|
| image | 10 MB | image/jpeg, image/png, image/webp |
Yêu cầu tối thiểu
{
"model": "flux-2-flex",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspectRatio": "1:1",
"resolution": "1K"
}
}Yêu cầu có tệp tham chiếu
{
"model": "flux-2-flex",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspectRatio": "1:1",
"resolution": "1K",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}Phản hồi tạo
Create endpoint trả về public task id. Poll status endpoint cho đến khi task succeeded hoặc failed.
{
"id": "task_flux_2_flex_example",
"status": "queued",
"model": "flux-2-flex",
"reserved_credits": 14,
"final_credits": 0,
"created_at": "2026-05-11T00:00:00.000Z",
"updated_at": "2026-05-11T00:00:00.000Z",
"result": null,
"error": null
}Lỗi thường gặp
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
Một số mode cần Files API reference uploads.