Skip to navigation

Generate a video with Kling 4.0

Generate a video from a text prompt with Kling 4.0, at up to 1080p and 30 seconds. Every other input is optional and they combine freely:

  • Frames: up to 10 frames in timeline order. The first opens the video, the last of two or more closes it, and the video passes through the rest in between.
  • References: up to 10 reference_images and 5 reference videos the prompt refers to as [Image1], [Video1], and so on.

Upload images using multipart/form-data, or pass stored assets by identifier. Returns a generation_id; poll GET /v2/generations/{generation_id} or supply a webhook_url.

Authentication

Api-Keystring

API key for access control. Use in the header with the name “Api-Key”

Query parameters

dry_runbooleanOptionalDefaults to false

When true, the request is validated and priced but not run: nothing is generated, stored, or billed, and no safety review is performed. The response is a PriceQuote object instead of the usual response for this endpoint. Send exactly the request you would send to generate, so the quote reflects the same options.

Request

A request to generate a video with Kling 4.0. Upload images using multipart/form-data.

promptstringRequired1-11000 characters

A natural-language prompt describing the video to generate. Refer to references by position, as in “[Image1] walks toward the camera”.

framesfilesOptional
Images for the video to pass through, in timeline order, in a common format such as JPEG, PNG, or WEBP, up to 50MB each. The first opens the video and, with two or more, the last closes it. Multipart requests only. Uploaded images are used for this request only and are not stored.
reference_imagesfilesOptional
Reference images, in prompt order. Common formats such as JPEG, PNG, and WEBP are supported, up to 50MB each. Multipart requests only. Uploaded images are used for this request only and are not stored.
aspect_ratioenumOptional
The aspect ratio of the generated video. Defaults to the ratio nearest the first frame's shape, or 16x9 without a first frame.
Allowed values:
resolutionenumOptionalDefaults to 1080p
The resolution tier of the generated video.
Allowed values:
durationintegerOptional3-30Defaults to 10
The length of the generated video in seconds.
webhook_urlstringOptionalformat: "uri"<=2048 characters

HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a JSON POST to this URL once all images for the request have finished generating. The body mirrors the synchronous generate response: request_id, created, and a data array containing every generated image (url, prompt, resolution, seed, is_image_safe). Each delivery is signed with Ed25519 and verifiable against the public keys at https://api.ideogram.ai/v1/.well-known/jwks.json. Must be HTTPS; private and loopback hosts and the cloud metadata service are rejected.

Response

An acknowledgement to poll with GET /v2/generations/{generation_id}.

generation_idstring

The generation ID to poll with GET /v2/generations/{generation_id}.

createddatetime
The time the request was accepted.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error