取消或删除视频生成任务
curl --request DELETE \
--url https://api.minimaxi.com/v2/video_generation/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.minimaxi.com/v2/video_generation/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.minimaxi.com/v2/video_generation/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.minimaxi.com/v2/video_generation/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.minimaxi.com/v2/video_generation/{task_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.minimaxi.com/v2/video_generation/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimaxi.com/v2/video_generation/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"task_id": "424010985738629",
"action": "cancel",
"status": "cancelled"
}{
"type": "error",
"error": {
"type": "bad_request_error",
"message": "invalid params (2013)",
"http_code": "400"
},
"request_id": "021785229015510a2c883cf675b9804d"
}{
"type": "error",
"error": {
"type": "authorized_error",
"message": "login fail: Please carry the API secret key in the 'Authorization' field of the request header (1004)",
"http_code": "401"
},
"request_id": "021785229015510a2c883cf675b9804d"
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "rate limit, please retry later (1002)",
"http_code": "429"
},
"request_id": "021785229015510a2c883cf675b9804d"
}{
"type": "error",
"error": {
"type": "server_error",
"message": "internal error (1000)",
"http_code": "500"
},
"request_id": "021785229015510a2c883cf675b9804d"
}MiniMax-H3
取消或删除视频生成任务
按任务状态取消(queued)或删除(终态)视频生成任务。
DELETE
/
v2
/
video_generation
/
{task_id}
取消或删除视频生成任务
curl --request DELETE \
--url https://api.minimaxi.com/v2/video_generation/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.minimaxi.com/v2/video_generation/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.minimaxi.com/v2/video_generation/{task_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.minimaxi.com/v2/video_generation/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.minimaxi.com/v2/video_generation/{task_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.minimaxi.com/v2/video_generation/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimaxi.com/v2/video_generation/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"task_id": "424010985738629",
"action": "cancel",
"status": "cancelled"
}{
"type": "error",
"error": {
"type": "bad_request_error",
"message": "invalid params (2013)",
"http_code": "400"
},
"request_id": "021785229015510a2c883cf675b9804d"
}{
"type": "error",
"error": {
"type": "authorized_error",
"message": "login fail: Please carry the API secret key in the 'Authorization' field of the request header (1004)",
"http_code": "401"
},
"request_id": "021785229015510a2c883cf675b9804d"
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "rate limit, please retry later (1002)",
"http_code": "429"
},
"request_id": "021785229015510a2c883cf675b9804d"
}{
"type": "error",
"error": {
"type": "server_error",
"message": "internal error (1000)",
"http_code": "500"
},
"request_id": "021785229015510a2c883cf675b9804d"
}本接口会根据任务的当前状态自动执行取消或删除,行为如下:
| 任务状态 | 执行操作(action) | 说明 |
|---|---|---|
queued(排队中) | cancel | 取消任务,任务尚未开始生成,无扣费 |
succeeded(成功) | delete | 删除任务记录 |
failed(失败) | delete | 删除任务记录 |
expired(超时) | delete | 删除任务记录 |
running(运行中) | — | 不可操作,返回错误(生成中无法取消) |
cancelled(已取消) | — | 不可操作,返回错误 |
授权
路径参数
要取消或删除的视频生成任务 ID。
此页面对您有帮助吗?
⌘I