|
import requests |
|
import json |
|
import base64 |
|
|
|
url = "https://api.minimaxi.chat/v1/video_generation" |
|
api_key="your api_key" |
|
|
|
|
|
with open(f"your_file_path", "rb") as image_file: |
|
data = base64.b64encode(image_file.read()).decode('utf-8') |
|
|
|
payload = json.dumps({ |
|
"model": "video-01", |
|
"prompt": "On a distant planet, there is a MiniMax.", |
|
"first_frame_image":f"data:image/jpeg;base64,{image_file}" |
|
}) |
|
headers = { |
|
'authorization': f'Bearer {api_key}', |
|
'Content-Type': 'application/json' |
|
} |
|
|
|
response = requests.request("POST", url, headers=headers, data=payload) |
|
|
|
print(response.text) |
|
|