# Common headers Source: https://docs.neural4d.com/en/common-headers Authentication and request tracing headers shared by API v1 endpoints. ## Authorization Send your API key with the Bearer scheme on every request. ```http theme={null} Authorization: Bearer ${YOUR_API_KEY} ``` ## X-Request-Id `X-Request-Id` is optional and correlates client logs with Neural4D logs. When you send a valid value, the service uses it unchanged and returns the same value in the response header. If the header is omitted or invalid, the service generates a new value and returns it in the response header. The value must contain `1-128` ASCII characters. It may contain only letters (`A-Z`, `a-z`), digits (`0-9`), periods (`.`), underscores (`_`), and hyphens (`-`). Examples include `client-request-123` and `order_20260804.1`. ```http theme={null} X-Request-Id: client-request-123 ``` | Header | Direction | Description | | - | - | - | | `Authorization` | Request | Required API key using the Bearer scheme. | | `X-Request-Id` | Request and response | Optional request ID; a valid client value is returned unchanged, otherwise the service generates one. | # Create 3D model generation tasks Source: https://docs.neural4d.com/en/v1-api-reference/3d-generation/create-3d-generation-tasks POST https://api.neural4d.com/openapi/v1/3dmodels/generations Create asynchronous 3D model generation tasks from a text prompt, reference images, or multi-view images. ## Authorizations **Authorization** `string` *required* (default: Bearer \$\{YOUR\_API\_KEY}) Neural4D API key using the Bearer scheme. ## Body application/json > [tab] Text-to-3D > > **model** `enum\` *required* > > Public model identifier. Available option: `dreamtech/neural4d-2.5`. > > **prompt** `string` *required* > > Text describing the model to generate. Must not be empty and is limited to 500 characters. > > **with\_texture** `boolean` (default: false) > > Whether to generate a texture. When `false`, the task creates only a mesh. > > **with\_pbr** `boolean` (default: false) > > Whether to generate PBR materials. When `true`, `with_texture` must be `true`. > > **mesh\_quality** `enum\` (default: standard) > > Mesh quality: `standard`, `high`, or `extra_high`. > > **topology** `enum\` (default: triangle) > > Mesh topology: `triangle` or `quad`. > > **target\_polycount** `integer` (default: 500000) > > Target face count. Triangle `standard` supports 100,000–500,000 and defaults to 500,000. Triangle `high` and `extra_high` support 500,000–1,000,000 and default to 1,000,000. Quad supports 1,000–100,000 and defaults to 50,000. Triangle counts increase in steps of 1,000; quad counts increase in steps of 100. > > **pose** `enum\` (default: auto) > > Character pose: `auto`, `A-pose`, or `T-pose`. > > **n** `integer` (default: 1) > > Number of models to generate, from 1 to 4. > [tab] Single-image-to-3D > > **model** `enum\` *required* > > Public model identifier. Available option: `dreamtech/neural4d-2.5`. > > **input\_references** `object[]` *required* > > A reference image array containing exactly one item. Only JPG, JPEG, PNG, and WEBP are supported, with a maximum size of 20 MiB per image. The item must contain either `file_id` or `url`, but not both. Do not combine it with `multi_view_images`. > > The size limit applies to both `file_id` and `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type, set to `image`. > > **file\_id** `string\` > > The file `id` returned by `POST /openapi/v1/files`. Required when `url` is omitted. > > **url** `string\` > > A publicly downloadable HTTPS image URL. Required when `file_id` is omitted. > > **image\_enhancement** `boolean` (default: false) > > Whether to enhance the input image before 3D model generation to help improve results. Set to `true` to enable. Disabled by default. > > **with\_texture** `boolean` (default: false) > > Whether to generate a texture. When `false`, the task creates only a mesh. > > **with\_pbr** `boolean` (default: false) > > Whether to generate PBR materials. When `true`, `with_texture` must be `true`. > > **mesh\_quality** `enum\` (default: standard) > > Mesh quality: `standard`, `high`, or `extra_high`. > > **topology** `enum\` (default: triangle) > > Mesh topology: `triangle` or `quad`. > > **target\_polycount** `integer` (default: 500000) > > Target face count. Triangle `standard` supports 100,000–500,000 and defaults to 500,000. Triangle `high` and `extra_high` support 500,000–1,000,000 and default to 1,000,000. Quad supports 1,000–100,000 and defaults to 50,000. Triangle counts increase in steps of 1,000; quad counts increase in steps of 100. > > **pose** `enum\` (default: auto) > > Character pose: `auto`, `A-pose`, or `T-pose`. > > **n** `integer` (default: 1) > > Number of models to generate from this one reference image, from 1 to 4. > [tab] Batch image-to-3D > > **model** `enum\` *required* > > Public model identifier. Available option: `dreamtech/neural4d-2.5`. > > **input\_references** `object[]` *required* > > An array of 2–10 reference images. Only JPG, JPEG, PNG, and WEBP are supported, with a maximum size of 20 MiB per image. Each image generates one model. Each item must contain either `file_id` or `url`, but not both. Do not combine it with `multi_view_images`. > > The size limit applies to both `file_id` and `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type, set to `image`. > > **file\_id** `string\` > > The file `id` returned by `POST /openapi/v1/files`. Required when `url` is omitted. > > **url** `string\` > > A publicly downloadable HTTPS image URL. Required when `file_id` is omitted. > > **image\_enhancement** `boolean` (default: false) > > Whether to enhance each input image in the batch before 3D model generation to help improve results. Set to `true` to enable. Disabled by default. > > **with\_texture** `boolean` (default: false) > > Whether to generate a texture. When `false`, the task creates only a mesh. > > **with\_pbr** `boolean` (default: false) > > Whether to generate PBR materials. When `true`, `with_texture` must be `true`. > > **mesh\_quality** `enum\` (default: standard) > > Mesh quality: `standard`, `high`, or `extra_high`. > > **topology** `enum\` (default: triangle) > > Mesh topology: `triangle` or `quad`. > > **target\_polycount** `integer` (default: 500000) > > Target face count. Triangle `standard` supports 100,000–500,000 and defaults to 500,000. Triangle `high` and `extra_high` support 500,000–1,000,000 and default to 1,000,000. Quad supports 1,000–100,000 and defaults to 50,000. Triangle counts increase in steps of 1,000; quad counts increase in steps of 100. > [tab] Multi-view-to-3D > > **model** `enum\` *required* > > Public model identifier. Available option: `dreamtech/neural4d-2.5`. > > **multi\_view\_images** `object[]` *required* > > An array of 2–6 multi-view reference images. Supported formats are JPG, JPEG, PNG, and WEBP, with a maximum size of 10 MiB per image. It must include `front` and `back`; other views are optional and each view may appear at most once. Each item must contain either `file_id` or `url`, but not both. Do not combine it with `input_references`. > > The size limit applies to both `file_id` and `url`. This mode always uses a triangle mesh with `high` quality. Do not pass `mesh_quality`, `topology`, or `pose`. > > **Child attributes** > > **view\_type** `enum\` *required* > > The view shown in the image. Available options: `front`, `back`, `left`, `right`, `top`, and `bottom`. > > **file\_id** `string\` > > The file `id` returned by `POST /openapi/v1/files`. Required when `url` is omitted. > > **url** `string\` > > A publicly downloadable HTTPS image URL. Required when `file_id` is omitted. > > **with\_texture** `boolean` (default: false) > > Whether to generate a texture. When `false`, the task creates only a mesh. > > **with\_pbr** `boolean` (default: false) > > Whether to generate PBR materials. When `true`, `with_texture` must be `true`. > > **target\_polycount** `integer` (default: 500000) > > Target face count. Multi-view generation uses a `high`-quality triangle mesh. The range is 500,000–1,000,000, the default is 500,000, and counts increase in steps of 1,000. > > **n** `integer` (default: 1) > > Number of models to generate, from 1 to 4. ```bash cURL · text_to_3d theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/3dmodels/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "mesh_quality": "standard", "topology": "triangle", "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }' ``` ```python Python · text_to_3d theme={null} import requests response = requests.post( "https://api.neural4d.com/openapi/v1/3dmodels/generations", headers={ "Authorization": "Bearer ", "Content-Type": "application/json", }, json={ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "mesh_quality": "standard", "topology": "triangle", "target_polycount": 500000, "with_texture": False, "with_pbr": False, "n": 1, }, ) print(response.json()) ``` ```javascript JavaScript · text_to_3d theme={null} const response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "mesh_quality": "standard", "topology": "triangle", "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }) } ); console.log(await response.json()); ``` ```typescript TypeScript · text_to_3d theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "mesh_quality": "standard", "topology": "triangle", "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }) } ); console.log(await response.json()); ``` ```java Java · text_to_3d theme={null} import java.net.URI; import java.net.http.*; String payload = String.join("\n", "{", " \"model\": \"dreamtech/neural4d-2.5\",", " \"prompt\": \"A ceramic teapot on a white studio background\",", " \"mesh_quality\": \"standard\",", " \"topology\": \"triangle\",", " \"target_polycount\": 500000,", " \"with_texture\": false,", " \"with_pbr\": false,", " \"n\": 1", "}" ); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/3dmodels/generations")) .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · text_to_3d theme={null} package main import ( "fmt" "io" "net/http" "strings" ) func main() { payload := strings.NewReader(`{ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "mesh_quality": "standard", "topology": "triangle", "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }`) req, _ := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/3dmodels/generations", payload, ) req.Header.Set("Authorization", "Bearer ") 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)) } ``` ```ruby Ruby · text_to_3d theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/3dmodels/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " request["Content-Type"] = "application/json" request.body = { "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "mesh_quality": "standard", "topology": "triangle", "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }.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 PHP · text_to_3d theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · text_to_3d theme={null} using System.Net.Http; using System.Text; var payload = @"{ ""model"": ""dreamtech/neural4d-2.5"", ""prompt"": ""A ceramic teapot on a white studio background"", ""mesh_quality"": ""standard"", ""topology"": ""triangle"", ""target_polycount"": 500000, ""with_texture"": false, ""with_pbr"": false, ""n"": 1 }"; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/3dmodels/generations" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); request.Content = new StringContent( payload, Encoding.UTF8, "application/json" ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ```bash cURL · image_to_3d theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/3dmodels/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "image_enhancement": true, "pose": "T-pose", "mesh_quality": "standard", "n": 2 }' ``` ```python Python · image_to_3d theme={null} import requests response = requests.post( "https://api.neural4d.com/openapi/v1/3dmodels/generations", headers={ "Authorization": "Bearer ", "Content-Type": "application/json", }, json={ "model": "dreamtech/neural4d-2.5", "input_references": [ {"type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000"} ], "image_enhancement": True, "pose": "T-pose", "mesh_quality": "standard", "n": 2, }, ) print(response.json()) ``` ```javascript JavaScript · image_to_3d theme={null} const response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "image_enhancement": true, "pose": "T-pose", "mesh_quality": "standard", "n": 2 }) } ); console.log(await response.json()); ``` ```typescript TypeScript · image_to_3d theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "image_enhancement": true, "pose": "T-pose", "mesh_quality": "standard", "n": 2 }) } ); console.log(await response.json()); ``` ```java Java · image_to_3d theme={null} import java.net.URI; import java.net.http.*; String payload = String.join("\n", "{", " \"model\": \"dreamtech/neural4d-2.5\",", " \"input_references\": [", " {", " \"type\": \"image\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"", " }", " ],", " \"image_enhancement\": true,", " \"pose\": \"T-pose\",", " \"mesh_quality\": \"standard\",", " \"n\": 2", "}" ); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/3dmodels/generations")) .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · image_to_3d theme={null} package main import ( "fmt" "io" "net/http" "strings" ) func main() { payload := strings.NewReader(`{ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "image_enhancement": true, "pose": "T-pose", "mesh_quality": "standard", "n": 2 }`) req, _ := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/3dmodels/generations", payload, ) req.Header.Set("Authorization", "Bearer ") 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)) } ``` ```ruby Ruby · image_to_3d theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/3dmodels/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " request["Content-Type"] = "application/json" request.body = { "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "image_enhancement": true, "pose": "T-pose", "mesh_quality": "standard", "n": 2 }.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 PHP · image_to_3d theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · image_to_3d theme={null} using System.Net.Http; using System.Text; var payload = @"{ ""model"": ""dreamtech/neural4d-2.5"", ""input_references"": [ { ""type"": ""image"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440000"" } ], ""image_enhancement"": true, ""pose"": ""T-pose"", ""mesh_quality"": ""standard"", ""n"": 2 }"; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/3dmodels/generations" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); request.Content = new StringContent( payload, Encoding.UTF8, "application/json" ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ```bash cURL · batch_image_to_3d theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/3dmodels/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" }, { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440001" } ], "image_enhancement": true, "mesh_quality": "standard", "target_polycount": 500000 }' ``` ```python Python · batch_image_to_3d theme={null} import requests response = requests.post( "https://api.neural4d.com/openapi/v1/3dmodels/generations", headers={ "Authorization": "Bearer ", "Content-Type": "application/json", }, json={ "model": "dreamtech/neural4d-2.5", "input_references": [ {"type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000"}, {"type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440001"}, ], "image_enhancement": True, "mesh_quality": "standard", "target_polycount": 500000, }, ) print(response.json()) ``` ```javascript JavaScript · batch_image_to_3d theme={null} const response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" }, { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440001" } ], "image_enhancement": true, "mesh_quality": "standard", "target_polycount": 500000 }) } ); console.log(await response.json()); ``` ```typescript TypeScript · batch_image_to_3d theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" }, { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440001" } ], "image_enhancement": true, "mesh_quality": "standard", "target_polycount": 500000 }) } ); console.log(await response.json()); ``` ```java Java · batch_image_to_3d theme={null} import java.net.URI; import java.net.http.*; String payload = String.join("\n", "{", " \"model\": \"dreamtech/neural4d-2.5\",", " \"input_references\": [", " {", " \"type\": \"image\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"", " },", " {", " \"type\": \"image\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440001\"", " }", " ],", " \"image_enhancement\": true,", " \"mesh_quality\": \"standard\",", " \"target_polycount\": 500000", "}" ); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/3dmodels/generations")) .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · batch_image_to_3d theme={null} package main import ( "fmt" "io" "net/http" "strings" ) func main() { payload := strings.NewReader(`{ "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" }, { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440001" } ], "image_enhancement": true, "mesh_quality": "standard", "target_polycount": 500000 }`) req, _ := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/3dmodels/generations", payload, ) req.Header.Set("Authorization", "Bearer ") 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)) } ``` ```ruby Ruby · batch_image_to_3d theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/3dmodels/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " request["Content-Type"] = "application/json" request.body = { "model": "dreamtech/neural4d-2.5", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" }, { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440001" } ], "image_enhancement": true, "mesh_quality": "standard", "target_polycount": 500000 }.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 PHP · batch_image_to_3d theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · batch_image_to_3d theme={null} using System.Net.Http; using System.Text; var payload = @"{ ""model"": ""dreamtech/neural4d-2.5"", ""input_references"": [ { ""type"": ""image"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440000"" }, { ""type"": ""image"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440001"" } ], ""image_enhancement"": true, ""mesh_quality"": ""standard"", ""target_polycount"": 500000 }"; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/3dmodels/generations" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); request.Content = new StringContent( payload, Encoding.UTF8, "application/json" ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ```bash cURL · multi_view_to_3d theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/3dmodels/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "dreamtech/neural4d-2.5", "multi_view_images": [ { "view_type": "front", "file_id": "550e8400-e29b-41d4-a716-446655440001" }, { "view_type": "back", "file_id": "550e8400-e29b-41d4-a716-446655440002" }, { "view_type": "left", "file_id": "550e8400-e29b-41d4-a716-446655440003" }, { "view_type": "right", "file_id": "550e8400-e29b-41d4-a716-446655440004" }, { "view_type": "top", "file_id": "550e8400-e29b-41d4-a716-446655440005" }, { "view_type": "bottom", "file_id": "550e8400-e29b-41d4-a716-446655440006" } ], "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }' ``` ```python Python · multi_view_to_3d theme={null} import requests response = requests.post( "https://api.neural4d.com/openapi/v1/3dmodels/generations", headers={ "Authorization": "Bearer ", "Content-Type": "application/json", }, json={ "model": "dreamtech/neural4d-2.5", "multi_view_images": [ {"view_type": "front", "file_id": "550e8400-e29b-41d4-a716-446655440001"}, {"view_type": "back", "file_id": "550e8400-e29b-41d4-a716-446655440002"}, {"view_type": "left", "file_id": "550e8400-e29b-41d4-a716-446655440003"}, {"view_type": "right", "file_id": "550e8400-e29b-41d4-a716-446655440004"}, {"view_type": "top", "file_id": "550e8400-e29b-41d4-a716-446655440005"}, {"view_type": "bottom", "file_id": "550e8400-e29b-41d4-a716-446655440006"}, ], "target_polycount": 500000, "with_texture": False, "with_pbr": False, "n": 1, }, ) print(response.json()) ``` ```javascript JavaScript · multi_view_to_3d theme={null} const response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "multi_view_images": [ { "view_type": "front", "file_id": "550e8400-e29b-41d4-a716-446655440001" }, { "view_type": "back", "file_id": "550e8400-e29b-41d4-a716-446655440002" }, { "view_type": "left", "file_id": "550e8400-e29b-41d4-a716-446655440003" }, { "view_type": "right", "file_id": "550e8400-e29b-41d4-a716-446655440004" }, { "view_type": "top", "file_id": "550e8400-e29b-41d4-a716-446655440005" }, { "view_type": "bottom", "file_id": "550e8400-e29b-41d4-a716-446655440006" } ], "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }) } ); console.log(await response.json()); ``` ```typescript TypeScript · multi_view_to_3d theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "multi_view_images": [ { "view_type": "front", "file_id": "550e8400-e29b-41d4-a716-446655440001" }, { "view_type": "back", "file_id": "550e8400-e29b-41d4-a716-446655440002" }, { "view_type": "left", "file_id": "550e8400-e29b-41d4-a716-446655440003" }, { "view_type": "right", "file_id": "550e8400-e29b-41d4-a716-446655440004" }, { "view_type": "top", "file_id": "550e8400-e29b-41d4-a716-446655440005" }, { "view_type": "bottom", "file_id": "550e8400-e29b-41d4-a716-446655440006" } ], "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }) } ); console.log(await response.json()); ``` ```java Java · multi_view_to_3d theme={null} import java.net.URI; import java.net.http.*; String payload = String.join("\n", "{", " \"model\": \"dreamtech/neural4d-2.5\",", " \"multi_view_images\": [", " {", " \"view_type\": \"front\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440001\"", " },", " {", " \"view_type\": \"back\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440002\"", " },", " {", " \"view_type\": \"left\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440003\"", " },", " {", " \"view_type\": \"right\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440004\"", " },", " {", " \"view_type\": \"top\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440005\"", " },", " {", " \"view_type\": \"bottom\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440006\"", " }", " ],", " \"target_polycount\": 500000,", " \"with_texture\": false,", " \"with_pbr\": false,", " \"n\": 1", "}" ); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/3dmodels/generations")) .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · multi_view_to_3d theme={null} package main import ( "fmt" "io" "net/http" "strings" ) func main() { payload := strings.NewReader(`{ "model": "dreamtech/neural4d-2.5", "multi_view_images": [ { "view_type": "front", "file_id": "550e8400-e29b-41d4-a716-446655440001" }, { "view_type": "back", "file_id": "550e8400-e29b-41d4-a716-446655440002" }, { "view_type": "left", "file_id": "550e8400-e29b-41d4-a716-446655440003" }, { "view_type": "right", "file_id": "550e8400-e29b-41d4-a716-446655440004" }, { "view_type": "top", "file_id": "550e8400-e29b-41d4-a716-446655440005" }, { "view_type": "bottom", "file_id": "550e8400-e29b-41d4-a716-446655440006" } ], "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }`) req, _ := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/3dmodels/generations", payload, ) req.Header.Set("Authorization", "Bearer ") 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)) } ``` ```ruby Ruby · multi_view_to_3d theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/3dmodels/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " request["Content-Type"] = "application/json" request.body = { "model": "dreamtech/neural4d-2.5", "multi_view_images": [ { "view_type": "front", "file_id": "550e8400-e29b-41d4-a716-446655440001" }, { "view_type": "back", "file_id": "550e8400-e29b-41d4-a716-446655440002" }, { "view_type": "left", "file_id": "550e8400-e29b-41d4-a716-446655440003" }, { "view_type": "right", "file_id": "550e8400-e29b-41d4-a716-446655440004" }, { "view_type": "top", "file_id": "550e8400-e29b-41d4-a716-446655440005" }, { "view_type": "bottom", "file_id": "550e8400-e29b-41d4-a716-446655440006" } ], "target_polycount": 500000, "with_texture": false, "with_pbr": false, "n": 1 }.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 PHP · multi_view_to_3d theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · multi_view_to_3d theme={null} using System.Net.Http; using System.Text; var payload = @"{ ""model"": ""dreamtech/neural4d-2.5"", ""multi_view_images"": [ { ""view_type"": ""front"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440001"" }, { ""view_type"": ""back"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440002"" }, { ""view_type"": ""left"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440003"" }, { ""view_type"": ""right"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440004"" }, { ""view_type"": ""top"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440005"" }, { ""view_type"": ""bottom"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440006"" } ], ""target_polycount"": 500000, ""with_texture"": false, ""with_pbr"": false, ""n"": 1 }"; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/3dmodels/generations" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); request.Content = new StringContent( payload, Encoding.UTF8, "application/json" ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ## Response Identify errors by `error.code`. > [tab] 202 > > Successful requests return `202 Accepted`, a batch task ID, and generated child items. A batch image request creates one child item per image. For example, two images produce two items in `data`. > > **id** `string` *required* > > Batch task ID for this generation request. Use it to retrieve task status. > > **status** `enum\` *required* > > Batch task status. Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when the batch task was created. > > **mode** `enum\` *required* > > Generation mode. Available options: `text_to_3d` (text), `image_to_3d` (single image), `batch_image_to_3d` (batch images), `multi_view_to_3d` (multi-view images). > > **model** `string` *required* > > Public model identifier used for this generation. > > **data** `object[]` *required* > > Generated child items created by this request. > > **Child attributes** > > **uuid** `string\` *required* > > Generated child item UUID. > > **status** `enum\` *required* > > Child task status. Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when the child item was created. > > **updated\_at** `integer\` > > Unix timestamp in seconds when the child item was updated. > > **usage** `object` > > Credits charged for this child item when available. > > **Child attributes** > > **credits** `number\` *required* > > Credits charged for this child item. > > **error** `object` > > Failure details when asynchronous processing fails. > > **Child attributes** > > **code** `string` *required* > > Stable task failure code. > > **message** `string` *required* > > Explanation of the task failure. > > **failed\_at** `integer\` > > Unix timestamp in seconds when the task failed. > > **retryable** `boolean` > > Whether retrying the same operation may succeed. > > **usage** `object` > > Request billing information when available, including credits charged in `credits`. > > **Child attributes** > > **credits** `number\` *required* > > Total credits charged for this request. > [tab] 400 > > Invalid request. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `file_rejected`: The reference image did not pass content validation. > * `invalid_content_type`: Content-Type must be application/json. > * `invalid_file_id`: The uploaded file ID is invalid or unavailable. > * `invalid_file_type`: The uploaded file is not a supported reference image. > * `invalid_generation_request`: The requested 3D generation is not supported. > * `invalid_multi_view_images`: Multi-view images must include front and back without duplicate views. > * `invalid_prompt`: The prompt is empty, exceeds 500 characters, or fails content validation. > * `invalid_reference_source`: Each reference must contain exactly one of file\_id or url. > * `invalid_reference_url`: The reference URL format or length is invalid. > * `invalid_request`: Request parameters are invalid. > * `invalid_target_polycount`: The target polygon count does not match the allowed range or step. > * `unsafe_reference_url`: The reference URL or redirect destination is not allowed. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > > **details** `object[]` > > Validation issues when available; each item contains field, rule, and message. > [tab] 401 > > Authentication failed. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `invalid_api_key`: The API key is missing, invalid, or expired. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > [tab] 403 > > Subscription or credit requirements not met. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `insufficient_credits`: The available credits are insufficient. > * `subscription_required`: An active paid subscription is required. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > > **details** `object` > > Submitted-task details when available. partial, task, and submission\_uncertain describe partial or uncertain submission. > [tab] 408 > > Reference download timed out. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `reference_fetch_timeout`: The reference image download timed out. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > [tab] 413 > > Reference image too large. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `reference_too_large`: The reference image exceeds the size limit for its use. Single-image and batch references allow 20 MiB per image; multi-view allows 10 MiB. File IDs and URLs use the same limits. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > [tab] 415 > > Invalid or unsupported reference image. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `invalid_reference_file`: The reference image is empty or its content cannot be inspected. > * `invalid_reference_file_type`: The reference image format or Content-Type is unsupported or inconsistent. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > [tab] 422 > > Reference download failed. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `reference_fetch_failed`: The reference image cannot be downloaded. > * `reference_redirect_limit`: The reference URL redirects too many times. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > [tab] 429 > > Limit exceeded. > > When the response includes `Retry-After`, wait the indicated number of seconds before retrying. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `generation_limit_exceeded`: A generation quota or concurrency limit was reached. > * `rate_limit_exceeded`: The request rate limit was reached. > * `reference_import_busy`: Reference import is busy; retry after the indicated interval. > > **message** `string` *required* > > Human-readable explanation. Identify the cause by error.code. > [tab] 500 > > Internal error. > > When `error.details.registration_failed` is `true`, your generation task is already queued but task registration failed. A complete submission returns `task_registration_failed`; a partial 3D submission keeps its original error code. > `error.details.task` retains the task ID, UUIDs, and known credit usage. `submission_accepted` is `true` and `retryable` is `false`. > Do not resubmit the generation request, as doing so can charge you again. Task lookup may return `404` until registration is repaired. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `internal_error`: An internal error occurred. > * `task_registration_failed`: Your task was queued but registration failed. Do not resubmit it. > > **message** `string` *required* > > Returns `An internal error occurred`. > > **details** `object` > > Submitted-task details when available. partial, task, and submission\_uncertain describe partial or uncertain submission. > [tab] 503 > > Service unavailable. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > * `file_moderation_unavailable`: Image content validation is temporarily unavailable. > * `prompt_moderation_unavailable`: Prompt content validation is temporarily unavailable. > * `rate_limit_unavailable`: The rate-limit service is temporarily unavailable. > > **message** `string` *required* > > Returns `An internal error occurred`. ```json 202 Accepted theme={null} { "id": "normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "queued", "created_at": 1784044800, "mode": "batch_image_to_3d", "model": "dreamtech/neural4d-2.5", "data": [ { "uuid": "72e30159-a242-4491-a67c-2ad0cfc9efb6", "status": "queued", "created_at": 1784044800 }, { "uuid": "72e30159-a242-4491-a67c-2ad0cfc9efb7", "status": "queued", "created_at": 1784044800 } ], "usage": { "credits": 60 } } ``` ```json 400 file_rejected theme={null} { "error": { "code": "file_rejected", "message": "The uploaded image did not pass content validation" } } ``` ```json 400 invalid_content_type theme={null} { "error": { "code": "invalid_content_type", "message": "Content-Type must be application/json" } } ``` ```json 400 invalid_file_id theme={null} { "error": { "code": "invalid_file_id", "message": "Request body validation failed" } } ``` ```json 400 invalid_file_type theme={null} { "error": { "code": "invalid_file_type", "message": "Unsupported reference type" } } ``` ```json 400 invalid_generation_request theme={null} { "error": { "code": "invalid_generation_request", "message": "Invalid 3D generation request" } } ``` ```json 400 invalid_multi_view_images theme={null} { "error": { "code": "invalid_multi_view_images", "message": "Request body validation failed", "details": [ { "field": "/multi_view_images", "rule": "custom", "message": "Views must include front and back without duplicates" } ] } } ``` ```json 400 invalid_prompt theme={null} { "error": { "code": "invalid_prompt", "message": "Request body validation failed", "details": [ { "field": "/prompt", "rule": "too_small", "message": "String must contain at least 1 character(s)" } ] } } ``` ```json 400 invalid_reference_source theme={null} { "error": { "code": "invalid_reference_source", "message": "Request body validation failed", "details": [ { "field": "/input_references/0", "rule": "custom", "message": "Provide exactly one of file_id or url" } ] } } ``` ```json 400 invalid_reference_url theme={null} { "error": { "code": "invalid_reference_url", "message": "Request body validation failed", "details": [ { "field": "/input_references/0/url", "rule": "custom", "message": "url must be an HTTPS URL without embedded credentials" } ] } } ``` ```json 400 invalid_request theme={null} { "error": { "code": "invalid_request", "message": "Request body validation failed", "details": [ { "field": "/model", "rule": "invalid_enum_value", "message": "Invalid enum value. Expected 'dreamtech/neural4d-2.5', received 'unsupported-model'" } ] } } ``` ```json 400 invalid_target_polycount theme={null} { "error": { "code": "invalid_target_polycount", "message": "target_polycount must be between 100000 and 500000 in steps of 1000" } } ``` ```json 400 unsafe_reference_url theme={null} { "error": { "code": "unsafe_reference_url", "message": "Reference URL is not allowed" } } ``` ```json 401 invalid_api_key theme={null} { "error": { "code": "invalid_api_key", "message": "A Bearer API key is required" } } ``` ```json 403 insufficient_credits theme={null} { "error": { "code": "insufficient_credits", "message": "User insufficient points, only have 0 now" } } ``` ```json 403 subscription_required theme={null} { "error": { "code": "subscription_required", "message": "OpenAPI v1 is available to subscribed users only" } } ``` ```json 408 reference_fetch_timeout theme={null} { "error": { "code": "reference_fetch_timeout", "message": "Reference host resolution timed out" } } ``` ```json 413 reference_too_large theme={null} { "error": { "code": "reference_too_large", "message": "Reference file must not exceed 20 MB" } } ``` ```json 415 invalid_reference_file theme={null} { "error": { "code": "invalid_reference_file", "message": "Reference file is empty" } } ``` ```json 415 invalid_reference_file_type theme={null} { "error": { "code": "invalid_reference_file_type", "message": "Reference response Content-Type does not match its file content" } } ``` ```json 422 reference_fetch_failed theme={null} { "error": { "code": "reference_fetch_failed", "message": "Reference host could not be resolved" } } ``` ```json 422 reference_redirect_limit theme={null} { "error": { "code": "reference_redirect_limit", "message": "Reference URL redirected too many times" } } ``` ```json 429 generation_limit_exceeded theme={null} { "error": { "code": "generation_limit_exceeded", "message": "Generation limit exceeded" } } ``` ```json 429 rate_limit_exceeded theme={null} { "error": { "code": "rate_limit_exceeded", "message": "Too many requests. Retry after the indicated interval." } } ``` ```json 429 reference_import_busy theme={null} { "error": { "code": "reference_import_busy", "message": "Too many reference files are being imported" } } ``` ```json 500 internal_error theme={null} { "error": { "code": "internal_error", "message": "An internal error occurred" } } ``` ```json 503 file_moderation_unavailable theme={null} { "error": { "code": "file_moderation_unavailable", "message": "An internal error occurred" } } ``` ```json 503 rate_limit_unavailable theme={null} { "error": { "code": "rate_limit_unavailable", "message": "An internal error occurred" } } ``` ```json 413 reference_too_large (multi-view) theme={null} { "error": { "code": "reference_too_large", "message": "Reference file must not exceed 10 MB" } } ``` # Upload a file Source: https://docs.neural4d.com/en/v1-api-reference/files/upload-a-file POST https://api.neural4d.com/openapi/v1/files Uploads one local image, video, or audio file and returns a reusable file ID. ## Authorizations **Authorization** `string` *required* (default: Bearer \$\{YOUR\_API\_KEY}) Neural4D API key using the Bearer scheme. ## Body multipart/form-data **file** `string\` *required* File to upload. Supported image formats: JPG, JPEG, PNG, GIF, WEBP, BMP, HEIC, and HEIF. Supported video formats: MP4, MOV, WEBM, M4V, OGG, and OGV. Supported audio formats: MP3 and WAV. Default maximum size per file: 20 MiB for images, 100 MiB for videos, and 15 MiB for audio. Files above the upload limit return `400 file_too_large`. Generation requests check image sizes again based on their use. These limits apply to both the uploaded `file_id` and a public HTTPS `url`: | Image use | Maximum size per image | | - | - | | Image generation references | 10 MiB | | Video generation first frames, last frames, and image references | 10 MiB | | Single-image and batch image-to-3D | 20 MiB | | Multi-view-to-3D | 10 MiB | ```bash cURL theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/files \ --header 'Authorization: Bearer ' \ --form 'file=@/path/to/file.png' ``` ```python Python theme={null} import requests response = requests.request( "POST", "https://api.neural4d.com/openapi/v1/files", headers={ "Authorization": "Bearer ", }, files={"file": open("/path/to/file", "rb")}, ) print(response.json()) ``` ```javascript JavaScript theme={null} const response = await fetch("https://api.neural4d.com/openapi/v1/files", { method: "POST", headers: { "Authorization": "Bearer " }, body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })() }); const data = await response.json(); console.log(data); ``` ```typescript TypeScript theme={null} const response: Response = await fetch("https://api.neural4d.com/openapi/v1/files", { method: "POST", headers: { "Authorization": "Bearer " }, body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })() }); const data = await response.json(); console.log(data); ``` ```java Java theme={null} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.UUID; class Main { public static void main(String[] args) throws Exception { Path file = Path.of("/path/to/file.png"); String boundary = "----Neural4DUpload" + UUID.randomUUID(); String partHeader = "--" + boundary + "\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getFileName() + "\"\r\n" + "Content-Type: image/png\r\n\r\n"; HttpRequest.BodyPublisher body = HttpRequest.BodyPublishers.ofByteArrays(List.of( partHeader.getBytes(StandardCharsets.UTF_8), Files.readAllBytes(file), ("\r\n--" + boundary + "--\r\n").getBytes(StandardCharsets.UTF_8) )); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/files")) .header("Authorization", "Bearer ") .header("Content-Type", "multipart/form-data; boundary=" + boundary) .POST(body) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); } } ``` ```go Go theme={null} package main import ( "bytes" "fmt" "io" "log" "mime" "mime/multipart" "net/http" "net/textproto" "os" "path/filepath" ) func main() { filename := "/path/to/file.png" data, err := os.ReadFile(filename) if err != nil { log.Fatal(err) } var payload bytes.Buffer writer := multipart.NewWriter(&payload) header := make(textproto.MIMEHeader) header.Set("Content-Disposition", mime.FormatMediaType( "form-data", map[string]string{ "name": "file", "filename": filepath.Base(filename), }, )) contentType := mime.TypeByExtension(filepath.Ext(filename)) if contentType == "" { contentType = http.DetectContentType(data) } header.Set("Content-Type", contentType) part, err := writer.CreatePart(header) if err != nil { log.Fatal(err) } if _, err := part.Write(data); err != nil { log.Fatal(err) } if err := writer.Close(); err != nil { log.Fatal(err) } req, err := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/files", &payload, ) if err != nil { log.Fatal(err) } req.Header.Set("Authorization", "Bearer ") req.Header.Set("Content-Type", writer.FormDataContentType()) resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Println(string(body)) } ``` ```ruby Ruby theme={null} require "net/http" uri = URI("https://api.neural4d.com/openapi/v1/files") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " File.open("/path/to/file.png", "rb") do |file| request.set_form( [["file", file, { filename: File.basename(file.path), content_type: "image/png" }]], "multipart/form-data" ) response = Net::HTTP.start( uri.hostname, uri.port, use_ssl: uri.scheme == "https" ) do |http| http.request(request) end puts response.body end ``` ```php PHP theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", ], CURLOPT_POSTFIELDS => [ "file" => new CURLFile($filePath, "image/png", basename($filePath)), ], ]); $response = curl_exec($ch); if ($response === false) { throw new RuntimeException(curl_error($ch)); } curl_close($ch); echo $response; ``` ```csharp C# theme={null} using System; using System.IO; using System.Net.Http; using System.Net.Http.Headers; var filePath = "/path/to/file.png"; using var client = new HttpClient(); using var content = new MultipartFormDataContent(); using var file = new StreamContent(File.OpenRead(filePath)); file.Headers.ContentType = new MediaTypeHeaderValue("image/png"); content.Add(file, "file", Path.GetFileName(filePath)); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/files" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); request.Content = content; using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ## Response > [tab] 201 > > File uploaded > > **id** `string` *required* > > File ID used by generation requests. > > Example: `"550e8400-e29b-41d4-a716-446655440000"`. > > **filename** `string` *required* > > Original name of the uploaded file. > > Example: `"first-frame.png"`. > > **bytes** `integer\` *required* > > Uploaded file size in bytes. > > Required range: `0 <= x <= infinity`. > > Example: `245760`. > > **mime\_type** `string` *required* > > Media type detected for the uploaded file. > > Example: `"image/png"`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when the file was created. > [tab] 400 > > Invalid request > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 401 > > Authentication failed > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 403 > > The authenticated user cannot access this resource or has insufficient credits > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 429 > > Request or quota limit exceeded > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 500 > > Internal or upstream service error > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. ```json 201 Example theme={null} { "id": "550e8400-e29b-41d4-a716-446655440000", "filename": "first-frame.png", "bytes": 245760, "mime_type": "image/png", "created_at": 1784044800 } ``` ```json 400 invalid_prompt theme={null} { "error": { "code": "invalid_prompt", "message": "prompt is required and must be a non-empty string" } } ``` ```json 400 unsupported_model theme={null} { "error": { "code": "unsupported_model", "message": "Unsupported modelKey: missing-model" } } ``` ```json 400 model_unavailable theme={null} { "error": { "code": "model_unavailable", "message": "Model is unavailable: veo-3.1" } } ``` ```json 401 Example theme={null} { "error": { "code": "invalid_api_key", "message": "The API key is invalid or expired" } } ``` ```json 403 Example theme={null} { "error": { "code": "insufficient_credits", "message": "Insufficient credits for video generation" } } ``` ```json 429 Example theme={null} { "error": { "code": "rate_limit_exceeded", "message": "Too many requests. Retry after the indicated interval." } } ``` ```json 500 Example theme={null} { "error": { "code": "internal_error", "message": "An internal error occurred" } } ``` # Create image generation tasks Source: https://docs.neural4d.com/en/v1-api-reference/image-generation/create-image-generation-tasks POST https://api.neural4d.com/openapi/v1/images/generations Creates asynchronous image generation tasks from a prompt and optional image references supplied by file ID or HTTPS URL. ## Authorizations **Authorization** `string` *required* (default: Bearer \$\{YOUR\_API\_KEY}) Neural4D API key using the Bearer scheme. ## Body application/json Omitted optional parameters use the selected model's current defaults. Values outside its supported resolutions or aspect ratios return `unsupported_resolution` or `unsupported_aspect_ratio`. Each reference image must be at most 10 MiB, whether supplied by `file_id` or `url`. > [tab] gpt-image-2 > > **model** `enum\` *required* > > GPT Image 2 model identifier. > > Available option: `openai/gpt-image-2`. > > **prompt** `string` *required* > > Text instruction describing the image to generate or edit. > > Required string length: `1 - 1000`. > > **input\_references** `object[]` > > Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation. > > Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type. > > Available option: `image`. > > **file\_id** `string\` > > File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > > **n** `integer` (default: 1) > > Number of image generation tasks to create. > > Required range: `1 <= x <= 4`. > > **resolution** `enum\` (default: 2K) > > Named output resolution. > > Available options: `1K`, `2K`, `4K`. > > **aspect\_ratio** `enum\` (default: 1:1) > > Target image width-to-height ratio. > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. > [tab] nano-banana-pro > > **model** `enum\` *required* > > Nano Banana Pro model identifier. > > Available option: `google/nano-banana-pro`. > > **prompt** `string` *required* > > Text instruction describing the image to generate or edit. > > Required string length: `1 - 1000`. > > **input\_references** `object[]` > > Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation. > > Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type. > > Available option: `image`. > > **file\_id** `string\` > > File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > > **n** `integer` (default: 1) > > Number of image generation tasks to create. > > Required range: `1 <= x <= 4`. > > **resolution** `enum\` (default: 2K) > > Named output resolution. > > Available options: `1K`, `2K`, `4K`. > > **aspect\_ratio** `enum\` (default: 1:1) > > Target image width-to-height ratio. > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. > [tab] nano-banana-2-lite > > **model** `enum\` *required* > > Nano Banana 2 Lite model identifier. > > Available option: `google/nano-banana-2-lite`. > > **prompt** `string` *required* > > Text instruction describing the image to generate or edit. > > Required string length: `1 - 1000`. > > **input\_references** `object[]` > > Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation. > > Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type. > > Available option: `image`. > > **file\_id** `string\` > > File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > > **n** `integer` (default: 1) > > Number of image generation tasks to create. > > Required range: `1 <= x <= 4`. > > **resolution** `enum\` (default: 1K) > > Named output resolution. > > Available option: `1K`. > > **aspect\_ratio** `enum\` (default: 1:1) > > Target image width-to-height ratio. > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. > [tab] seedream-4.5 > > **model** `enum\` *required* > > Seedream 4.5 model identifier. > > Available option: `bytedance/seedream-4.5`. > > **prompt** `string` *required* > > Text instruction describing the image to generate or edit. > > Required string length: `1 - 1000`. > > **input\_references** `object[]` > > Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation. > > Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type. > > Available option: `image`. > > **file\_id** `string\` > > File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > > **n** `integer` (default: 1) > > Number of image generation tasks to create. > > Required range: `1 <= x <= 4`. > > **resolution** `enum\` (default: 2K) > > Named output resolution. > > Available options: `2K`, `4K`. > > **aspect\_ratio** `enum\` (default: 1:1) > > Target image width-to-height ratio. > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. > [tab] flux-2-pro > > **model** `enum\` *required* > > Flux 2 Pro model identifier. > > Available option: `black-forest-labs/flux-2-pro`. > > **prompt** `string` *required* > > Text instruction describing the image to generate or edit. > > Required string length: `1 - 1000`. > > **input\_references** `object[]` > > Optional reference images. Set `file_id` to the `id` returned by `POST /openapi/v1/files`, or provide the image's public HTTPS URL directly in `url`. Only JPG, JPEG, PNG, and WEBP images are supported, up to 10 MiB per image. Images must pass content moderation. > > Allowed array length: `0 - 6` elements in total. You can mix file IDs and URLs; reference order is preserved. Each item must contain exactly one of `file_id` or `url`. > > **Child attributes** > > **type** `enum\` *required* > > Reference media type. > > Available option: `image`. > > **file\_id** `string\` > > File ID returned by the file upload endpoint for your account. Required when `url` is omitted; do not provide both fields. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > > **n** `integer` (default: 1) > > Number of image generation tasks to create. > > Required range: `1 <= x <= 4`. > > **resolution** `enum\` (default: 2K) > > Named output resolution. > > Available options: `1K`, `2K`. > > **aspect\_ratio** `enum\` (default: 1:1) > > Target image width-to-height ratio. > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. ```bash cURL · openai/gpt-image-2 theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/images/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model": "openai/gpt-image-2", "prompt": "A ceramic teapot on a white studio background", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "n": 1, "resolution": "1K", "aspect_ratio": "1:1" }' ``` ```python Python theme={null} import requests response = requests.post( "https://api.neural4d.com/openapi/v1/images/generations", headers={ "Authorization": "Bearer ", "Content-Type": "application/json", }, json={ "model": "openai/gpt-image-2", "prompt": "A ceramic teapot on a white studio background", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000", }, ], "n": 1, "resolution": "1K", "aspect_ratio": "1:1", }, ) print(response.json()) ``` ```javascript JavaScript theme={null} const response = await fetch("https://api.neural4d.com/openapi/v1/images/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ model: "openai/gpt-image-2", prompt: "A ceramic teapot on a white studio background", input_references: [ { type: "image", file_id: "550e8400-e29b-41d4-a716-446655440000" } ], n: 1, resolution: "1K", aspect_ratio: "1:1" }) }); const data = await response.json(); console.log(data); ``` ```typescript TypeScript theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/images/generations", { method: "POST", headers: { "Authorization": "Bearer ", "Content-Type": "application/json" }, body: JSON.stringify({ model: "openai/gpt-image-2", prompt: "A ceramic teapot on a white studio background", input_references: [ { type: "image", file_id: "550e8400-e29b-41d4-a716-446655440000" } ], n: 1, resolution: "1K", aspect_ratio: "1:1" }) } ); const data = await response.json(); console.log(data); ``` ```java Java theme={null} import java.net.URI; import java.net.http.*; String payload = String.join("\n", "{", " \"model\": \"openai/gpt-image-2\",", " \"prompt\": \"A ceramic teapot on a white studio background\",", " \"input_references\": [", " {", " \"type\": \"image\",", " \"file_id\": \"550e8400-e29b-41d4-a716-446655440000\"", " }", " ],", " \"n\": 1,", " \"resolution\": \"1K\",", " \"aspect_ratio\": \"1:1\"", "}" ); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/images/generations")) .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go theme={null} package main import ( "fmt" "io" "net/http" "strings" ) func main() { payload := strings.NewReader(`{ "model": "openai/gpt-image-2", "prompt": "A ceramic teapot on a white studio background", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "n": 1, "resolution": "1K", "aspect_ratio": "1:1" }`) req, _ := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/images/generations", payload, ) req.Header.Set("Authorization", "Bearer ") 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)) } ``` ```ruby Ruby theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/images/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " request["Content-Type"] = "application/json" request.body = { "model": "openai/gpt-image-2", "prompt": "A ceramic teapot on a white studio background", "input_references": [ { "type": "image", "file_id": "550e8400-e29b-41d4-a716-446655440000" } ], "n": 1, "resolution": "1K", "aspect_ratio": "1:1" }.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 PHP theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => json_encode([ "model" => "openai/gpt-image-2", "prompt" => "A ceramic teapot on a white studio background", "input_references" => [ [ "type" => "image", "file_id" => "550e8400-e29b-41d4-a716-446655440000", ], ], "n" => 1, "resolution" => "1K", "aspect_ratio" => "1:1", ]), ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# theme={null} using System.Net.Http; using System.Text; var payload = @"{ ""model"": ""openai/gpt-image-2"", ""prompt"": ""A ceramic teapot on a white studio background"", ""input_references"": [ { ""type"": ""image"", ""file_id"": ""550e8400-e29b-41d4-a716-446655440000"" } ], ""n"": 1, ""resolution"": ""1K"", ""aspect_ratio"": ""1:1"" }"; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/images/generations" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); request.Content = new StringContent( payload, Encoding.UTF8, "application/json" ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ## Response Identify errors by `error.code`, not by matching message text. > [tab] 202 > > Generation tasks accepted > > **id** `string` *required* > > Batch task ID returned by the generation request. > > Example: `"normal-image-c50fe63e-699d-4d61-93f5-2099ab159d6d"`. > > **data** `object[]` *required* > > Generated child items created by the request. > > Allowed array length: at least `1` element. > > **Child attributes** > > **uuid** `string\` *required* > > Generated child item UUID. > > **status** `enum\` *required* > > Normalized task lifecycle status. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds. > > **updated\_at** `integer\` > > Unix timestamp in seconds when the task was updated. > > **usage** `object` > > Credits charged for this task when available. > > **Child attributes** > > **credits** `number\` *required* > > Credits charged for the task or submission. > > Required range: `0 <= x <= infinity`. > > Example: `13`. > > **error** `object` > > Failure details when asynchronous processing fails. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable task failure code. > > **message** `string` *required* > > Human-readable explanation of the task failure. > > **failed\_at** `integer\` > > Unix timestamp in seconds when the task failed. > > **retryable** `boolean` > > Whether retrying the same operation may succeed. > > **status** `enum\` *required* > > Current status shared by the submitted image tasks. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when the batch task was created. > > **mode** `enum\` *required* > > Image generation mode shared by the submitted tasks. > > Available options: `text_to_image`, `image_to_image`. > > **model** `enum\` *required* > > Image generation model used by the submitted tasks. > > Available options: `openai/gpt-image-2`, `google/nano-banana-pro`, `bytedance/seedream-4.5`, `black-forest-labs/flux-2-pro`, `google/nano-banana-2-lite`. > > **usage** `object` > > Total credits charged for the submitted tasks when available. > > **Child attributes** > > **credits** `number\` *required* > > Credits charged for the task submission. > > Example: `13`. > [tab] 400 > > Invalid request > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > URL reference errors: > > * `invalid_reference_source`: Provide exactly one of `file_id` or `url` per reference. > * `invalid_reference_url`: The URL format or length is invalid. > * `unsafe_reference_url`: The URL or redirect destination is not allowed. Use a public file URL that meets the requirements above. > * `file_rejected`: The image failed content moderation. Use another image. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 401 > > Authentication failed > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_api_key"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"The API key is invalid or expired"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_api_key"`. > [tab] 403 > > The authenticated user cannot access this resource or has insufficient credits > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"insufficient_credits"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"Insufficient credits for image generation"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#insufficient_credits"`. > [tab] 408 > > Reference download timed out > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `reference_fetch_timeout`: The download timed out. Check the source server and retry. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 413 > > Reference file too large > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `reference_too_large`: The image exceeds the 10 MiB limit. This limit applies to both file IDs and URLs. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 415 > > Invalid or unsupported reference file > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `invalid_reference_file`: The file is empty or its content cannot be inspected. > * `invalid_reference_file_type`: The format is unsupported or does not match the reference type or response `Content-Type`. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 422 > > Reference download failed > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `reference_fetch_failed`: The file cannot be downloaded. Check that the URL is valid and publicly accessible. > * `reference_redirect_limit`: Too many redirects. Use a direct file URL. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 429 > > Request or quota limit exceeded > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"rate_limit_exceeded"`. > > URL reference errors: > > * `reference_import_busy`: Reference import is busy. Retry after the interval in the `Retry-After` response header. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"Too many requests. Retry after the indicated interval."`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#rate_limit_exceeded"`. > [tab] 500 > > Internal or upstream service error > > When `error.details.submission_accepted` is `true`, your generation task is already queued but a later operation failed. > `error.details.task` retains the task ID, UUIDs, and known credit usage. `retryable` is `false`; do not resubmit the generation request, as doing so can charge you again. > If registration succeeded, you can query the task by its ID. If `error.details.registration_failed` is `true`, the error code is `task_registration_failed` and task lookup may return `404` until registration is repaired. > When `error.details.submission_uncertain` is `true`, the response retains the attempted task ID; check the original submission before resubmitting. Credit usage is omitted when the final charge is unknown. > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"internal_error"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"An internal error occurred"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#internal_error"`. > [tab] 503 > > Image moderation unavailable > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `file_moderation_unavailable`: Image moderation is temporarily unavailable. Retry later. > > **message** `string` *required* > > Always returns `An internal error occurred`. ```json 202 Example theme={null} { "id": "normal-image-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "queued", "created_at": 1784044800, "mode": "image_to_image", "model": "openai/gpt-image-2", "data": [ { "uuid": "c6f5dc4e-61ac-4694-9a8b-6a95f3ac4457", "status": "queued", "created_at": 1784044800 } ], "usage": { "credits": 13 } } ``` ```json 400 invalid_prompt theme={null} { "error": { "code": "invalid_prompt", "message": "prompt is required and must be a non-empty string" } } ``` ```json 400 unsupported_model theme={null} { "error": { "code": "unsupported_model", "message": "Unsupported modelKey: missing-model" } } ``` ```json 400 model_unavailable theme={null} { "error": { "code": "model_unavailable", "message": "Model is unavailable: openai/gpt-image-2" } } ``` ```json 401 Example theme={null} { "error": { "code": "invalid_api_key", "message": "The API key is invalid or expired" } } ``` ```json 403 Example theme={null} { "error": { "code": "insufficient_credits", "message": "Insufficient credits for image generation" } } ``` ```json 413 Reference file too large theme={null} { "error": { "code": "reference_too_large", "message": "Reference file must not exceed 10 MB" } } ``` ```json 429 Example theme={null} { "error": { "code": "rate_limit_exceeded", "message": "Too many requests. Retry after the indicated interval." } } ``` ```json 500 Example theme={null} { "error": { "code": "internal_error", "message": "An internal error occurred" } } ``` # Retrieve a task Source: https://docs.neural4d.com/en/v1-api-reference/tasks/retrieve-a-task GET https://api.neural4d.com/openapi/v1/tasks/task-info Returns image, video, or 3D task status and output by batch task ID or child item UUID. Provide exactly one of the id or uuid query parameters. Depending on the task type, `output` contains a `models` (3D), `images`, or `videos` array. Queued and processing entries also include generation parameters. ## Authorizations **Authorization** `string` *required* (default: Bearer \$\{YOUR\_API\_KEY}) Neural4D API key using the Bearer scheme. ## Query Parameters **id** `string` Batch task ID returned by a generation request. Provide this or uuid, but not both. Example: `"normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d"`. **uuid** `string\` Child image, video, or 3D UUID returned in the generation response. Provide this or id, but not both. Example: `"72e30159-a242-4491-a67c-2ad0cfc9efb6"`. ```bash cURL theme={null} curl --request GET \ --url 'https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d' \ --header 'Authorization: Bearer ' ``` ```python Python theme={null} import requests response = requests.request( "GET", "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", headers={ "Authorization": "Bearer ", }, ) print(response.json()) ``` ```javascript JavaScript theme={null} const response = await fetch( "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", { method: "GET", headers: { "Authorization": "Bearer " } } ); const data = await response.json(); console.log(data); ``` ```typescript TypeScript theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", { method: "GET", headers: { "Authorization": "Bearer " } } ); const data = await response.json(); console.log(data); ``` ```java Java theme={null} import java.net.URI; import java.net.http.*; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d")) .header("Authorization", "Bearer ") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go theme={null} package main import ( "fmt" "io" "net/http" ) func main() { req, _ := http.NewRequest( "GET", "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", nil, ) req.Header.Set("Authorization", "Bearer ") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() bodyBytes, _ := io.ReadAll(resp.Body) fmt.Println(string(bodyBytes)) } ``` ```ruby Ruby theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer " response = Net::HTTP.start( uri.hostname, uri.port, use_ssl: uri.scheme == "https" ) do |http| http.request(request) end puts response.body ``` ```php PHP theme={null} "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", ], ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# theme={null} using System.Net.Http; using System.Text; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Get, "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d" ); request.Headers.TryAddWithoutValidation("Authorization", "Bearer "); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ## Response > [tab] 200 > > Task details > > **id** `string` *required* > > Batch task ID returned by a generation request. > > Example: `"normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d"`. > > **status** `enum\` *required* > > Normalized task lifecycle status. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds. > > **output** `object` *required* > > Current child image, video, or 3D task output, including entries that are still queued or processing. > > **child attributes** > > **models** `object[]` > > 3D child tasks and their current results. > > **Child attributes** > > **uuid** `string\` *required* > > Generated 3D child UUID, matching the child UUID in the creation response. > > **format** `string | null` *required* > > Primary model format, usually `glb` for triangle models or `obj` for quad models. `null` until available. > > **model\_urls** `object` *required* > > Temporary signed URLs for original generation files, unaffected by format conversions. `{}` until available. Triangle models return `glb`; quad models return `obj` and an `mtl` when available. > > **Child attributes** > > **glb** `string\` > > Triangle GLB model URL. > > **obj** `string\` > > Original quad OBJ file URL. > > **mtl** `string\` > > Material file URL for the quad OBJ. Returned only when `with_texture=true` and the file has been generated; otherwise omitted. > > **thumbnail\_urls** `object` *required* > > Model thumbnail URLs. `{}` until available. > > **Child attributes** > > **front** `string\` > > Model thumbnail URL. > > **texture\_urls** `object` > > Returned only for textured quad models. Contains temporary signed URLs for available texture maps; missing types are omitted. `{}` until maps are available. > > **Child attributes** > > **albedo** `string\` > > Color map URL. > > **normal** `string\` > > Normal map URL. > > **roughness** `string\` > > Roughness map URL. > > **metallic** `string\` > > Metallic map URL. > > **mesh\_quality** `enum\` *required* > > Mesh quality. Available options: `standard`, `high`, `extra_high`. Text-to-3D, single-image-to-3D, and batch image-to-3D default to `standard`. Multi-view generation always uses `high`. > > **pose** `enum\` *required* > > Character pose. Available options: `auto`, `A-pose`, `T-pose`. Text-to-3D and single-image-to-3D return the requested pose, defaulting to `auto` when omitted. Batch image-to-3D and multi-view generation return `auto`. > > **target\_polycount** `integer` *required* > > Target polygon count used by the task, matching the requested `target_polycount` or its default. Triangle `standard` supports 100,000–500,000 and defaults to 500,000; triangle `high` and `extra_high` support 500,000–1,000,000 and default to 1,000,000; quad supports 1,000–100,000 and defaults to 50,000. Triangle counts increase in steps of 1,000 and quad counts in steps of 100. Multi-view generation uses a high-quality triangle mesh and defaults to 500,000 polygons. > > **topology** `enum\` *required* > > Mesh topology, using the same values as the request parameter: `triangle` or `quad`. > > **with\_texture** `boolean` *required* > > Whether to generate textures, matching the requested `with_texture` value. > > **with\_pbr** `boolean` *required* > > Whether to generate PBR materials, matching the requested `with_pbr` value. > > **image\_enhancement** `boolean` *required* > > Whether input-image enhancement was enabled, matching the requested `image_enhancement` value. Defaults to `false` when omitted and is `false` for text-to-3D and multi-view generation. > > **mode** `enum\` *required* > > Generation mode for this model. Available options: `text_to_3d` (text), `image_to_3d` (single image), `batch_image_to_3d` (batch images), `multi_view_to_3d` (multi-view images). > > **status** `enum\` *required* > > Current status of this model. Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when this model was created. > > **updated\_at** `integer\` *required* > > Unix timestamp in seconds when this model was last updated. > > **images** `object[]` > > All child image tasks and their current output information. url and format are null until a result file is available. > > **child attributes** > > **uuid** `string\` *required* > > Generated image child UUID. > > **url** `string\ | null` *required* > > Temporary signed URL for downloading the generated image when available. > > **format** `string | null` *required* > > Image file format when known, such as png. > > **resolution** `string | null` *required* > > Generated image resolution when available, such as 2K. > > **aspect\_ratio** `string | null` *required* > > Generated image aspect ratio when available, such as 1:1. > > **mode** `enum\` *required* > > Generation mode used for this image. > > Available options: `text_to_image`, `image_to_image`. > > **status** `enum\` *required* > > Current status of this generated image. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when this generated image was created. > > **updated\_at** `integer\` *required* > > Unix timestamp in seconds when this generated image was last updated. > > **videos** `object[]` > > All child video tasks and their current output information. url and format are null until a result file is available. > > **child attributes** > > **uuid** `string\` *required* > > Generated video child UUID. > > Example: `"72e30159-a242-4491-a67c-2ad0cfc9efb6"`. > > **url** `string\ | null` *required* > > Temporary signed URL for downloading the generated video when available. > > **last\_frame\_url** `string\ | null` *required* > > Temporary signed URL for the generated video's final frame. Returns `null` if `return_last_frame` is disabled, the frame is unavailable, or the video has not passed moderation. > > **format** `string | null` *required* > > Video file format when known, such as mp4. > > Example: `"mp4"`. > > **duration** `integer | null` *required* > > Generated video duration in seconds when available. > > Required range: `0 <= x <= infinity`. > > **resolution** `string | null` *required* > > Generated video resolution when available, such as 720p. > > Example: `"720p"`. > > **aspect\_ratio** `string | null` *required* > > Generated video aspect ratio when available, such as 16:9. > > Example: `"16:9"`. > > **has\_audio** `boolean` *required* > > Whether native audio generation was enabled for this video. > > **mode** `enum\` *required* > > Generation mode used for this video. > > Available options: `text_to_video`, `first_frame_image_to_video`, `first_last_frame_image_to_video`, `reference_to_video`. > > **status** `enum\` *required* > > Current status of this generated video. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when this generated video was created. > > **updated\_at** `integer\` *required* > > Unix timestamp in seconds when this generated video was last updated. > > **mode** `enum\` *required* > > Image, video, or 3D generation mode used by the task. > > Available options: `text_to_image`, `image_to_image`, `text_to_video`, `first_frame_image_to_video`, `first_last_frame_image_to_video`, `reference_to_video`, `text_to_3d`, `image_to_3d`, `batch_image_to_3d`, `multi_view_to_3d`. > > **model** `enum\ | null` > > Image, video, or 3D generation model used by the task. > > Available options: `openai/gpt-image-2`, `google/nano-banana-pro`, `bytedance/seedream-4.5`, `black-forest-labs/flux-2-pro`, `google/nano-banana-2-lite`, `bytedance/seedance-2.0`, `bytedance/seedance-2.0-fast`, `google/veo-3.1`, `xai/grok-imagine`, `kuaishou/kling-3.0`, `dreamtech/neural4d-2.5`. > > **updated\_at** `integer\` > > Unix timestamp in seconds. > > **usage** `object` > > Credits charged for this task when available. > > **child attributes** > > **credits** `number\` *required* > > Credits charged for the task or submission. > > Required range: `0 <= x <= infinity`. > > Example: `26`. > > **error** `object` > > Error details when the task fails. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable task failure code. > > **message** `string` *required* > > Human-readable explanation of the task failure. > > **failed\_at** `integer\` > > Unix timestamp in seconds when the task failed. > > **retryable** `boolean` > > Whether retrying the same operation may succeed. > [tab] 400 > > Invalid request > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 401 > > Authentication failed > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 403 > > The authenticated user cannot access this resource or has insufficient credits > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 404 > > The requested resource was not found > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 429 > > Request or quota limit exceeded > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 500 > > Internal or upstream service error > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. ## 3D rendering resources Examples with all resources available, excluding thumbnails. Actual file counts depend on which files have been generated. | Model type | `model_urls` | `texture_urls` | Example file count | | - | - | - | - | | Triangle mesh, textured model, or PBR model | `glb` | Omitted; materials and textures load with the GLB | 1 | | Untextured quad mesh | `obj` | Omitted | 1 | | Quad model with ordinary textures | `obj`, `mtl` | `albedo` | 3 | | Quad PBR model | `obj`, `mtl` | `albedo`, `normal`, `roughness`, `metallic` | 6 | Texture filenames must match the references in the MTL. ```json 200 3D generation succeeded theme={null} { "id": "normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "succeeded", "mode": "image_to_3d", "model": "dreamtech/neural4d-2.5", "created_at": 1784044800, "updated_at": 1784044842, "usage": { "credits": 30 }, "output": { "models": [ { "uuid": "72e30159-a242-4491-a67c-2ad0cfc9efb6", "format": "glb", "model_urls": { "glb": "https://s3.neural4d.com/results/model.glb" }, "thumbnail_urls": { "front": "https://s3.neural4d.com/results/t1.png" }, "mesh_quality": "high", "pose": "T-pose", "target_polycount": 1000000, "topology": "triangle", "with_texture": true, "with_pbr": true, "image_enhancement": true, "mode": "image_to_3d", "status": "succeeded", "created_at": 1784044800, "updated_at": 1784044842 } ] } } ``` ```json 200 Quad PBR generation succeeded theme={null} { "id": "normal-3d-d60fe63e-699d-4d61-93f5-2099ab159d6d", "status": "succeeded", "mode": "image_to_3d", "model": "dreamtech/neural4d-2.5", "created_at": 1784044800, "updated_at": 1784044842, "usage": { "credits": 30 }, "output": { "models": [ { "uuid": "83f41260-b353-45a2-92c8-3be1dfe0a067", "format": "obj", "model_urls": { "obj": "https://s3.neural4d.com/results/quad/model.obj", "mtl": "https://s3.neural4d.com/results/quad/model.mtl" }, "thumbnail_urls": { "front": "https://s3.neural4d.com/results/quad/front.png" }, "texture_urls": { "albedo": "https://s3.neural4d.com/results/quad/albedo.png", "normal": "https://s3.neural4d.com/results/quad/normal.png", "roughness": "https://s3.neural4d.com/results/quad/roughness.png", "metallic": "https://s3.neural4d.com/results/quad/metallic.png" }, "mesh_quality": "standard", "pose": "auto", "target_polycount": 50000, "topology": "quad", "with_texture": true, "with_pbr": true, "image_enhancement": true, "mode": "image_to_3d", "status": "succeeded", "created_at": 1784044800, "updated_at": 1784044842 } ] } } ``` ```json 200 Image generation succeeded theme={null} { "id": "normal-image-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "succeeded", "mode": "image_to_image", "model": "openai/gpt-image-2", "created_at": 1784044800, "updated_at": 1784044842, "usage": { "credits": 13 }, "output": { "images": [ { "uuid": "c6f5dc4e-61ac-4694-9a8b-6a95f3ac4457", "url": "https://s3.neural4d.com/results/image.png", "format": "png", "resolution": "2K", "aspect_ratio": "1:1", "mode": "image_to_image", "status": "succeeded", "created_at": 1784044800, "updated_at": 1784044842 } ] } } ``` ```json 200 Video generation succeeded theme={null} { "id": "normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "succeeded", "mode": "first_frame_image_to_video", "model": "bytedance/seedance-2.0-fast", "created_at": 1784044800, "updated_at": 1784044842, "usage": { "credits": 26 }, "output": { "videos": [ { "uuid": "7d1fa4bb-41e6-4a5d-88d8-1851f5342e87", "url": "https://s3.neural4d.com/results/video.mp4", "last_frame_url": "https://s3.neural4d.com/results/video-last-frame.jpg?signature=example", "format": "mp4", "duration": 5, "resolution": "720p", "aspect_ratio": "16:9", "has_audio": true, "mode": "first_frame_image_to_video", "status": "succeeded", "created_at": 1784044800, "updated_at": 1784044842 } ] } } ``` ```json 400 invalid_prompt theme={null} { "error": { "code": "invalid_prompt", "message": "prompt is required and must be a non-empty string" } } ``` ```json 400 unsupported_model theme={null} { "error": { "code": "unsupported_model", "message": "Unsupported modelKey: missing-model" } } ``` ```json 400 model_unavailable theme={null} { "error": { "code": "model_unavailable", "message": "Model is unavailable: veo-3.1" } } ``` ```json 401 Example theme={null} { "error": { "code": "invalid_api_key", "message": "The API key is invalid or expired" } } ``` ```json 403 Example theme={null} { "error": { "code": "insufficient_credits", "message": "Insufficient credits for video generation" } } ``` ```json 404 Example theme={null} { "error": { "code": "task_not_found", "message": "The requested task does not exist" } } ``` ```json 429 Example theme={null} { "error": { "code": "rate_limit_exceeded", "message": "Too many requests. Retry after the indicated interval." } } ``` ```json 500 Example theme={null} { "error": { "code": "internal_error", "message": "An internal error occurred" } } ``` # Create video generation tasks Source: https://docs.neural4d.com/en/v1-api-reference/video-generation/create-video-generation-tasks POST https://api.neural4d.com/openapi/v1/videos/generations Creates asynchronous video generation tasks from a prompt and optional frame or reference assets supplied by file ID or HTTPS URL. ## Authorizations **Authorization** `string` *required* (default: Bearer \$\{YOUR\_API\_KEY}) Neural4D API key using the Bearer scheme. ## Body application/json With no references, the request uses text-to-video. With only `frame_images`, it uses first-frame or first-and-last-frame generation. Adding `input_references` selects reference-to-video. The model must support the selected mode. Omitted optional parameters use the selected model's current defaults. Each first frame, last frame, and reference image must be at most 10 MiB, whether supplied by `file_id` or `url`. > [tab] seedance-2.0 > > **model** `enum\` *required* > > Seedance 2.0 model. > > Available options: `bytedance/seedance-2.0`. > > **prompt** `string` *required* > > Required text instruction describing the video to generate. > > Required string length: `1 - 1000`. > > **output\_with\_audio** `boolean` (default: true) > > Whether to generate native audio with the video. > > **resolution** `enum\` (default: 720p) > > Available options: `480p`, `720p`, `1080p`, `4K`. > > **aspect\_ratio** `enum\` (default: 16:9) > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. > > **duration** `enum\` (default: 5) > > Duration in seconds. > > Available options: `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`. > > **return\_last\_frame** `boolean` (default: false) > > Return an image of the generated video's final frame. > > When enabled, get the image URL from `output.videos[].last_frame_url` in [Retrieve a task](/en/v1-api-reference/tasks/retrieve-a-task). > > **input\_with\_person** `boolean` (default: false) > > Enable person references for `frame_images` and `input_references`. Generated videos are private by default when enabled. Processing time may increase; enable it only when person references are needed. > > Provide at least one non-empty array: `frame_images` or `input_references`. Does not support copyrighted faces that require verification. > [tab] seedance-2.0-fast > > **model** `enum\` *required* > > Seedance 2.0 Fast model. > > Available options: `bytedance/seedance-2.0-fast`. > > **prompt** `string` *required* > > Required text instruction describing the video to generate. > > Required string length: `1 - 1000`. > > **output\_with\_audio** `boolean` (default: true) > > Whether to generate native audio with the video. > > **resolution** `enum\` (default: 720p) > > Available options: `480p`, `720p`. > > **aspect\_ratio** `enum\` (default: 16:9) > > Available options: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. > > **duration** `enum\` (default: 5) > > Duration in seconds. > > Available options: `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`. > > **return\_last\_frame** `boolean` (default: false) > > Return an image of the generated video's final frame. > > When enabled, get the image URL from `output.videos[].last_frame_url` in [Retrieve a task](/en/v1-api-reference/tasks/retrieve-a-task). > > **input\_with\_person** `boolean` (default: false) > > Enable person references for `frame_images` and `input_references`. Generated videos are private by default when enabled. Processing time may increase; enable it only when person references are needed. > > Provide at least one non-empty array: `frame_images` or `input_references`. Does not support copyrighted faces that require verification. > [tab] veo-3.1 > > **model** `enum\` *required* > > Veo 3.1 model. > > Available options: `google/veo-3.1`. > > **prompt** `string` *required* > > Required text instruction describing the video to generate. > > Required string length: `1 - 1000`. > > **output\_with\_audio** `boolean` (default: true) > > Whether to generate native audio with the video. > > **resolution** `enum\` (default: 720p) > > Available options: `720p`, `1080p`, `4K`. > > **aspect\_ratio** `enum\` (default: 16:9) > > Available options: `16:9`, `9:16`. > > **duration** `enum\` (default: 8) > > Duration in seconds. > > Available options: `4`, `5`, `6`, `7`, `8`. > [tab] kling-3.0 > > **model** `enum\` *required* > > Kling 3.0 model. > > Available option: `kuaishou/kling-3.0`. > > Supports text-to-video and first-frame image-to-video. For image input, provide one item with `type: "image"` and `frame_type: "first_frame"` in `frame_images`. Last-frame images and `input_references` return `unsupported_input_mode`. > > **prompt** `string` *required* > > Required text instruction describing the video to generate. > > Required string length: `1 - 1000`. > > **output\_with\_audio** `boolean` (default: false) > > Whether to generate native audio. Enabling audio may affect the credits charged, which are returned in `usage.credits`. > > **resolution** `enum\` (default: 720p) > > Available options: `720p`, `1080p`, `4K`. > > **aspect\_ratio** `enum\` (default: 16:9) > > Available options: `16:9`, `9:16`. > > **duration** `integer` (default: 10) > > Duration in seconds. > > Required range: `3 <= x <= 15`, in whole seconds. > [tab] grok-imagine > > **model** `enum\` *required* > > Grok Imagine model. > > Available options: `xai/grok-imagine`. > > **prompt** `string` *required* > > Required text instruction describing the video to generate. > > Required string length: `1 - 1000`. > > **resolution** `enum\` (default: 720p) > > Available options: `480p`, `720p`. > > **aspect\_ratio** `enum\` (default: 16:9) > > Available options: `1:1`, `16:9`, `9:16`, `2:3`, `3:2`. > > **duration** `enum\` (default: 6) > > Duration in seconds. > > Available options: `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `24`, `25`, `26`, `27`, `28`, `29`, `30`. **n** `integer` (default: 1) Number of video generation tasks to create. Required range: `1 <= x <= 4`. **frame\_images** `object[]` First-frame and last-frame images supplied by `file_id` or `url`. Supported formats are JPG, JPEG, PNG, and WEBP, with a maximum of 10 MiB per image. Images must pass content moderation. Each `frame_type` may appear at most once; `last_frame` requires `first_frame`. Allowed array length: `1 - 2` elements when provided. Provide exactly one of `file_id` or `url` per item. **Child attributes** **frame\_type** `enum\` *required* Position represented by the image. Available options: `first_frame`, `last_frame`. **file\_id** `string\` File ID returned by `POST /openapi/v1/files` for an image owned by your account. Required when `url` is omitted; do not send both. Example: `"550e8400-e29b-41d4-a716-446655440000"`. **url** `string\` Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. **input\_references** `object[]` Image, video, and audio references supplied by `file_id` or `url`. Provide exactly one source per item; you can mix sources across items. Audio must be accompanied by at least one image or video, including a frame image. Allowed array length: `1 - 12` elements when provided, subject to the per-type limits. * Images: up to 6 per request, including `frame_images`; JPG/JPEG, PNG, or WEBP; up to 10 MiB per file. Images must pass content moderation. * Videos: up to 4 per request; MP4 or MOV; up to 100 MiB per file by default. * Audio: up to 2 per request; MP3 or WAV; up to 15 MiB per file by default. List reference materials in the order you want to use them. > [tab] Image > > **Child attributes** > > **type** `enum\` *required* > > Image reference. > > Available options: `image`. > > **file\_id** `string\` > > File ID for your uploaded image file. Required when `url` is omitted; do not send both. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > [tab] Video > > **Child attributes** > > **type** `enum\` *required* > > Video reference. > > Available options: `video`. > > **file\_id** `string\` > > File ID for your uploaded video file. Required when `url` is omitted; do not send both. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. > [tab] Audio > > **Child attributes** > > **type** `enum\` *required* > > Audio reference. > > Available options: `audio`. > > **file\_id** `string\` > > File ID for your uploaded audio file. Required when `url` is omitted; do not send both. > > **url** `string\` > > Public HTTPS file URL on port 443, up to 2,048 characters by default. Required when `file_id` is omitted; do not send both. > > The file must be downloadable without cookies or extra authorization headers. Signed URLs are supported; keep them valid during download. Do not include a username, password, or `#...`. ```bash cURL · text_to_video theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/videos/generations \ --header 'Authorization: Bearer ' \ --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" }' ``` ```python Python · text_to_video theme={null} import requests response = requests.request( "POST", "https://api.neural4d.com/openapi/v1/videos/generations", headers={ "Authorization": "Bearer ", "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()) ``` ```javascript JavaScript · text_to_video theme={null} const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```typescript TypeScript · text_to_video theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```java Java · text_to_video theme={null} 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 ") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · text_to_video theme={null} 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 ") 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)) } ``` ```ruby Ruby · text_to_video theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/videos/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " 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 PHP · text_to_video theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · text_to_video theme={null} 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 "); 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()); ``` ```bash cURL · first_frame_image_to_video theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/videos/generations \ --header 'Authorization: Bearer ' \ --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 }' ``` ```python Python · first_frame_image_to_video theme={null} import requests response = requests.request( "POST", "https://api.neural4d.com/openapi/v1/videos/generations", headers={ "Authorization": "Bearer ", "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()) ``` ```javascript JavaScript · first_frame_image_to_video theme={null} const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```typescript TypeScript · first_frame_image_to_video theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```java Java · first_frame_image_to_video theme={null} 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 ") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · first_frame_image_to_video theme={null} 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 ") 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)) } ``` ```ruby Ruby · first_frame_image_to_video theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/videos/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " 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 PHP · first_frame_image_to_video theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · first_frame_image_to_video theme={null} 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 "); 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()); ``` ```bash cURL · first_last_frame_image_to_video theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/videos/generations \ --header 'Authorization: Bearer ' \ --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 }' ``` ```python Python · first_last_frame_image_to_video theme={null} import requests response = requests.request( "POST", "https://api.neural4d.com/openapi/v1/videos/generations", headers={ "Authorization": "Bearer ", "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()) ``` ```javascript JavaScript · first_last_frame_image_to_video theme={null} const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```typescript TypeScript · first_last_frame_image_to_video theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```java Java · first_last_frame_image_to_video theme={null} 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 ") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · first_last_frame_image_to_video theme={null} 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 ") 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)) } ``` ```ruby Ruby · first_last_frame_image_to_video theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/videos/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " 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 PHP · first_last_frame_image_to_video theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · first_last_frame_image_to_video theme={null} 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 "); 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()); ``` ```bash cURL · reference_to_video theme={null} curl --request POST \ --url https://api.neural4d.com/openapi/v1/videos/generations \ --header 'Authorization: Bearer ' \ --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 }' ``` ```python Python · reference_to_video theme={null} import requests response = requests.request( "POST", "https://api.neural4d.com/openapi/v1/videos/generations", headers={ "Authorization": "Bearer ", "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()) ``` ```javascript JavaScript · reference_to_video theme={null} const response = await fetch("https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```typescript TypeScript · reference_to_video theme={null} const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/videos/generations", { method: "POST", headers: { "Authorization": "Bearer ", "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); ``` ```java Java · reference_to_video theme={null} 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 ") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); ``` ```go Go · reference_to_video theme={null} 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 ") 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)) } ``` ```ruby Ruby · reference_to_video theme={null} require "net/http" require "json" uri = URI("https://api.neural4d.com/openapi/v1/videos/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer " 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 PHP · reference_to_video theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer ", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# · reference_to_video theme={null} 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 "); 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()); ``` ## Response Identify errors by `error.code`, not by matching message text. > [tab] 202 > > Generation tasks accepted > > **id** `string` *required* > > Batch task ID returned by the generation request. > > Example: `"normal-video-c50fe63e-699d-4d61-93f5-2099ab159d6d"`. > > **data** `object[]` *required* > > Generated child items created by the request. > > Allowed array length: `1 - unbounded` elements. > > **child attributes** > > **uuid** `string\` *required* > > Generated child item UUID. > > **status** `enum\` *required* > > Normalized task lifecycle status. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds. > > **updated\_at** `integer\` > > Unix timestamp in seconds. > > **usage** `object` > > Credits charged for this task when available. > > **child attributes** > > **credits** `number\` *required* > > Credits charged for the task or submission. > > Required range: `0 <= x <= infinity`. > > Example: `26`. > > **error** `object` > > Error details when the task fails. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable task failure code. > > **message** `string` *required* > > Human-readable explanation of the task failure. > > **failed\_at** `integer\` > > Unix timestamp in seconds when the task failed. > > **retryable** `boolean` > > Whether retrying the same operation may succeed. > > **status** `enum\` *required* > > Current status shared by the submitted video tasks. > > Available options: `queued`, `processing`, `succeeded`, `failed`. > > **created\_at** `integer\` *required* > > Unix timestamp in seconds when the batch task was created. > > **mode** `enum\` *required* > > Video generation mode shared by the submitted tasks. > > Available options: `text_to_video`, `first_frame_image_to_video`, `first_last_frame_image_to_video`, `reference_to_video`. > > **model** `enum\` *required* > > Video generation model used by the submitted tasks. > > Available options: `bytedance/seedance-2.0`, `bytedance/seedance-2.0-fast`, `google/veo-3.1`, `xai/grok-imagine`, `kuaishou/kling-3.0`. > > **usage** `object` > > Total credits charged for the submitted tasks when available. > > **child attributes** > > **credits** `number\` *required* > > Credits charged for the task or submission. > > Required range: `0 <= x <= infinity`. > > Example: `26`. > [tab] 400 > > Invalid request > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > URL reference errors: > > * `invalid_reference_source`: Provide exactly one of `file_id` or `url` per reference. > * `invalid_reference_url`: The URL format or length is invalid. > * `unsafe_reference_url`: The URL or redirect destination is not allowed. Use a public file URL that meets the requirements above. > * `file_rejected`: The image failed content moderation. Use another image. > > Person-reference errors: > > * `unsupported_person_reference`: The selected model or route does not support `input_with_person: true`. > * `invalid_input_references`: Person references are enabled but neither `frame_images` nor `input_references` is provided. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 401 > > Authentication failed > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 403 > > The authenticated user cannot access this resource or has insufficient credits > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 408 > > Reference download timed out > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `reference_fetch_timeout`: The download timed out. Check the source server and retry. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 413 > > Reference file too large > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `reference_too_large`: The file exceeds its size limit: 10 MiB per image, or the default limits of 100 MiB per video and 15 MiB per audio file. File IDs and URLs use the same limits. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 415 > > Invalid or unsupported reference file > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `invalid_reference_file`: The file is empty or its content cannot be inspected. > * `invalid_reference_file_type`: The format is unsupported or does not match the reference type or response `Content-Type`. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 422 > > Reference download failed > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `reference_fetch_failed`: The file cannot be downloaded. Check that the URL is valid and publicly accessible. > * `reference_redirect_limit`: Too many redirects. Use a direct file URL. > > **message** `string` *required* > > Human-readable explanation. Use `error.code` to identify the cause. > [tab] 429 > > Request or quota limit exceeded > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > URL reference errors: > > * `reference_import_busy`: Reference import is busy. Retry after the interval in the `Retry-After` response header. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 500 > > Internal or upstream service error > > When `error.details.submission_accepted` is `true`, your generation task is already queued but a later operation failed. > `error.details.task` retains the task ID, UUIDs, and known credit usage. `retryable` is `false`; do not resubmit the generation request, as doing so can charge you again. > If registration succeeded, you can query the task by its ID. If `error.details.registration_failed` is `true`, the error code is `task_registration_failed` and task lookup may return `404` until registration is repaired. > When `error.details.submission_uncertain` is `true`, the response retains the attempted task ID; check the original submission before resubmitting. Credit usage is omitted when the final charge is unknown. > > **error** `object` *required* > > Structured error details. > > **child attributes** > > **code** `string` *required* > > Stable machine-readable error code. > > Example: `"invalid_prompt"`. > > **message** `string` *required* > > Human-readable explanation of the error. > > Example: `"prompt is required and must be a non-empty string"`. > > **doc\_url** `string\ | null` > > Optional documentation URL with more information about the error. > > Example: `"https://api.neural4d.com/docs/errors#invalid_prompt"`. > [tab] 503 > > Image moderation unavailable > > **error** `object` *required* > > Structured error details. > > **Child attributes** > > **code** `string` *required* > > * `file_moderation_unavailable`: Image moderation is temporarily unavailable. Retry later. > > **message** `string` *required* > > Always returns `An internal error occurred`. ```json 202 Example theme={null} { "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 } } ``` ```json 400 invalid_prompt theme={null} { "error": { "code": "invalid_prompt", "message": "prompt is required and must be a non-empty string" } } ``` ```json 400 unsupported_model theme={null} { "error": { "code": "unsupported_model", "message": "Unsupported modelKey: missing-model" } } ``` ```json 400 model_unavailable theme={null} { "error": { "code": "model_unavailable", "message": "Model is unavailable: veo-3.1" } } ``` ```json 401 Example theme={null} { "error": { "code": "invalid_api_key", "message": "The API key is invalid or expired" } } ``` ```json 403 Example theme={null} { "error": { "code": "insufficient_credits", "message": "Insufficient credits for video generation" } } ``` ```json 413 Reference file too large theme={null} { "error": { "code": "reference_too_large", "message": "Reference file must not exceed 10 MB" } } ``` ```json 429 Example theme={null} { "error": { "code": "rate_limit_exceeded", "message": "Too many requests. Retry after the indicated interval." } } ``` ```json 500 Example theme={null} { "error": { "code": "internal_error", "message": "An internal error occurred" } } ``` # Quickstart Source: https://docs.neural4d.com/en/v1-overview Generate a 3D model with PBR materials from a text prompt, then retrieve and download the result. The API v1 base URL is `https://api.neural4d.com/openapi/v1`. This guide uses text-to-3D to show the core workflow. ## 1. Set your API key Use an account with an active paid subscription to get your key from the [API key page](https://www.neural4d.com/account?api). ```bash Configure your API key theme={null} export YOUR_API_KEY='your-api-key' ``` ## 2. Create a 3D generation task Submit a prompt to generate a 3D model with PBR materials. Set both `with_texture: true` and `with_pbr: true`. Send your key in the `Authorization: Bearer` header with every request. ```bash cURL theme={null} curl --request POST \ --url 'https://api.neural4d.com/openapi/v1/3dmodels/generations' \ --header "Authorization: Bearer ${YOUR_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "with_texture": true, "with_pbr": true }' ``` ```python Python theme={null} import os import requests api_key = os.environ["YOUR_API_KEY"] response = requests.post( "https://api.neural4d.com/openapi/v1/3dmodels/generations", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json={ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "with_texture": True, "with_pbr": True } ) print(response.json()) ``` ```javascript JavaScript theme={null} const apiKey = process.env.YOUR_API_KEY; const response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "with_texture": true, "with_pbr": true }) } ); console.log(await response.json()); ``` ```typescript TypeScript theme={null} const apiKey = process.env.YOUR_API_KEY; const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/3dmodels/generations", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" }, body: JSON.stringify({ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "with_texture": true, "with_pbr": true }) } ); console.log(await response.json()); ``` ```java Java theme={null} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; class Main { public static void main(String[] args) throws Exception { String apiKey = System.getenv("YOUR_API_KEY"); String payload = String.join("\n", "{", " \"model\": \"dreamtech/neural4d-2.5\",", " \"prompt\": \"A ceramic teapot on a white studio background\",", " \"with_texture\": true,", " \"with_pbr\": true", "}" ); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/3dmodels/generations")) .header("Authorization", "Bearer " + apiKey) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); } } ``` ```go Go theme={null} package main import ( "fmt" "io" "log" "net/http" "os" "strings" ) func main() { if err := run(); err != nil { log.Fatal(err) } } func run() error { payload := strings.NewReader(`{ "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "with_texture": true, "with_pbr": true }`) request, err := http.NewRequest( "POST", "https://api.neural4d.com/openapi/v1/3dmodels/generations", payload, ) if err != nil { return err } request.Header.Set("Authorization", "Bearer "+os.Getenv("YOUR_API_KEY")) request.Header.Set("Content-Type", "application/json") response, err := http.DefaultClient.Do(request) if err != nil { return err } defer response.Body.Close() result, err := io.ReadAll(response.Body) if err != nil { return err } fmt.Println(string(result)) return nil } ``` ```ruby Ruby theme={null} require "net/http" require "json" api_key = ENV.fetch("YOUR_API_KEY") uri = URI("https://api.neural4d.com/openapi/v1/3dmodels/generations") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{api_key}" request["Content-Type"] = "application/json" request.body = { "model": "dreamtech/neural4d-2.5", "prompt": "A ceramic teapot on a white studio background", "with_texture": true, "with_pbr": 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 PHP theme={null} "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer {$apiKey}", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => $payload, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# theme={null} using System; using System.Net.Http; using System.Text; var apiKey = Environment.GetEnvironmentVariable("YOUR_API_KEY"); var payload = @"{ ""model"": ""dreamtech/neural4d-2.5"", ""prompt"": ""A ceramic teapot on a white studio background"", ""with_texture"": true, ""with_pbr"": true }"; using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Post, "https://api.neural4d.com/openapi/v1/3dmodels/generations" ); request.Headers.TryAddWithoutValidation( "Authorization", "Bearer " + apiKey ); request.Content = new StringContent( payload, Encoding.UTF8, "application/json" ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` The API returns `202 Accepted`. Save the task `id` for the next step. Responses below illustrate the structure; use the actual IDs, asset URLs, and `usage.credits` returned by the API. ```json 202 Accepted theme={null} { "id": "normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "queued", "created_at": 1784044800, "mode": "text_to_3d", "model": "dreamtech/neural4d-2.5", "data": [ { "uuid": "72e30159-a242-4491-a67c-2ad0cfc9efb6", "status": "queued", "created_at": 1784044800 } ], "usage": { "credits": 30 } } ``` ## 3. Retrieve and download the result Replace the sample `id` with the value returned when you created the task, then query every few seconds. `queued` and `processing` mean the task is still running. Stop at `succeeded` or `failed`; check `error` if it failed. ```bash cURL theme={null} curl --request GET \ --url 'https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d' \ --header "Authorization: Bearer ${YOUR_API_KEY}" ``` ```python Python theme={null} import os import requests api_key = os.environ["YOUR_API_KEY"] response = requests.get( "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", headers={ "Authorization": f"Bearer {api_key}" } ) print(response.json()) ``` ```javascript JavaScript theme={null} const apiKey = process.env.YOUR_API_KEY; const response = await fetch( "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", { method: "GET", headers: { "Authorization": `Bearer ${apiKey}` } } ); console.log(await response.json()); ``` ```typescript TypeScript theme={null} const apiKey = process.env.YOUR_API_KEY; const response: Response = await fetch( "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", { method: "GET", headers: { "Authorization": `Bearer ${apiKey}` } } ); console.log(await response.json()); ``` ```java Java theme={null} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; class Main { public static void main(String[] args) throws Exception { String apiKey = System.getenv("YOUR_API_KEY"); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d")) .header("Authorization", "Bearer " + apiKey) .GET() .build(); HttpResponse response = HttpClient.newHttpClient().send( request, HttpResponse.BodyHandlers.ofString() ); System.out.println(response.body()); } } ``` ```go Go theme={null} package main import ( "fmt" "io" "log" "net/http" "os" ) func main() { if err := run(); err != nil { log.Fatal(err) } } func run() error { request, err := http.NewRequest( "GET", "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", nil, ) if err != nil { return err } request.Header.Set("Authorization", "Bearer "+os.Getenv("YOUR_API_KEY")) response, err := http.DefaultClient.Do(request) if err != nil { return err } defer response.Body.Close() result, err := io.ReadAll(response.Body) if err != nil { return err } fmt.Println(string(result)) return nil } ``` ```ruby Ruby theme={null} require "net/http" require "json" api_key = ENV.fetch("YOUR_API_KEY") uri = URI("https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{api_key}" response = Net::HTTP.start( uri.hostname, uri.port, use_ssl: uri.scheme == "https" ) do |http| http.request(request) end puts response.body ``` ```php PHP theme={null} "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer {$apiKey}", ], ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ```csharp C# theme={null} using System; using System.Net.Http; var apiKey = Environment.GetEnvironmentVariable("YOUR_API_KEY"); using var client = new HttpClient(); using var request = new HttpRequestMessage( HttpMethod.Get, "https://api.neural4d.com/openapi/v1/tasks/task-info?id=normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d" ); request.Headers.TryAddWithoutValidation( "Authorization", "Bearer " + apiKey ); using var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ```json 200 OK theme={null} { "id": "normal-3d-c50fe63e-699d-4d61-93f5-2099ab159d6d", "status": "succeeded", "model": "dreamtech/neural4d-2.5", "created_at": 1784044800, "updated_at": 1784044842, "mode": "text_to_3d", "output": { "models": [ { "uuid": "72e30159-a242-4491-a67c-2ad0cfc9efb6", "format": "glb", "model_urls": { "glb": "https://s3.neural4d.com/results/model.glb" }, "thumbnail_urls": { "front": "https://s3.neural4d.com/results/t1.png" }, "mesh_quality": "standard", "pose": "auto", "target_polycount": 500000, "topology": "triangle", "with_texture": true, "with_pbr": true, "image_enhancement": false, "mode": "text_to_3d", "status": "succeeded", "created_at": 1784044800, "updated_at": 1784044842 } ] }, "usage": { "credits": 30 } } ``` Download the model from `model_urls.glb` and view the thumbnail at `thumbnail_urls.front`. `thumbnail_urls` is `{}` until available. This example generates a triangle-mesh GLB with its PBR materials and textures included in the file. More examples: [3D generation parameters](/en/v1-api-reference/3d-generation/create-3d-generation-tasks) · [Complete task response](/en/v1-api-reference/tasks/retrieve-a-task) · [Upload a reference file](/en/v1-api-reference/files/upload-a-file).