Transform Images into Captivating Videos with zsxkib/wan-squish Cognitive Actions

22 Apr 2025
Transform Images into Captivating Videos with zsxkib/wan-squish Cognitive Actions

Integrating powerful video generation capabilities into your applications has never been easier with the zsxkib/wan-squish Cognitive Actions. This set of actions allows developers to create stunning videos by transforming images based on detailed prompts. By leveraging these pre-built actions, you can enhance user experiences and unlock creative possibilities, whether for marketing, entertainment, or educational purposes.

Prerequisites

Before you dive into integrating the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform.
  • Basic knowledge of making HTTP requests and handling JSON data.
  • Familiarity with Python programming (for the conceptual examples provided).

To authenticate your requests, you will typically pass your API key in the headers of your HTTP requests, ensuring secure access to the Cognitive Actions.

Cognitive Actions Overview

Generate Video from Image and Prompt

  • Description: This action allows you to generate a video by transforming an initial image using a detailed prompt. You can specify various parameters such as frame count, resolution, and speed settings to customize your video output.
  • Category: Video Generation

Input

The input for this action consists of several fields, with the prompt being mandatory. Below is the schema:

  • image (string, required): URI of the image to start the video generation.
    Example: https://replicate.delivery/pbxt/Mh3wselQD9qkHDtiibSZKUyFBMXNujyCwYMRFFkgY3DcOyx5/Screenshot%202025-03-19%20at%2011.24.14.png
  • prompt (string, required): A detailed textual prompt guiding the video creation.
    Example: "SQUISH-IT Cute golden retriever puppy sitting in grass with flowers..."
  • frameCount (integer, optional): Number of frames to generate (default is 81).
    Example: 81
  • guideScale (number, optional): Affects how closely the video adheres to the prompt (default is 5).
    Example: 5
  • generationSpeed (string, optional): Adjusts the speed of generation (default is "Balanced").
    Example: "Balanced"
  • generationSteps (integer, optional): Number of steps for generation (default is 30).
    Example: 30
  • videoResolution (string, optional): Determines the output resolution (default is "480p").
    Example: "480p"
  • undesiredContent (string, optional): Elements to avoid in the video.
    Example: ""
  • videoAspectRatio (string, optional): Aspect ratio of the video (default is "16:9").
    Example: "16:9"
  • clipModelStrength (number, optional): Strength of the LORA effect on the CLIP model (default is 1).
    Example: 1
  • modelLoraStrength (number, optional): Strength of the LORA effect on the main model (default is 1).
    Example: 1
  • samplingShiftFactor (number, optional): Shift factor in sampling (default is 8).
    Example: 8
Example Input
{
  "image": "https://replicate.delivery/pbxt/Mh3wselQD9qkHDtiibSZKUyFBMXNujyCwYMRFFkgY3DcOyx5/Screenshot%202025-03-19%20at%2011.24.14.png",
  "prompt": "SQUISH-IT Cute golden retriever puppy sitting in grass with flowers...",
  "frameCount": 81,
  "guideScale": 5,
  "generationSpeed": "Balanced",
  "generationSteps": 30,
  "videoResolution": "480p",
  "undesiredContent": "",
  "videoAspectRatio": "16:9",
  "clipModelStrength": 1,
  "modelLoraStrength": 1,
  "samplingShiftFactor": 8
}

Output

The action typically returns a URL to the generated video:

[
  "https://assets.cognitiveactions.com/invocations/df52eb48-a65d-4243-ae82-5df5c8ab7883/26752795-a3c1-48f5-a06b-c3b83a6c1624.mp4"
]
Conceptual Usage Example (Python)

Here’s how you might call this action in Python:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint

action_id = "1f09b2f1-e1cd-4318-912e-f4714cd2f9ea" # Action ID for Generate Video from Image and Prompt

# Construct the input payload based on the action's requirements
payload = {
    "image": "https://replicate.delivery/pbxt/Mh3wselQD9qkHDtiibSZKUyFBMXNujyCwYMRFFkgY3DcOyx5/Screenshot%202025-03-19%20at%2011.24.14.png",
    "prompt": "SQUISH-IT Cute golden retriever puppy sitting in grass with flowers...",
    "frameCount": 81,
    "guideScale": 5,
    "generationSpeed": "Balanced",
    "generationSteps": 30,
    "videoResolution": "480p",
    "undesiredContent": "",
    "videoAspectRatio": "16:9",
    "clipModelStrength": 1,
    "modelLoraStrength": 1,
    "samplingShiftFactor": 8
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload} # Hypothetical structure
    )
    response.raise_for_status() # Raise an exception for bad status codes

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is set to the one specified for generating videos. The input payload is constructed according to the defined schema.

Conclusion

The zsxkib/wan-squish Cognitive Action for generating videos from images and prompts offers a powerful way to create engaging content. By understanding the input parameters and how to integrate them into your applications, you can harness this technology to enhance user interaction and creativity. Consider exploring various use cases—from marketing videos to educational content—to fully utilize the capabilities of this action. Happy coding!