Kling AI icon

Kling AI

Consume Kling AI API

Actions12

Overview

This node integrates with the Kling AI API to perform various AI-powered media generation and retrieval tasks. Specifically, for the Image - List operation, it fetches a paginated list of image generation tasks previously created via the Kling AI service.

Common scenarios where this node is beneficial include:

  • Retrieving a history or catalog of generated images for review or further processing.
  • Implementing pagination to browse through large sets of generated images.
  • Automating workflows that need to monitor or analyze past image generation results.

Practical example:

  • A user wants to display the last 30 generated images in a dashboard. They can use this node to list those images by specifying the page number and size, then process or visualize the returned data accordingly.

Properties

Name Meaning
API Token JWT token for authenticating with the Kling AI API. Must be generated with specified header and payload; do not include "Bearer" prefix.
Additional Options Collection of optional parameters:
• Page Number: The page of results to retrieve (minimum 1).
• Page Size: Number of results per page (1 to 500).

Output

The output JSON contains the response from the Kling AI API endpoint /v1/images/generations, which returns a list of image generation records.

Typical structure includes:

  • An array of image generation entries, each representing a generated image task with details such as IDs, status, timestamps, prompts used, and URLs or metadata about the generated images.
  • Pagination information may also be included depending on the API response.

No binary data output is produced by this operation.

Dependencies

  • Requires an active internet connection to reach https://api.klingai.com.
  • Needs a valid JWT API token for authentication with the Kling AI API.
  • No additional n8n credentials are required beyond the API token input property.
  • The node uses standard HTTP requests with JSON payloads.

Troubleshooting

  • Authentication errors (401): Usually caused by invalid or improperly formatted JWT tokens. Ensure the token is generated correctly according to Kling AI's specifications and does not include the "Bearer" prefix.
  • Empty or no response: Could indicate network issues or API downtime. Verify connectivity and API status.
  • Invalid pagination parameters: Providing page numbers less than 1 or page sizes outside 1-500 range may cause API errors.
  • API error messages: The node surfaces error messages returned by the Kling AI API. Review these messages for clues and adjust parameters accordingly.
  • If the node is set to continue on failure, errors will be returned in the output JSON under an error field instead of stopping execution.

Links and References

Discussion