Генерация видео
Создаёт задачу генерации видео.
Возвращает task_id, по которому затем нужно опросить
/v1/videos/fetch.
curl --request POST \
--url https://api.nixai.ru/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
}
'import requests
url = "https://api.nixai.ru/v1/videos/generations"
payload = {
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
}
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: 'wan2.7',
type: 't2v',
prompt: 'Красивый закат над морем',
duration: 5,
size: '1080p',
aspect_ratio: '16:9',
media: [
{type: 'first_frame', url: 'https://example.com/frame.png'},
{type: 'driving_audio', url: 'https://example.com/audio.mp3'}
]
})
};
fetch('https://api.nixai.ru/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.nixai.ru/v1/videos/generations';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'wan2.7',
type: 't2v',
prompt: 'Красивый закат над морем',
duration: 5,
size: '1080p',
aspect_ratio: '16:9',
media: [
{type: 'first_frame', url: 'https://example.com/frame.png'},
{type: 'driving_audio', url: 'https://example.com/audio.mp3'}
]
})
};
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/generations",
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' => 'wan2.7',
'type' => 't2v',
'prompt' => 'Красивый закат над морем',
'duration' => 5,
'size' => '1080p',
'aspect_ratio' => '16:9',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://example.com/frame.png'
],
[
'type' => 'driving_audio',
'url' => 'https://example.com/audio.mp3'
]
]
]),
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/generations"
payload := strings.NewReader("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixai.ru/v1/videos/generations")
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\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
}'import Foundation
let parameters = [
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
[
"type": "first_frame",
"url": "https://example.com/frame.png"
],
[
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
]
]
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.nixai.ru/v1/videos/generations")!
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/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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: 'wan2.7',
type: 't2v',
prompt: 'Красивый закат над морем',
duration: 5,
size: '1080p',
aspect_ratio: '16:9',
media: [
{type: 'first_frame', url: 'https://example.com/frame.png'},
{type: 'driving_audio', url: 'https://example.com/audio.mp3'}
]
})
};
fetch('https://api.nixai.ru/v1/videos/generations', 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/generations");
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\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations");
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\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\n}")
val request = Request.Builder()
.url("https://api.nixai.ru/v1/videos/generations")
.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"
}Authorizations
Заголовок авторизации вида Bearer <token>, где <token> — ваш API-ключ.
Body
Идентификатор видео-модели.
wan2.7 "wan2.7"
Тип генерации. Обязательный параметр.
t2v— из текстаi2v— из изображенияr2v— по референсуvideo-edit— редактирование видео
t2v, i2v, r2v, video-edit "t2v"
Текстовое описание желаемого видео.
"Красивый закат над морем"
Длительность видео в секундах. По умолчанию 5.
- Если в
mediaпередано видео — допустимы целые значения от2до10. - Если видео не передано — допустимы целые значения от
2до15.
2 <= x <= 155
Разрешение итогового видео. Поддерживаются 720p и 1080p.
720p, 1080p "1080p"
Соотношение сторон видео. По умолчанию выбирается автоматически наиболее подходящее.
16:9, 9:16, 4:3, 3:4, 1:1 "16:9"
Список объектов с исходными материалами для генерации.
Состав зависит от type запроса.
t2v — не используется, передавайте пустой список.
i2v — допустимы следующие наборы объектов:
По первому кадру:
first_frame— первый кадрfirst_frame+driving_audio— первый кадр + звук
Первый и последний кадр:
first_frame+last_frame— первый и последний кадрfirst_frame+last_frame+driving_audio— первый и последний кадр + звук
Продолжение видео:
first_clip— продолжение первого видеоfirst_clip+last_frame— первый фрагмент видео + продолжение в последнем кадре
r2v — по референсу, допустимы объекты:
reference_image— референс-изображениеreference_video— референс-видео
video-edit — редактирование видео:
video— обязательно, видео для редактированияreference_image— необязательно, изображение-образец
Ограничения: в видео должен быть только один человек; можно передать максимум 4 референс-изображения; длительность видео — 2–10 секунд.
Show child attributes
Show child attributes
[
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
Response
Задача создана
Идентификатор задачи для последующего опроса через fetch.
"b22c9ae2-0b55-4398-88df-0191aae664f0"
Was this page helpful?
curl --request POST \
--url https://api.nixai.ru/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
}
'import requests
url = "https://api.nixai.ru/v1/videos/generations"
payload = {
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
}
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: 'wan2.7',
type: 't2v',
prompt: 'Красивый закат над морем',
duration: 5,
size: '1080p',
aspect_ratio: '16:9',
media: [
{type: 'first_frame', url: 'https://example.com/frame.png'},
{type: 'driving_audio', url: 'https://example.com/audio.mp3'}
]
})
};
fetch('https://api.nixai.ru/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.nixai.ru/v1/videos/generations';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'wan2.7',
type: 't2v',
prompt: 'Красивый закат над морем',
duration: 5,
size: '1080p',
aspect_ratio: '16:9',
media: [
{type: 'first_frame', url: 'https://example.com/frame.png'},
{type: 'driving_audio', url: 'https://example.com/audio.mp3'}
]
})
};
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/generations",
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' => 'wan2.7',
'type' => 't2v',
'prompt' => 'Красивый закат над морем',
'duration' => 5,
'size' => '1080p',
'aspect_ratio' => '16:9',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://example.com/frame.png'
],
[
'type' => 'driving_audio',
'url' => 'https://example.com/audio.mp3'
]
]
]),
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/generations"
payload := strings.NewReader("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixai.ru/v1/videos/generations")
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\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
{
"type": "first_frame",
"url": "https://example.com/frame.png"
},
{
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
}
]
}'import Foundation
let parameters = [
"model": "wan2.7",
"type": "t2v",
"prompt": "Красивый закат над морем",
"duration": 5,
"size": "1080p",
"aspect_ratio": "16:9",
"media": [
[
"type": "first_frame",
"url": "https://example.com/frame.png"
],
[
"type": "driving_audio",
"url": "https://example.com/audio.mp3"
]
]
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.nixai.ru/v1/videos/generations")!
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/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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: 'wan2.7',
type: 't2v',
prompt: 'Красивый закат над морем',
duration: 5,
size: '1080p',
aspect_ratio: '16:9',
media: [
{type: 'first_frame', url: 'https://example.com/frame.png'},
{type: 'driving_audio', url: 'https://example.com/audio.mp3'}
]
})
};
fetch('https://api.nixai.ru/v1/videos/generations', 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/generations");
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\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\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/generations");
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\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"model\": \"wan2.7\",\n \"type\": \"t2v\",\n \"prompt\": \"Красивый закат над морем\",\n \"duration\": 5,\n \"size\": \"1080p\",\n \"aspect_ratio\": \"16:9\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/frame.png\"\n },\n {\n \"type\": \"driving_audio\",\n \"url\": \"https://example.com/audio.mp3\"\n }\n ]\n}")
val request = Request.Builder()
.url("https://api.nixai.ru/v1/videos/generations")
.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"
}