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

~355.73s
~$0.356
 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

POSThttps://api.segmind.com/v1/cog-video-5b-i2v

Parameters

imagerequired
string (uri)

Input Image

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/cog_vid_i2v_ip.png"
promptrequired
string

Text prompt for generating the video

Default: "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_promptoptional
string

Text to describe what should be avoided in the generated video

Default: "The video is not of a high quality, it has a low resolution. Watermark present in each frame. Strange motion trajectory."
seedoptional
integer

Seed for random number generation to ensure reproducibility

Default: 42

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out