メインコンテンツへスキップ
POST
/
kling
/
v1
/
images
/
editing
/
expand
Request a Kling image-expansion task
curl --request POST \
  --url https://api.cometapi.com/kling/v1/images/editing/expand \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "image": "https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg",
  "up_expansion_ratio": 0.1,
  "right_expansion_ratio": 0.1,
  "left_expansion_ratio": 0.1,
  "bottom_expansion_ratio": 0.1
}
'
{
  "code": 123,
  "message": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123
  },
  "request_id": "<string>"
}
このエンドポイントは、元の画像の境界の外側へアウトペイントし、元コンテンツの周囲により広いキャンバスが必要な場合に使用します。

拡張比率の仕組み

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

現在のラッパーの状態

  • ドキュメント上のルートは POST /kling/v1/images/editing/expand です
  • 2026-03-13 のライブ検証では、最小限のリクエストに対して {"code": null, "message": "404"} が返されました
  • このエンドポイントはドキュメントには記載されていますが、再確認されるまでは CometAPI ラッパー上では現在利用不可として扱ってください
このルートを本番フローに組み込む前に、現在のラッパーで利用可能か確認してください。
完全なパラメータリファレンスについては、Kling の公式ドキュメントを参照してください。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI key.

ヘッダー

Content-Type
string

Optional content type header.

ボディ

application/json
image
string
デフォルト:https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg
必須

Source image to expand. Accepts an image URL or raw Base64 string (no data: prefix). Supported formats: JPG, JPEG, PNG. Max 10 MB, minimum 300×300 px, aspect ratio between 1:2.5 and 2.5:1.

up_expansion_ratio
number
デフォルト:1
必須

Upward expansion as a multiple of the original image height. Range: 0–2. The resulting image area must not exceed 3× the original.

right_expansion_ratio
number
デフォルト:1
必須

Rightward expansion as a multiple of the original image width. Range: 0–2. The resulting image area must not exceed 3× the original.

left_expansion_ratio
number
デフォルト:1
必須

Leftward expansion as a multiple of the original image width. Range: 0–2. The resulting image area must not exceed 3× the original.

bottom_expansion_ratio
number
デフォルト:1
必須

Downward expansion as a multiple of the original image height. Range: 0–2. The resulting image area must not exceed 3× the original.

prompt
string

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

n
string

Number of expanded images to generate.

callback_url
string

Webhook URL for task status notifications. The server sends a callback when the task status changes.

external_task_id
string

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

レスポンス

Task accepted when the wrapper route is available.

code
integer
必須

Error code; specifically define the error code

message
string
必須

error message

data
object
必須
request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues