Naar hoofdinhoud gaan
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>"
}
Gebruik dit endpoint om een afbeelding buiten de oorspronkelijke randen uit te breiden wanneer je meer canvas rond de broninhoud nodig hebt.

Hoe de uitbreidingsverhoudingen werken

  • Elke verhouding wordt gemeten ten opzichte van de oorspronkelijke breedte of hoogte
  • Het gecombineerde uitgebreide canvas moet nog steeds binnen de gedocumenteerde oppervlaktegrenzen van Kling blijven
  • Begin met kleine waarden zoals 0.1 aan elke kant voordat je grotere uitbreidingen probeert

Huidige status van de wrapper

  • De gedocumenteerde route is POST /kling/v1/images/editing/expand
  • Live validatie op 2026-03-13 gaf {"code": null, "message": "404"} terug voor een minimaal verzoek
  • Behandel dit endpoint als gedocumenteerd maar momenteel niet beschikbaar op de CometAPI-wrapper totdat dit opnieuw is geverifieerd
Controleer de huidige beschikbaarheid van de wrapper voordat je deze route in productieflows integreert.
Raadpleeg voor de volledige parameterreferentie de officiële Kling-documentatie.

Autorisaties

Authorization
string
header
vereist

Bearer token authentication. Use your CometAPI key.

Headers

Content-Type
string

Optional content type header.

Body

application/json
image
string
standaard:https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg
vereist

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
standaard:1
vereist

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
standaard:1
vereist

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
standaard:1
vereist

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
standaard:1
vereist

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.

Respons

Task accepted when the wrapper route is available.

code
integer
vereist

Error code; specifically define the error code

message
string
vereist

error message

data
object
vereist
request_id
string

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