Проверка статуса
Возвращает состояние задачи по task_id. Опрос возможен только тем
API-ключом, которым задача была создана. Рекомендуемый интервал опроса —
5–10 секунд. Завершающие статусы: completed, rejected, failed.
curl --request POST \
--url https://api.nixai.ru/v1/videos/fetch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}
'import requests
url = "https://api.nixai.ru/v1/videos/fetch"
payload = {
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'wan-3', id: 'b22c9ae2-0b55-4398-88df-0191aae664f0'})
};
fetch('https://api.nixai.ru/v1/videos/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.nixai.ru/v1/videos/fetch';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'wan-3', id: 'b22c9ae2-0b55-4398-88df-0191aae664f0'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixai.ru/v1/videos/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan-3',
'id' => 'b22c9ae2-0b55-4398-88df-0191aae664f0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nixai.ru/v1/videos/fetch"
payload := strings.NewReader("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixai.ru/v1/videos/fetch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixai.ru/v1/videos/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.nixai.ru/v1/videos/fetch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}'import Foundation
let parameters = [
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.nixai.ru/v1/videos/fetch")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/videos/fetch");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/videos/fetch");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'wan-3', id: 'b22c9ae2-0b55-4398-88df-0191aae664f0'})
};
fetch('https://api.nixai.ru/v1/videos/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/videos/fetch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/videos/fetch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}")
val request = Request.Builder()
.url("https://api.nixai.ru/v1/videos/fetch")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falsefalse{
"task_id": "b22c9ae2-0b55-4398-88df-0191aae664f0",
"status": "processing"
}status не станет completed, rejected или failed. Рекомендуемый интервал опроса — 5–10 секунд. Генерация обычно занимает несколько минут; длинные ролики в 1080p могут генерироваться дольше.
Статусы
| Статус | Значение |
|---|---|
processing | Задача выполняется. |
completed | Видео готово, ссылка в video_url. |
rejected | Запрос не прошёл проверку параметров или модерацию. Причина в error и message. Не оплачивается. |
failed | Видео не удалось сгенерировать по внутренней причине, error: "UnknownError". Запрос можно повторить. Не оплачивается. |
output_format: "base64", поле video_url в ответе для завершённой задачи будет содержать строку base64 вместо ссылки.
Ответ: в процессе
{
"task_id": "b22c9ae2-0b55-4398-88df-0191aae664f0",
"status": "processing"
}
Ответ: готово
{
"task_id": "b22c9ae2-0b55-4398-88df-0191aae664f0",
"status": "completed",
"video_url": "https://cdn.nixai.ru/videos/b22c9ae2.mp4"
}
Ответ: отклонено
{
"task_id": "b22c9ae2-0b55-4398-88df-0191aae664f0",
"status": "rejected",
"error": "BadRequest",
"message": "Reference videos plus output duration must not exceed 30s."
}
Ошибки
Ошибки выполнения задачи возвращаются в ответе/v1/videos/fetch в полях error и message.
error | Статус задачи | Причина |
|---|---|---|
BadRequest | rejected | Параметры запроса не прошли проверку. Повтор без исправления запроса завершится той же ошибкой. |
ContentRejected | rejected | Промпт или материалы отклонены модерацией. |
UnknownError | failed | Видео не удалось сгенерировать по внутренней причине. Запрос можно повторить. |
Сообщения BadRequest
message | Что исправить |
|---|---|
Prompt is required. | Передайте непустой prompt. |
Resolution must be one of 480p, 720p, 1080p. | Укажите допустимое значение size. |
Aspect ratio must be one of 16:9, 9:16, 4:3, 3:4, 1:1. | Укажите допустимое значение aspect_ratio или не передавайте его. |
Duration must be an integer. | Передайте duration целым числом. |
Duration must be between 2s and 30s. | Укажите duration от 2 до 30. |
images must be a list of URLs. | Передайте массив строк, а не одну строку. То же для videos и audios. |
Up to 10 reference images are allowed. | Сократите число изображений. Для видео и аудио предел — 5. |
Total duration of reference videos must not exceed 15s. | Сократите суммарную длину входных видео. То же для audios. |
Reference videos plus output duration must not exceed 30s. | Уменьшите duration или длину входных видео. |
Duration of reference video #N could not be read. | Файл №N повреждён или не является медиафайлом. То же для аудио. |
Reference video #N: expected video, got audio. | В videos передан файл без видеодорожки. |
A reference file could not be read. Check that the URL is publicly accessible and points to a media file. | Ссылка недоступна или ведёт не на медиафайл. |
Timed out reading a reference file. Check that the URL is publicly accessible. | Сервер с файлом не ответил вовремя. |
Примеры
Проверка статуса
curl https://api.nixai.ru/v1/videos/fetch \
-H "Authorization: Bearer $NIXAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}'
Python: создание и ожидание результата
import os
import time
import requests
API = "https://api.nixai.ru/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['NIXAI_API_KEY']}"}
task = requests.post(f"{API}/videos/generations", headers=HEADERS, json={
"model": "wan-3",
"prompt": "Котёнок бежит по крыше под луной, неоновые огни города вдали",
"duration": 5,
"size": "720p",
}).json()
task_id = task["task_id"]
while True:
time.sleep(10)
result = requests.post(f"{API}/videos/fetch", headers=HEADERS, json={
"model": "wan-3",
"id": task_id,
}).json()
if result["status"] == "completed":
print(result["video_url"])
break
if result["status"] in ("rejected", "failed"):
raise RuntimeError(f"{result.get('error')}: {result.get('message')}")
Authorizations
Заголовок Authorization: Bearer <ваш API-ключ>.
Body
Модель, использованная при генерации.
wan-3, wan-3-prime "wan-3"
task_id, полученный при создании задачи.
"b22c9ae2-0b55-4398-88df-0191aae664f0"
Если передано base64, поле video_url будет содержать строку base64 вместо ссылки.
base64 Response
Статус задачи
Идентификатор задачи.
"b22c9ae2-0b55-4398-88df-0191aae664f0"
processing — задача выполняется;
completed — видео готово;
rejected — запрос не прошёл проверку или модерацию;
failed — внутренняя ошибка генерации.
processing, completed, rejected, failed URL готового видео или строка base64 при output_format: "base64". Доступно при completed.
"https://cdn.nixai.ru/videos/b22c9ae2.mp4"
Код ошибки при rejected или failed.
BadRequest, ContentRejected, UnknownError "BadRequest"
Описание ошибки при rejected или failed.
"Reference videos plus output duration must not exceed 30s."
Was this page helpful?
curl --request POST \
--url https://api.nixai.ru/v1/videos/fetch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}
'import requests
url = "https://api.nixai.ru/v1/videos/fetch"
payload = {
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'wan-3', id: 'b22c9ae2-0b55-4398-88df-0191aae664f0'})
};
fetch('https://api.nixai.ru/v1/videos/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.nixai.ru/v1/videos/fetch';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'wan-3', id: 'b22c9ae2-0b55-4398-88df-0191aae664f0'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixai.ru/v1/videos/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan-3',
'id' => 'b22c9ae2-0b55-4398-88df-0191aae664f0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nixai.ru/v1/videos/fetch"
payload := strings.NewReader("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixai.ru/v1/videos/fetch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixai.ru/v1/videos/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.nixai.ru/v1/videos/fetch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
}'import Foundation
let parameters = [
"model": "wan-3",
"id": "b22c9ae2-0b55-4398-88df-0191aae664f0"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.nixai.ru/v1/videos/fetch")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/videos/fetch");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/videos/fetch");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'wan-3', id: 'b22c9ae2-0b55-4398-88df-0191aae664f0'})
};
fetch('https://api.nixai.ru/v1/videos/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/videos/fetch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/videos/fetch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"model\": \"wan-3\",\n \"id\": \"b22c9ae2-0b55-4398-88df-0191aae664f0\"\n}")
val request = Request.Builder()
.url("https://api.nixai.ru/v1/videos/fetch")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falsefalse{
"task_id": "b22c9ae2-0b55-4398-88df-0191aae664f0",
"status": "processing"
}