跳轉到主要內容
POST
cURL
使用此端點透過 CometAPI 建立非同步 Kling Omni Image 任務。建立請求會傳回 task_id;請使用 取得 Kling Omni 圖像任務 輪詢任務,直到產生的圖像 URL 可用為止。
如需完整的供應商參數參考資料,請參閱 Kling Image O1 文件.

選擇請求格式

  • 單張圖像生成:傳送 prompt、image_list、resolution、result_type: single、n 和 aspect_ratio
  • 浮水印輸出:需要在查詢回應中取得含浮水印的結果 URL 時,加入 watermark_info.enabled: true
  • 模型 ID:省略 model_name 以使用路由預設值,或傳送已測試的 Omni Image 模型 ID,例如 kling-image-o1 或 kling-v3-omni
參考圖像使用包含 image_list 欄位的 image 項目。Prompt 可以透過索引引用它們,例如第一個項目使用 <<<image_1>>>,第二個項目使用 <<<image_2>>>。

任務流程

1

建立任務

提交 POST /kling/v1/images/omni-image,並儲存傳回的 data.task_id。
2

查詢任務

輪詢 GET /kling/v1/images/omni-image/ 直到 data.task_status 為 succeed 或 failed 為止。
3

保存圖像

任務成功時,如需持久存取,請將 data.task_result.images[].url 複製到您自己的儲存空間。
如需完整的回應結構描述與任務狀態詳細資料,請參閱 取得 Kling Omni 圖像任務。以下請求會查詢一個任務一次:

結果欄位

成功的查詢回應會在 data.task_result.images 下傳回產生的圖像。每個項目可包含: 生成的資產 URL 可能會過期或由供應商服務清除。當您的工作流程需要長期保留時,請將完成的圖像儲存在您自己的儲存層。

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI API key.

標頭

Content-Type
string

Must be application/json.

主體

application/json
prompt
string
必填

Text prompt for the generated image. The prompt can reference images with <<<image_1>>>, <<<image_2>>>, and matching indexes from image_list. Maximum length is 2,500 characters.

model_name
string

Optional model ID for this Omni Image request. Omit this field to use the route default.

image_list
object[]

Reference images that the prompt can cite with <<<image_1>>>, <<<image_2>>>, and so on. Keep the total number of reference images within the provider limits for the selected model.

resolution
enum<string>
預設值:1k

Requested output resolution. Use 1k, 2k, or 4k; omitted requests use 1k.

可用選項:
1k,
2k,
4k
result_type
enum<string>
預設值:single

Use single for a single-image task.

可用選項:
single
n
integer
預設值:1

Number of single-image results to generate. Range: 1 to 9.

必填範圍: 1 <= x <= 9
aspect_ratio
enum<string>
預設值:auto

Requested output aspect ratio in width:height format. Use auto to let the provider choose from the prompt and references.

可用選項:
16:9,
9:16,
1:1,
4:3,
3:4,
3:2,
2:3,
21:9,
auto
watermark_info
object

Watermark options. When enabled is true, the task can return watermarked result URLs in addition to the original result URLs.

callback_url
string<uri>

Webhook URL that receives task status notifications when the task status changes. Omit this field to poll manually.

external_task_id
string

User-defined task ID for your own tracking. It does not replace the system-generated task_id and must be unique per account.

回應

200 - application/json

Task accepted.

code
integer
必填

Response code. 0 means the task request was accepted.

message
string
必填

Response message.

data
object
必填
request_id
string

Request identifier returned by CometAPI when present.

最後修改於 2026年7月31日