Skip to main content
POST
cURL
ソースコンテンツの周囲により広いキャンバスが必要な場合は、このエンドポイントを使用して画像を元の境界の外側までアウトペイントします。

拡張率の仕組み

  • 各比率は元の幅または高さを基準に測定されます
  • 拡張後のキャンバス全体は、Kling のドキュメントに記載された面積制限内に収まる必要があります
  • 大きな拡張を試す前に、まずは各辺で 0.1 のような小さな値から始めてください

リクエストの流れ

  • 4 つの ratio フィールドをすべて送信し、拡張したくない辺には 0 を使用します
  • 返された task_id を保存します
  • タスクが終了状態に達するまで、対応する Kling の画像クエリパスをポーリングします
完全なパラメータリファレンスについては、Kling 公式ドキュメントを参照してください。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI key.

ヘッダー

Content-Type
string
デフォルト:application/json

Must be application/json.

ボディ

application/json
image
string
必須

Source image to expand. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

up_expansion_ratio
number
必須

Upward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

必須範囲: 0 <= x <= 2
down_expansion_ratio
number
必須

Downward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

必須範囲: 0 <= x <= 2
left_expansion_ratio
number
必須

Leftward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

必須範囲: 0 <= x <= 2
right_expansion_ratio
number
必須

Rightward expansion ratio as a multiple of the original image dimension. Range: 0-2. Send 0 for sides you do not want to expand.

必須範囲: 0 <= x <= 2
prompt
string

Optional text prompt to guide the expanded area content. Maximum 2500 characters.

n
integer
デフォルト:1

Number of expanded images to generate. Range: 1-9.

必須範囲: 1 <= x <= 9
watermark_info
object

Watermark options.

callback_url
string

Webhook URL for task status notifications.

external_task_id
string

Optional user-defined task ID for your own tracking. Must be unique per account.

レスポンス

200 - application/json

Task request accepted or an error response returned by the API.

code
必須

Response code. 0 means the task request was accepted.

message
string
必須

Response message.

data
object
必須
request_id
string

Request identifier returned when present.