Cog videoX Image To Video
CogVideoX image-to-video is a cutting-edge AI model that converts static images into dynamic, high-quality videos. Perfect for content creation, animation, and education, it offers high-resolution output, efficient inference, and versatile precision. Transform your images into engaging videos with CogVideoX
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/cog-video-5b-i2v"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/cog_vid_i2v_ip.png",
12    "negative_prompt": "The video is not of a high quality, it has a low resolution. Watermark present in each frame. Strange motion trajectory.",
13    "prompt": "Animate this serene lakeside night scene with a flickering campfire, gentle water ripples, and subtle movements from the three people sitting around the campfire under the full moon.",
14    "seed": 42
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20    result = response.json()
21    print(json.dumps(result, indent=2))
22else:
23    print(f"Error: {response.status_code}")
24    print(response.text) 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/cog-video-5b-i2v"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/cog_vid_i2v_ip.png",
12    "negative_prompt": "The video is not of a high quality, it has a low resolution. Watermark present in each frame. Strange motion trajectory.",
13    "prompt": "Animate this serene lakeside night scene with a flickering campfire, gentle water ripples, and subtle movements from the three people sitting around the campfire under the full moon.",
14    "seed": 42
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20    result = response.json()
21    print(json.dumps(result, indent=2))
22else:
23    print(f"Error: {response.status_code}")
24    print(response.text)API Endpoint
https://api.segmind.com/v1/cog-video-5b-i2vParameters
imagerequiredstring (uri)Input Image
"https://segmind-sd-models.s3.amazonaws.com/display_images/cog_vid_i2v_ip.png"promptrequiredstringText prompt for generating the video
"Animate this serene lakeside night scene with a flickering campfire, gentle water ripples, and subtle movements from the three people sitting around the campfire under the full moon."negative_promptoptionalstringText to describe what should be avoided in the generated video
"The video is not of a high quality, it has a low resolution. Watermark present in each frame. Strange motion trajectory."seedoptionalintegerSeed for random number generation to ensure reproducibility
42Response Type
Returns: Video
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out