Перейти до основного вмісту
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>"
}

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Використовуйте цей endpoint, щоб виконати outpainting зображення за межі його початкових країв, коли вам потрібно більше полотна навколо вихідного вмісту.

Як працюють коефіцієнти розширення

  • Кожен коефіцієнт вимірюється відносно початкової ширини або висоти
  • Сукупне розширене полотно все одно має залишатися в межах задокументованих Kling обмежень площі
  • Починайте з невеликих значень, таких як 0.1 з кожного боку, перш ніж намагатися виконати більше розширення

Поточна доступність

  • Задокументований маршрут — POST /kling/v1/images/editing/expand
  • Цей endpoint повертає відповідь 404
Перевірте доступність, перш ніж інтегрувати цей маршрут у production-процеси.
Повний довідник параметрів дивіться в офіційній документації 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 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