视频
创建视频生成任务
根据提示词和可选首尾帧或参考素材创建异步视频生成任务,素材支持文件 ID 或 HTTPS URL。
POST
/
openapi
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"xai/grok-imagine\",",
" \"prompt\": \"A cinematic tracking shot through a neon-lit street at night\",",
" \"duration\": 6,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\"",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""xai/grok-imagine"",
""prompt"": ""A cinematic tracking shot through a neon-lit street at night"",
""duration"": 6,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9""
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"bytedance/seedance-2.0\",",
" \"prompt\": \"The camera slowly pushes in while soft wind moves the leaves\",",
" \"frame_images\": [",
" {",
" \"frame_type\": \"first_frame\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" }",
" ],",
" \"duration\": 5,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""bytedance/seedance-2.0"",
""prompt"": ""The camera slowly pushes in while soft wind moves the leaves"",
""frame_images"": [
{
""frame_type"": ""first_frame"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
}
],
""duration"": 5,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
},
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"bytedance/seedance-2.0-fast\",",
" \"prompt\": \"Move naturally from the opening frame to the closing frame\",",
" \"frame_images\": [",
" {",
" \"frame_type\": \"first_frame\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" },",
" {",
" \"frame_type\": \"last_frame\",",
" \"file_id\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"",
" }",
" ],",
" \"duration\": 5,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""bytedance/seedance-2.0-fast"",
""prompt"": ""Move naturally from the opening frame to the closing frame"",
""frame_images"": [
{
""frame_type"": ""first_frame"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
},
{
""frame_type"": ""last_frame"",
""file_id"": ""6ba7b810-9dad-11d1-80b4-00c04fd430c8""
}
],
""duration"": 5,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{"type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000"},
{"type": "video", "file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"},
{"type": "audio", "file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"},
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"google/veo-3.1\",",
" \"prompt\": \"Create a cohesive cinematic sequence using the supplied references\",",
" \"input_references\": [",
" {",
" \"type\": \"image\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" },",
" {",
" \"type\": \"video\",",
" \"file_id\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"",
" },",
" {",
" \"type\": \"audio\",",
" \"file_id\": \"7d1fa4bb-41e6-4a5d-88d8-1851f5342e87\"",
" }",
" ],",
" \"duration\": 8,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""google/veo-3.1"",
""prompt"": ""Create a cohesive cinematic sequence using the supplied references"",
""input_references"": [
{
""type"": ""image"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
},
{
""type"": ""video"",
""file_id"": ""6ba7b810-9dad-11d1-80b4-00c04fd430c8""
},
{
""type"": ""audio"",
""file_id"": ""7d1fa4bb-41e6-4a5d-88d8-1851f5342e87""
}
],
""duration"": 8,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
{
"id": "normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d",
"status": "queued",
"created_at": 1784044800,
"mode": "text_to_video",
"model": "xai/grok-imagine",
"data": [
{
"uuid": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87",
"status": "queued",
"created_at": 1784044800
}
],
"usage": {
"credits": 90
}
}
{
"error": {
"code": "invalid_prompt",
"message": "prompt is required and must be a non-empty string"
}
}
{
"error": {
"code": "unsupported_model",
"message": "Unsupported modelKey: missing-model"
}
}
{
"error": {
"code": "model_unavailable",
"message": "Model is unavailable: veo-3.1"
}
}
{
"error": {
"code": "invalid_api_key",
"message": "The API key is invalid or expired"
}
}
{
"error": {
"code": "insufficient_credits",
"message": "Insufficient credits for video generation"
}
}
{
"error": {
"code": "reference_too_large",
"message": "Reference file must not exceed 10 MB"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Retry after the indicated interval."
}
}
{
"error": {
"code": "internal_error",
"message": "An internal error occurred"
}
}
授权
请求体 application/json
不传素材时使用文生视频;仅传frame_images 时使用首帧或首尾帧生视频;传入 input_references 时使用参考素材生视频。所选模型须支持对应模式。
省略可选参数时使用所选模型的当前默认值。
每张首帧、尾帧及参考图片最多 10 MiB,通过 file_id 或 url 传入时使用相同限制。
- seedance-2.0
- seedance-2.0-fast
- veo-3.1
- kling-3.0
- grok-imagine
是否返回生成视频的尾帧图片。开启后,在查询任务的
output.videos[].last_frame_url 中获取图片地址。是否返回生成视频的尾帧图片。开启后,在查询任务的
output.videos[].last_frame_url 中获取图片地址。Kling 3.0 模型。可选值:
kuaishou/kling-3.0。支持文生视频和首帧图生视频。使用图片时,在 frame_images 中提供一个元素,设置 type: "image" 和 frame_type: "first_frame";不支持尾帧或 input_references,这些请求会返回 unsupported_input_mode。通过
file_id 或 url 传入的首帧和尾帧图片。支持 JPG、JPEG、PNG 和 WEBP,单张图片不超过 10 MiB。图片须通过内容审核。每个 frame_type 最多出现一次;传入 last_frame 时必须同时传入 first_frame。提供此参数时数组长度为 1 - 2 个元素。每个元素必须且只能提供 file_id 或 url 中的一个。隐藏 子属性
隐藏 子属性
POST /openapi/v1/files 返回的当前账户图片文件 ID。未提供 url 时必填,两者不能同时传入。示例:"550e8400-e29b-41d4-a716-446655440000"。通过
file_id 或 url 传入的图片、视频和音频参考素材。每个元素必须且只能提供一种来源,不同元素可以混用。音频必须搭配至少一张图片或一个视频,首尾帧图片也计入。提供此参数时数组长度为 1 - 12 个元素,同时受各媒体类型的数量限制。- 图片:每个请求最多 6 张(与
frame_images合计);支持 JPG/JPEG、PNG、WEBP,单文件不超过 10 MiB,须通过内容审核。 - 视频:每个请求最多 4 个;支持 MP4、MOV,单文件默认不超过 100 MiB。
- 音频:每个请求最多 2 个;支持 MP3、WAV,单文件默认不超过 15 MiB。
- 图片
- 视频
- 音频
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"xai/grok-imagine\",",
" \"prompt\": \"A cinematic tracking shot through a neon-lit street at night\",",
" \"duration\": 6,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\"",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""xai/grok-imagine"",
""prompt"": ""A cinematic tracking shot through a neon-lit street at night"",
""duration"": 6,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9""
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"bytedance/seedance-2.0\",",
" \"prompt\": \"The camera slowly pushes in while soft wind moves the leaves\",",
" \"frame_images\": [",
" {",
" \"frame_type\": \"first_frame\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" }",
" ],",
" \"duration\": 5,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""bytedance/seedance-2.0"",
""prompt"": ""The camera slowly pushes in while soft wind moves the leaves"",
""frame_images"": [
{
""frame_type"": ""first_frame"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
}
],
""duration"": 5,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
},
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"bytedance/seedance-2.0-fast\",",
" \"prompt\": \"Move naturally from the opening frame to the closing frame\",",
" \"frame_images\": [",
" {",
" \"frame_type\": \"first_frame\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" },",
" {",
" \"frame_type\": \"last_frame\",",
" \"file_id\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"",
" }",
" ],",
" \"duration\": 5,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""bytedance/seedance-2.0-fast"",
""prompt"": ""Move naturally from the opening frame to the closing frame"",
""frame_images"": [
{
""frame_type"": ""first_frame"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
},
{
""frame_type"": ""last_frame"",
""file_id"": ""6ba7b810-9dad-11d1-80b4-00c04fd430c8""
}
],
""duration"": 5,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{"type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000"},
{"type": "video", "file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"},
{"type": "audio", "file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"},
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"google/veo-3.1\",",
" \"prompt\": \"Create a cohesive cinematic sequence using the supplied references\",",
" \"input_references\": [",
" {",
" \"type\": \"image\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" },",
" {",
" \"type\": \"video\",",
" \"file_id\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"",
" },",
" {",
" \"type\": \"audio\",",
" \"file_id\": \"7d1fa4bb-41e6-4a5d-88d8-1851f5342e87\"",
" }",
" ],",
" \"duration\": 8,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""google/veo-3.1"",
""prompt"": ""Create a cohesive cinematic sequence using the supplied references"",
""input_references"": [
{
""type"": ""image"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
},
{
""type"": ""video"",
""file_id"": ""6ba7b810-9dad-11d1-80b4-00c04fd430c8""
},
{
""type"": ""audio"",
""file_id"": ""7d1fa4bb-41e6-4a5d-88d8-1851f5342e87""
}
],
""duration"": 8,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
响应
请通过error.code 区分错误原因,不要依赖错误消息文本。
- 202
- 400
- 401
- 403
- 408
- 413
- 415
- 422
- 429
- 500
- 503
已接受生成任务
本次请求创建的生成结果子项。数组长度:至少
1 个元素。显示 child attributes
显示 child attributes
本次提交任务使用的视频生成模式。可选值:
text_to_video、first_frame_image_to_video、first_last_frame_image_to_video、reference_to_video。本次提交任务使用的视频生成模型。可选值:
bytedance/seedance-2.0、bytedance/seedance-2.0-fast、google/veo-3.1、xai/grok-imagine、kuaishou/kling-3.0。请求无效
结构化错误详情。
显示 child attributes
显示 child attributes
稳定且可供程序读取的错误码。示例:
"invalid_prompt"。URL 素材错误:invalid_reference_source:每个素材必须且只能提供file_id或url。invalid_reference_url:URL 格式或长度不符合要求。unsafe_reference_url:地址或重定向目标不符合安全要求,请使用符合上述要求的公网直链。file_rejected:图片未通过内容审核,请更换图片。
unsupported_person_reference:所选模型或通道不支持input_with_person: true。invalid_input_references:开启人物参考但frame_images和input_references均未提供。
认证失败
当前已认证用户无权访问该资源或点数不足
素材下载超时
素材文件过大
素材文件无效或格式不支持
素材下载失败
已超过请求或配额限制
结构化错误详情。
显示 child attributes
显示 child attributes
内部或上游服务错误当
error.details.submission_accepted 为 true 时,任务已经入队,但后续处理失败。
error.details.task 保留任务 ID、UUID 和已知积分,retryable 为 false。不要重新提交生成请求,以免重复扣费。
登记成功时,你可以按任务 ID 查询。如果 error.details.registration_failed 为 true,错误码为 task_registration_failed;登记修复前,查询可能返回 404。
当 error.details.submission_uncertain 为 true 时,响应保留本次尝试的任务 ID;先确认原提交结果,再决定是否重新提交。最终扣费未知时不返回积分用量。{
"id": "normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d",
"status": "queued",
"created_at": 1784044800,
"mode": "text_to_video",
"model": "xai/grok-imagine",
"data": [
{
"uuid": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87",
"status": "queued",
"created_at": 1784044800
}
],
"usage": {
"credits": 90
}
}
{
"error": {
"code": "invalid_prompt",
"message": "prompt is required and must be a non-empty string"
}
}
{
"error": {
"code": "unsupported_model",
"message": "Unsupported modelKey: missing-model"
}
}
{
"error": {
"code": "model_unavailable",
"message": "Model is unavailable: veo-3.1"
}
}
{
"error": {
"code": "invalid_api_key",
"message": "The API key is invalid or expired"
}
}
{
"error": {
"code": "insufficient_credits",
"message": "Insufficient credits for video generation"
}
}
{
"error": {
"code": "reference_too_large",
"message": "Reference file must not exceed 10 MB"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Retry after the indicated interval."
}
}
{
"error": {
"code": "internal_error",
"message": "An internal error occurred"
}
}
⌘I
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"xai/grok-imagine\",",
" \"prompt\": \"A cinematic tracking shot through a neon-lit street at night\",",
" \"duration\": 6,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\"",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "xai/grok-imagine",
"prompt": "A cinematic tracking shot through a neon-lit street at night",
"duration": 6,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9"
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""xai/grok-imagine"",
""prompt"": ""A cinematic tracking shot through a neon-lit street at night"",
""duration"": 6,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9""
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"bytedance/seedance-2.0\",",
" \"prompt\": \"The camera slowly pushes in while soft wind moves the leaves\",",
" \"frame_images\": [",
" {",
" \"frame_type\": \"first_frame\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" }",
" ],",
" \"duration\": 5,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "bytedance/seedance-2.0",
"prompt": "The camera slowly pushes in while soft wind moves the leaves",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""bytedance/seedance-2.0"",
""prompt"": ""The camera slowly pushes in while soft wind moves the leaves"",
""frame_images"": [
{
""frame_type"": ""first_frame"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
}
],
""duration"": 5,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
},
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"bytedance/seedance-2.0-fast\",",
" \"prompt\": \"Move naturally from the opening frame to the closing frame\",",
" \"frame_images\": [",
" {",
" \"frame_type\": \"first_frame\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" },",
" {",
" \"frame_type\": \"last_frame\",",
" \"file_id\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"",
" }",
" ],",
" \"duration\": 5,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Move naturally from the opening frame to the closing frame",
"frame_images": [
{
"frame_type": "first_frame",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"frame_type": "last_frame",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
],
"duration": 5,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""bytedance/seedance-2.0-fast"",
""prompt"": ""Move naturally from the opening frame to the closing frame"",
""frame_images"": [
{
""frame_type"": ""first_frame"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
},
{
""frame_type"": ""last_frame"",
""file_id"": ""6ba7b810-9dad-11d1-80b4-00c04fd430c8""
}
],
""duration"": 5,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --request POST \
--url https://api.neural4d.com/openapi/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}'
import requests
response = requests.request(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{"type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000"},
{"type": "video", "file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"},
{"type": "audio", "file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"},
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": True,
},
)
print(response.json())
const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
});
const data = await response.json();
console.log(data);
const response: Response = await fetch(
"https://api.neural4d.com/openapi/v1/videos/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
})
}
);
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
String payload = String.join("\n",
"{",
" \"model\": \"google/veo-3.1\",",
" \"prompt\": \"Create a cohesive cinematic sequence using the supplied references\",",
" \"input_references\": [",
" {",
" \"type\": \"image\",",
" \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"",
" },",
" {",
" \"type\": \"video\",",
" \"file_id\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"",
" },",
" {",
" \"type\": \"audio\",",
" \"file_id\": \"7d1fa4bb-41e6-4a5d-88d8-1851f5342e87\"",
" }",
" ],",
" \"duration\": 8,",
" \"n\": 1,",
" \"resolution\": \"720p\",",
" \"aspect_ratio\": \"16:9\",",
" \"output_with_audio\": true",
"}"
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.neural4d.com/openapi/v1/videos/generations"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}`)
req, _ := http.NewRequest(
"POST",
"https://api.neural4d.com/openapi/v1/videos/generations",
payload,
)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
}
require "net/http"
require "json"
uri = URI("https://api.neural4d.com/openapi/v1/videos/generations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}.to_json
response = Net::HTTP.start(
uri.hostname,
uri.port,
use_ssl: uri.scheme == "https"
) do |http|
http.request(request)
end
puts response.body
<?php
$payload = <<<'JSON'
{
"model": "google/veo-3.1",
"prompt": "Create a cohesive cinematic sequence using the supplied references",
"input_references": [
{
"type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000"
},
{
"type": "video",
"file_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
{
"type": "audio",
"file_id": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87"
}
],
"duration": 8,
"n": 1,
"resolution": "720p",
"aspect_ratio": "16:9",
"output_with_audio": true
}
JSON;
$ch = curl_init("https://api.neural4d.com/openapi/v1/videos/generations");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
var payload = @"{
""model"": ""google/veo-3.1"",
""prompt"": ""Create a cohesive cinematic sequence using the supplied references"",
""input_references"": [
{
""type"": ""image"",
""file_id"": ""550e8400-e29b-41d4-a716-446655440000""
},
{
""type"": ""video"",
""file_id"": ""6ba7b810-9dad-11d1-80b4-00c04fd430c8""
},
{
""type"": ""audio"",
""file_id"": ""7d1fa4bb-41e6-4a5d-88d8-1851f5342e87""
}
],
""duration"": 8,
""n"": 1,
""resolution"": ""720p"",
""aspect_ratio"": ""16:9"",
""output_with_audio"": true
}";
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.neural4d.com/openapi/v1/videos/generations"
);
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
request.Headers.TryAddWithoutValidation("Content-Type", "application/json");
request.Content = new StringContent(
payload,
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
{
"id": "normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d",
"status": "queued",
"created_at": 1784044800,
"mode": "text_to_video",
"model": "xai/grok-imagine",
"data": [
{
"uuid": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87",
"status": "queued",
"created_at": 1784044800
}
],
"usage": {
"credits": 90
}
}
{
"error": {
"code": "invalid_prompt",
"message": "prompt is required and must be a non-empty string"
}
}
{
"error": {
"code": "unsupported_model",
"message": "Unsupported modelKey: missing-model"
}
}
{
"error": {
"code": "model_unavailable",
"message": "Model is unavailable: veo-3.1"
}
}
{
"error": {
"code": "invalid_api_key",
"message": "The API key is invalid or expired"
}
}
{
"error": {
"code": "insufficient_credits",
"message": "Insufficient credits for video generation"
}
}
{
"error": {
"code": "reference_too_large",
"message": "Reference file must not exceed 10 MB"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Retry after the indicated interval."
}
}
{
"error": {
"code": "internal_error",
"message": "An internal error occurred"
}
}