Chỉnh sửa hình ảnh (tương thích với OpenAI Dall-E)
OpenAI API chỉnh sửa hình ảnh định dạng Dall-E.
POST /v1/images/edits: Chỉnh sửa hình ảnh
Header xác thực tiêu chuẩn:
-
Content-Type: application/json -
model: string: Bắt buộc, tên mô hình công khai -
prompt: string: Khuyến nghị, mô tả tạo ảnh -
n: number: Tùy chọn, số lượng ảnh tạo -
size: string: Tùy chọn, biểu thức kích thước hoặc độ phân giải -
quality: string: Tùy chọn, mức chất lượng -
response_format: string: Tùy chọn, định dạng trả về
Các tham số mở rộng tương thích thường dùng:
imageimage_urlimage_urlsimage_listsubject_image_listscene_imagestyle_imagenegative_promptaspect_ratioresolutioncallback_urlexternal_task_id
Kling Tham số mở rộng chuyên dụng:
model_nameelement_listresult_typeseries_amounthuman_imagecloth_imageup_expansion_ratiodown_expansion_ratioleft_expansion_ratioright_expansion_ratio
3.1 Dòng Nano Banana
Mô hình công khai:
nano-banananano-banana-pronano-banana-pro-2knano-banana-pro-4knano-banana-2nano-banana-2-2knano-banana-2-4k
Mô tả khả năng:
nano-banana: Tạo ảnh từ văn bản cơ bản, cũng tương thích với chỉnh sửa ảnhnano-banana-pro*: Phiên bản chất lượng cao hơnnano-banana-2*: Họ phiên bản mới hơn*-2k/*-4k: Mẫu độ phân giải cao
Tham số thường dùng:
- Text-to-image:
model + prompt - Chỉnh sửa ảnh:
model + prompt + image, cũng tương thích vớiimage_urls - Mở rộng thường dùng:
nsizequalityresponse_format
Ví dụ:
{
"model": "nano-banana",
"prompt": "a cute cat running in cloud",
"n": 1,
"size": "1024x1792"
}
{
"model": "nano-banana-pro",
"prompt": "把主体改成赛博朋克夜景",
"image": "https://example.com/input.png",
"n": 1
}
3.2 Dòng Seedream
Mô hình công khai:
doubao-seedream-3-0-t2i-250415doubao-seedream-4-0-250828doubao-seedream-4-5-251128doubao-seedream-5-0-260128
Mô tả khả năng:
- Thống nhất gọi theo cách text-to-image
- Khuyến nghị ưu tiên truyền tham số chuẩn:
prompt + model + size/aspect_ratio
Tham số thường dùng:
model + prompt- Tùy chọn:
sizeaspect_ration
3.3 Kling Mô hình chính ảnh thông thường
Mô hình chính công khai:
kling-image
Bắt buộc:
modelmodel_name
Các model_name được hỗ trợ:
kling-v1kling-v1-5kling-v2kling-v2-newkling-v2-1kling-v3
Mô tả khả năng:
- Text-to-image:
model + model_name + prompt - Image-to-image: thêm
imagetrên cơ sở text-to-image - Multi-image-to-image: truyền
subject_image_list, hoặc truyền nhiềuimage_urls/images - Outpainting: truyền
imagevà tham số tỷ lệ mở rộng ảnh
Tham số thường dùng:
imagesubject_image_listscene_imagestyle_imageaspect_ratioresolutionup_expansion_ratiodown_expansion_ratioleft_expansion_ratioright_expansion_ratio
Ví dụ:
{
"model": "kling-image",
"model_name": "kling-v3",
"prompt": "海边日落,电影感人像",
"aspect_ratio": "16:9",
"n": 1
}
3.4 Kling Mô hình chính ảnh Omni
Mô hình chính công khai:
kling-omni-image
Bắt buộc:
modelmodel_name
Các model_name được hỗ trợ:
kling-image-o1kling-v3-omni
Tham số thường dùng:
image_listelement_listresolutionaspect_ratioresult_typeseries_amount
Ví dụ:
{
"model": "kling-omni-image",
"model_name": "kling-v3-omni",
"prompt": "生成一张海边跳舞的图片",
"element_list": [
{ "element_id": 835266081714884677 }
]
}
3.5 Kling Mô hình thử đồ ảo
Mô hình công khai:
kolors-virtual-try-on-v1kolors-virtual-try-on-v1-5
Tham số đầu vào tối thiểu:
model + human_image + cloth_image
Giải thích:
- Hai mô hình này bản thân đã là mô hình chính hoàn chỉnh, không cần truyền thêm
model_name
Ví dụ:
{
"model": "kolors-virtual-try-on-v1",
"human_image": "https://example.com/human.jpg",
"cloth_image": "https://example.com/cloth.jpg"
}
Định giá cố định cho tạo/chỉnh sửa hình ảnh
Các mô hình sau được tính phí theo từng lần trong POST /v1/images/generations và POST /v1/images/edits:
| Mô hình | Định giá |
|---|---|
kling-image-v3 | 0.05 / lần |
doubao-seedream-5-0-260128 | 0.05 / lần |
doubao-seedream-4-5-251128 | 0.06 / lần |
Ủy quyền
Sử dụng xác thực Bearer Token.
Định dạng: Authorization: Bearer sk-xxxxxx
Nội dung
Tên mô hình hình ảnh công khai.
nano-banana, doubao-seedream-3-0-t2i-250415, kling-image, kling-omni-image, kolors-virtual-try-on-v1, kolors-virtual-try-on-v1-5 "dall-e-2"
Đầu vào một ảnh, thường dùng cho tạo ảnh từ ảnh và mở rộng ảnh.
Mô tả tạo ảnh. Với mô hình thử đồ ảo, có thể không truyền.
Ảnh mặt nạ tùy chọn
Số lượng ảnh được tạo.
Biểu thị kích thước hoặc độ phân giải.
256x256, 512x512, 1024x1024 Định dạng trả về.
url, b64_json 