AI梦姬import requests
import json
url = "https://api.minimax.chat/v1/video_generation"
api_key="请填写您的api_key"
your_file_path = "" # 在此填写图片文件路径
#base64编码形式输入
with open(your_file_path, "rb") as image_file:
data = base64.b64encode(image_file.read()).decode('utf-8')
payload = json.dumps({
"model": "I2V-01-Director",
"prompt": "男子拿起一本书[上升],然后阅读[固定]。",
"first_frame_image": f"data:image/jpeg;base64,{data}"
})
headers = {
'authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
内容由AI生成