Create Dynamic Videos with the zsxkib/wan-squish-1000steps Cognitive Actions

In the world of video content creation, generating engaging and unique videos from images has become a sought-after capability. The zsxkib/wan-squish-1000steps Cognitive Actions provide developers with powerful tools to generate videos based on textual prompts and starting images. By leveraging these pre-built actions, you can create customized video clips that are tailored to your specific needs, enhancing the user experience in your applications.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure you have the following ready:
- An API key for accessing the Cognitive Actions platform.
- Basic knowledge of JSON and familiarity with making HTTP requests.
Authentication typically involves passing your API key in the request headers, allowing you to securely access the service.
Cognitive Actions Overview
Generate Video from Image and Prompt
Description: This action allows you to create a video by starting with a provided image and using a descriptive text prompt to guide the video generation. You can customize various parameters such as video frames, resolution, aspect ratio, and speed quality balance to produce a video clip ranging from 1 to 5 seconds. Additionally, you have the option to exclude unwanted elements with a negative prompt.
Category: Video Generation
Input
The input for this action is structured as follows:
- prompt (required): A text prompt guiding the video generation.
- image (optional): A URI pointing to the starting image for the video.
- frames (optional): Number of frames to generate (default is 81).
- fastMode (optional): Speed of generation (default is "Balanced").
- resolution (optional): Video resolution (default is "480p").
- aspectRatio (optional): Aspect ratio of the video (default is "16:9").
- sampleShift (optional): Sample shift factor (default is 8).
- sampleSteps (optional): Steps for video generation (default is 30).
- negativePrompt (optional): Defines elements to be excluded from the video.
- loraClipStrength (optional): Intensity of LoRA's impact (default is 1).
- sampleGuideScale (optional): Controls guide scale (default is 5).
- loraModelStrength (optional): Strength of LoRA applied (default is 1).
- customWeights (optional): Custom LoRA weights for video generation.
Example Input:
{
"image": "https://replicate.delivery/pbxt/MgdQczBaRzH9j7EPPCr8LR56ctlvkmdXIf1GBxGPeErPGjHA/Screenshot%202025-03-19%20at%2011.24.14.png",
"frames": 81,
"prompt": "SQUISH-IT Cute golden retriever puppy sitting in grass with flowers. Human hands enter the frame and gently begin to squish and mold the puppy like soft dough. The puppy's fluffy fur and form gradually transform into a malleable clay-like substance as the hands shape it. The final shot shows the reshaped puppy-dough creation sitting on the grass surrounded by flowers.",
"fastMode": "Balanced",
"resolution": "480p",
"aspectRatio": "16:9",
"sampleShift": 8,
"sampleSteps": 30,
"negativePrompt": "",
"loraClipStrength": 1,
"sampleGuideScale": 5,
"loraModelStrength": 0.8
}
Output
The output of this action is a link to the generated video, typically in MP4 format.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/89e0f3be-ad3c-43a4-b25e-2c61a7e73cd5/41ba0bd1-4df6-4315-8be6-f9e9061f3330.mp4"
]
Conceptual Usage Example (Python)
Here’s a conceptual Python code snippet to demonstrate how to call this action:
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 = "91037e79-dbcb-4b1d-980c-38c5c49de136" # 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/MgdQczBaRzH9j7EPPCr8LR56ctlvkmdXIf1GBxGPeErPGjHA/Screenshot%202025-03-19%20at%2011.24.14.png",
"frames": 81,
"prompt": "SQUISH-IT Cute golden retriever puppy sitting in grass with flowers. Human hands enter the frame and gently begin to squish and mold the puppy like soft dough. The puppy's fluffy fur and form gradually transform into a malleable clay-like substance as the hands shape it. The final shot shows the reshaped puppy-dough creation sitting on the grass surrounded by flowers.",
"fastMode": "Balanced",
"resolution": "480p",
"aspectRatio": "16:9",
"sampleShift": 8,
"sampleSteps": 30,
"negativePrompt": "",
"loraClipStrength": 1,
"sampleGuideScale": 5,
"loraModelStrength": 0.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 (4xx or 5xx)
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 example, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable contains the necessary input structured as per the action's requirements. The code handles errors gracefully, providing useful feedback for troubleshooting.
Conclusion
The zsxkib/wan-squish-1000steps Cognitive Actions offer a robust solution for developers looking to integrate dynamic video generation capabilities into their applications. By utilizing the "Generate Video from Image and Prompt" action, you can create engaging video content in just a few lines of code. Explore the potential use cases, from creative storytelling to marketing campaigns, and unlock new opportunities in video content creation.