MiniMax-H3

最后更新:2026-11-14

POSThttps://www.sagelib.com/videos

MiniMax-H3 模型的视频生成接口,OpenAI兼容,支持文生视频、图生视频、全能参考生成等。

接口鉴权方式请参考:API接入与鉴权

请求参数

请求头

参数名称 描述
*Authorization string 鉴权令牌,格式为 Bearer ${AIGATEWAY_TOKEN}
*Content-Type string 可选值:application/json
application/json

Body 参数

参数名称 描述
*model string 可选值:MiniMax-H3
模型名称,固定值
*prompt string 可选值:文本描述,最大 7000 字符
视频文本描述,说明画面、动作、镜头与风格
*seconds integer 可选值:4 ~ 15(整数)
视频时长(秒)
*size string 可选值:768P / 2K
视频分辨率档位
eca_aspect_ratio string 默认值:adaptive
可选值:adaptive / 21:9 / 16:9 / 4:3 / 1:1 / 3:4 / 9:16
视频宽高比,adaptive 表示由输入素材自动选取;仅文本输入时须显式指定且不可为 adaptive
eca_first_frame string 可选值:URL 或 Base64(JPG/JPEG/PNG/WEBP/HEIC/HEIF,≤30MB)
图生视频首帧图片,传入后进入图生视频模式
eca_last_frame string 可选值:URL 或 Base64,格式同首帧
图生视频尾帧图片,控制结尾画面;须与首帧成对提供
eca_image_reference array 可选值:数组,元素形如 {"image": "图片URL或Base64"},最多 9 张
全能参考生成的参考图片,用于参考角色、动作、镜头或风格
eca_video_reference array 可选值:数组,元素形如 {"video": "视频URL或Base64"},最多 3 段,单段 2~15 秒
全能参考生成的参考视频,用于参考动作、镜头与风格
eca_audio_reference array 可选值:数组,元素形如 {"audio": "音频URL或Base64"},最多 3 段,单段 2~15 秒
全能参考生成的参考音频,用于参考音色、声音或节奏

请求示例

curl -X POST 'https://www.sagelib.com/videos' \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -d '{
    "eca_aspect_ratio": "16:9",
    "model": "MiniMax-H3",
    "prompt": "At dusk, an orange tabby slowly rises on a windowsill, gazing at the city skyline under the sunset glow; watercolor style, warm tones, the camera slowly zooms in; delicate, soft, atmospheric.",
    "seconds": 5
  }'
import json
import requests

# Configure base variables
base_url = "https://www.sagelib.com"  # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***"  # Replace with your Bearer token

url = f"https://www.sagelib.com/videos"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json",
}

data = {
    "eca_aspect_ratio": "16:9",
    "model": "MiniMax-H3",
    "prompt": "At dusk, an orange tabby slowly rises on a windowsill, gazing at the city skyline under the sunset glow; watercolor style, warm tones, the camera slowly zooms in; delicate, soft, atmospheric.",
    "seconds": 5
}

# Send the POST request
response = requests.post(url, headers=headers, json=data)

# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
    print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
    print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LlmVideoClient {
    public static void main(String[] args) {
        String baseUrl = "https://www.sagelib.com";
        String apiKey = "***";
        String url = "https://www.sagelib.com/videos";

        String jsonRequestBody = """
            {
              "eca_aspect_ratio": "16:9",
              "model": "MiniMax-H3",
              "prompt": "At dusk, an orange tabby slowly rises on a windowsill, gazing at the city skyline under the sunset glow; watercolor style, warm tones, the camera slowly zooms in; delicate, soft, atmospheric.",
              "seconds": 5
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + apiKey)
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(jsonRequestBody))
                .build();

        try {
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            System.out.println("Status Code: " + response.statusCode());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    baseUrl := "https://www.sagelib.com"
    apiKey := "***"
    url := "https://www.sagelib.com/videos"

    jsonRequestBody := `
{
  "eca_aspect_ratio": "16:9",
  "model": "MiniMax-H3",
  "prompt": "At dusk, an orange tabby slowly rises on a windowsill, gazing at the city skyline under the sunset glow; watercolor style, warm tones, the camera slowly zooms in; delicate, soft, atmospheric.",
  "seconds": 5
}`

    req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonRequestBody))
    if err != nil {
        fmt.Println("Failed to create request:", err)
        return
    }
    req.Header.Set("Authorization", "Bearer "+apiKey)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Request failed:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    // Pretty-print the returned JSON data
    var prettyBody map[string]interface{}
    if err := json.Unmarshal(body, &prettyBody); err == nil {
        pretty, _ := json.MarshalIndent(prettyBody, "", "  ")
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(pretty))
    } else {
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(body))
    }
}
curl -X POST 'https://www.sagelib.com/videos' \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -d '{
    "eca_first_frame": "${image_url}",
    "eca_last_frame": "${image_url}",
    "model": "MiniMax-H3",
    "prompt": "The orange tabby in the image slowly rises from a curled-up position, stretches, walks to the window and finally stops in front of it, gazing at the distant city skyline; watercolor style, warm tones, smooth natural motion.",
    "seconds": 5
  }'
import json
import requests

# Configure base variables
base_url = "https://www.sagelib.com"  # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***"  # Replace with your Bearer token

url = f"https://www.sagelib.com/videos"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json",
}

data = {
    "eca_first_frame": "${image_url}",
    "eca_last_frame": "${image_url}",
    "model": "MiniMax-H3",
    "prompt": "The orange tabby in the image slowly rises from a curled-up position, stretches, walks to the window and finally stops in front of it, gazing at the distant city skyline; watercolor style, warm tones, smooth natural motion.",
    "seconds": 5
}

# Send the POST request
response = requests.post(url, headers=headers, json=data)

# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
    print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
    print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LlmVideoClient {
    public static void main(String[] args) {
        String baseUrl = "https://www.sagelib.com";
        String apiKey = "***";
        String url = "https://www.sagelib.com/videos";

        String jsonRequestBody = """
            {
              "eca_first_frame": "${image_url}",
              "eca_last_frame": "${image_url}",
              "model": "MiniMax-H3",
              "prompt": "The orange tabby in the image slowly rises from a curled-up position, stretches, walks to the window and finally stops in front of it, gazing at the distant city skyline; watercolor style, warm tones, smooth natural motion.",
              "seconds": 5
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + apiKey)
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(jsonRequestBody))
                .build();

        try {
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            System.out.println("Status Code: " + response.statusCode());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    baseUrl := "https://www.sagelib.com"
    apiKey := "***"
    url := "https://www.sagelib.com/videos"

    jsonRequestBody := `
{
  "eca_first_frame": "${image_url}",
  "eca_last_frame": "${image_url}",
  "model": "MiniMax-H3",
  "prompt": "The orange tabby in the image slowly rises from a curled-up position, stretches, walks to the window and finally stops in front of it, gazing at the distant city skyline; watercolor style, warm tones, smooth natural motion.",
  "seconds": 5
}`

    req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonRequestBody))
    if err != nil {
        fmt.Println("Failed to create request:", err)
        return
    }
    req.Header.Set("Authorization", "Bearer "+apiKey)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Request failed:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    // Pretty-print the returned JSON data
    var prettyBody map[string]interface{}
    if err := json.Unmarshal(body, &prettyBody); err == nil {
        pretty, _ := json.MarshalIndent(prettyBody, "", "  ")
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(pretty))
    } else {
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(body))
    }
}
curl -X POST 'https://www.sagelib.com/videos' \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -d '{
    "eca_image_reference": [
      {
        "image": "${image_url}"
      }
    ],
    "model": "MiniMax-H3",
    "prompt": "Referring to the orange tabby and scene in the reference material, generate a video of the tabby moving around on the windowsill, keeping the character appearance, camera language and overall style consistent; watercolor style, warm tones, delicate and soft.",
    "seconds": 5
  }'
import json
import requests

# Configure base variables
base_url = "https://www.sagelib.com"  # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***"  # Replace with your Bearer token

url = f"https://www.sagelib.com/videos"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json",
}

data = {
    "eca_image_reference": [{
        "image": "${image_url}"
    }],
    "model": "MiniMax-H3",
    "prompt": "Referring to the orange tabby and scene in the reference material, generate a video of the tabby moving around on the windowsill, keeping the character appearance, camera language and overall style consistent; watercolor style, warm tones, delicate and soft.",
    "seconds": 5
}

# Send the POST request
response = requests.post(url, headers=headers, json=data)

# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
    print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
    print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LlmVideoClient {
    public static void main(String[] args) {
        String baseUrl = "https://www.sagelib.com";
        String apiKey = "***";
        String url = "https://www.sagelib.com/videos";

        String jsonRequestBody = """
            {
              "eca_image_reference": [
                {
                  "image": "${image_url}"
                }
              ],
              "model": "MiniMax-H3",
              "prompt": "Referring to the orange tabby and scene in the reference material, generate a video of the tabby moving around on the windowsill, keeping the character appearance, camera language and overall style consistent; watercolor style, warm tones, delicate and soft.",
              "seconds": 5
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + apiKey)
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(jsonRequestBody))
                .build();

        try {
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            System.out.println("Status Code: " + response.statusCode());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    baseUrl := "https://www.sagelib.com"
    apiKey := "***"
    url := "https://www.sagelib.com/videos"

    jsonRequestBody := `
{
  "eca_image_reference": [
    {
      "image": "${image_url}"
    }
  ],
  "model": "MiniMax-H3",
  "prompt": "Referring to the orange tabby and scene in the reference material, generate a video of the tabby moving around on the windowsill, keeping the character appearance, camera language and overall style consistent; watercolor style, warm tones, delicate and soft.",
  "seconds": 5
}`

    req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonRequestBody))
    if err != nil {
        fmt.Println("Failed to create request:", err)
        return
    }
    req.Header.Set("Authorization", "Bearer "+apiKey)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Request failed:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    // Pretty-print the returned JSON data
    var prettyBody map[string]interface{}
    if err := json.Unmarshal(body, &prettyBody); err == nil {
        pretty, _ := json.MarshalIndent(prettyBody, "", "  ")
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(pretty))
    } else {
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(body))
    }
}
curl -v 'https://www.sagelib.com/videos/${video_id}' \
  -H "Authorization: Bearer ***"
import json
import requests

# Configure base variables
base_url = "https://www.sagelib.com"  # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***"  # Replace with your Bearer token
video_id = "${video_id}"  # The video task ID returned when creating the task

url = f"https://www.sagelib.com/videos/{video_id}"

headers = {
    "Authorization": f"Bearer {api_key}",
}

# Send the GET request to query the task status
response = requests.get(url, headers=headers)

# Print the status code and the returned JSON data
print(f"Status Code: {response.status_code}")
try:
    print(json.dumps(response.json(), indent=2, ensure_ascii=False))
except Exception:
    print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LlmVideoQuery {
    public static void main(String[] args) {
        String baseUrl = "https://www.sagelib.com";
        String apiKey = "***";
        String videoId = "${video_id}";  // The video task ID returned when creating the task
        String url = "https://www.sagelib.com/videos/" + videoId;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + apiKey)
                .GET()
                .build();

        try {
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
            System.out.println("Status Code: " + response.statusCode());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
package main

import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    baseUrl := "https://www.sagelib.com"
    apiKey := "***"
    videoId := "${video_id}" // The video task ID returned when creating the task
    url := "https://www.sagelib.com/videos/" + videoId

    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        fmt.Println("Failed to create request:", err)
        return
    }
    req.Header.Set("Authorization", "Bearer "+apiKey)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Request failed:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    // Pretty-print the returned JSON data
    var prettyBody map[string]interface{}
    if err := json.Unmarshal(body, &prettyBody); err == nil {
        pretty, _ := json.MarshalIndent(prettyBody, "", "  ")
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(pretty))
    } else {
        fmt.Println("Status Code:", resp.StatusCode)
        fmt.Println(string(body))
    }
}
curl -v 'https://www.sagelib.com/videos/${video_id}/content' \
  -H "Authorization: Bearer ***" \
  -o output.mp4
import requests

# Configure base variables
base_url = "https://www.sagelib.com"  # 把 base_url 换成你的网关地址 https://www.sagelib.com
api_key = "***"  # Replace with your Bearer token
video_id = "${video_id}"  # The video task ID returned when creating the task

url = f"https://www.sagelib.com/videos/{video_id}/content"

headers = {
    "Authorization": f"Bearer {api_key}",
}

# Send the GET request and stream the video content to a local file
response = requests.get(url, headers=headers, stream=True)
response.raise_for_status()

with open("output.mp4", "wb") as f:
    for chunk in response.iter_content(chunk_size=8192):
        f.write(chunk)

print(f"Status Code: {response.status_code}")
print("Video saved to output.mp4")
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

public class LlmVideoDownload {
    public static void main(String[] args) {
        String baseUrl = "https://www.sagelib.com";
        String apiKey = "***";
        String videoId = "${video_id}";  // The video task ID returned when creating the task
        String url = "https://www.sagelib.com/videos/" + videoId + "/content";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + apiKey)
                .GET()
                .build();

        try {
            HttpResponse<InputStream> response = client.send(request, HttpResponse.BodyHandlers.ofInputStream());
            System.out.println("Status Code: " + response.statusCode());
            try (InputStream in = response.body()) {
                Files.copy(in, Path.of("output.mp4"), StandardCopyOption.REPLACE_EXISTING);
                System.out.println("Video saved to output.mp4");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
package main

import (
    "fmt"
    "io"
    "net/http"
    "os"
)

func main() {
    baseUrl := "https://www.sagelib.com"
    apiKey := "***"
    videoId := "${video_id}" // The video task ID returned when creating the task
    url := "https://www.sagelib.com/videos/" + videoId + "/content"

    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        fmt.Println("Failed to create request:", err)
        return
    }
    req.Header.Set("Authorization", "Bearer "+apiKey)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Request failed:", err)
        return
    }
    defer resp.Body.Close()

    fmt.Println("Status Code:", resp.StatusCode)

    out, err := os.Create("output.mp4")
    if err != nil {
        fmt.Println("Failed to create output file:", err)
        return
    }
    defer out.Close()

    _, err = io.Copy(out, resp.Body)
    if err != nil {
        fmt.Println("Failed to save video:", err)
        return
    }
    fmt.Println("Video saved to output.mp4")
}

响应参数

Body 参数

参数名称 描述
id string 视频任务 ID
object string 可选值:video
固定为 video
model string 实际使用的模型名称
status string 可选值:created、in_progress、completed、failed
任务状态:created / in_progress / completed / failed
created_at integer 任务创建时间戳(部分响应回带)
size string 输出分辨率档位(部分响应回带,如 768P)
seconds string 输出时长,字符串形式(部分响应回带,如 "5")
error object 仅 failed 时出现,含 message 与 code
    message string 失败原因
    code string 错误码