Kling AI icon

Kling AI

Consume Kling AI API

Actions12

Overview

This node integrates with the Kling AI API to generate images based on textual prompts and optional reference images. It supports creating multiple images at once, specifying the model version, aspect ratio, and additional options such as negative prompts and callback URLs for asynchronous processing.

Common scenarios include:

  • Generating creative or concept art images from descriptive text.
  • Producing character or scene visuals using reference images to guide style or features.
  • Automating image generation workflows where multiple variations are needed.

Practical example:

  • A user inputs a prompt describing a futuristic cityscape and selects the "Kling V1.5" model with an aspect ratio of 16:9 to generate three images. Optionally, they provide a reference image of a character to influence the output style.

Properties

Name Meaning
API Token JWT token for authenticating with the Kling AI API. Must be generated with specific header and payload claims and should not include the "Bearer" prefix.
Model The image generation model to use. Options: "Kling V1", "Kling V1.5".
Prompt Text prompt describing what images to generate.
Negative Prompt Text describing elements to avoid in the generated images. Optional.
Number of Images How many images to generate in one request (1 to 9).
Aspect Ratio Desired aspect ratio of the generated images. Options: "16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9".
Additional Options Collection of optional parameters:
- Reference Image URL or Base64-encoded image used as a reference to influence generation. Required to specify Image Reference Type when using "Kling V1.5" model.
- Image Reference Type Type of reference image: "Subject (Character Feature Reference)" or "Face (Character Appearance Reference)". For face reference, the image must contain only one face.
- Image Fidelity Numeric value (0 to 1) indicating how strongly the reference image influences the generation.
- Callback URL URL to be called by the API when image generation is complete, enabling asynchronous notification.

Output

The node outputs JSON data containing the response from the Kling AI API for each input item processed. This typically includes details about the generated images such as URLs or IDs referencing the created images.

If the API supports asynchronous processing via callback URLs, the initial response may contain task identifiers rather than immediate image data.

No binary data output is directly handled by this node; image data is referenced via URLs or similar metadata in the JSON output.

Dependencies

  • Requires access to the Kling AI API endpoint at https://api.klingai.com.
  • An API authentication token in JWT format is mandatory for all requests.
  • Network connectivity to the Kling AI service.
  • Properly formatted input parameters according to the API specification.

Troubleshooting

  • Authentication errors: If the node throws an error indicating authentication failure, verify that the JWT token is correctly generated without the "Bearer" prefix and contains valid claims (iss, exp, nbf).
  • Missing or invalid reference image type: When using a reference image with the "Kling V1.5" model, ensure the "Image Reference Type" is specified. Omitting it may cause errors.
  • API response errors: The node surfaces API error messages. Check the message for clues such as invalid parameters or rate limits.
  • Empty responses: If no data is returned, confirm network connectivity and API availability.
  • Warning about image reference type set without reference image: This may lead to errors; either provide a reference image or clear the reference type setting.

Links and References

  • Kling AI API Documentation (Assumed URL, replace with actual if available)
  • JWT Token Generation Guidelines (refer to standard JWT libraries and Kling AI API requirements)

Discussion