File size: 596 Bytes
bb403ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import requests
import json
import base64

url = "https://api.minimaxi.chat/v1/video_generation"
api_key="your api_key"

#base64
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)