图片与视频生成
生成图片
通过文本提示词生成图片,并可选上传参考图。单次请求最多可上传 6 张参考图,并提交 1 到 4 个生成任务。
POST
/
api
/
createNormalPicture
curl --request POST \
--url https://alb.neural4d.com:3000/api/createNormalPicture \
--header 'Authorization: Bearer <token>' \
--form 'prompt=a beautiful flower' \
--form 'images=@/path/to/file' \
--form 'images=@/path/to/file' \
--form 'images=@/path/to/file' \
--form 'jobNum=2' \
--form 'modelKey=image-2' \
--form 'aspectRatio=4:3'
import requests
response = requests.request(
"POST",
"https://alb.neural4d.com:3000/api/createNormalPicture",
headers={
"Authorization": "Bearer <token>",
},
files={"images": open('/path/to/file', 'rb'), "images": open('/path/to/file', 'rb'), "images": open('/path/to/file', 'rb')},
)
print(response.json())
const response = await fetch("https://alb.neural4d.com:3000/api/createNormalPicture", {
method: "POST",
headers: {
"Authorization": "Bearer <token>"
},
body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })(),
});
const data = await response.json();
console.log(data);
const response: Response = await fetch("https://alb.neural4d.com:3000/api/createNormalPicture", {
method: "POST",
headers: {
"Authorization": "Bearer <token>"
},
body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })(),
});
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://alb.neural4d.com:3000/api/createNormalPicture"))
.header("Authorization", "Bearer <token>")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
payload := nil
req, _ := http.NewRequest("POST", "https://alb.neural4d.com:3000/api/createNormalPicture", payload)
req.Header.Set("Authorization", "Bearer <token>")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
require "net/http"
require "json"
uri = URI("https://alb.neural4d.com:3000/api/createNormalPicture")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
<?php
$ch = curl_init("https://alb.neural4d.com:3000/api/createNormalPicture");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>"],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://alb.neural4d.com:3000/api/createNormalPicture");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
{
"success": true,
"data": {
"pointsDeducted": 26,
"queueStatus": "queued",
"jobNum": 2,
"uuids": [
"834d7e8c-bd70-48d8-9830-ca1ad9886e33",
"774bd78d-d14f-4531-8972-321086c92edu"
]
}
}
授权
string
默认值:"Bearer ${YOUR_API_KEY}"
必填
使用 Neural4D 网站提供的 Bearer token。
请求体 multipart/form-data
string
必填
描述目标图片内容的文本提示词。
string<binary>[]
用于引导生成的可选参考图。数组长度:
0 - 6 个元素。enum<string>
默认值:"image-2"
图片生成模型标识。可选值:
image-2、nano_banana_pro。enum<string>
默认值:"1:1"
生成图片的目标宽高比。可选值:
1:1、16:9、9:16、4:3、3:4。integer
默认值:1
提交的生成任务数量。取值范围:
1 <= x <= 4。curl --request POST \
--url https://alb.neural4d.com:3000/api/createNormalPicture \
--header 'Authorization: Bearer <token>' \
--form 'prompt=a beautiful flower' \
--form 'images=@/path/to/file' \
--form 'images=@/path/to/file' \
--form 'images=@/path/to/file' \
--form 'jobNum=2' \
--form 'modelKey=image-2' \
--form 'aspectRatio=4:3'
import requests
response = requests.request(
"POST",
"https://alb.neural4d.com:3000/api/createNormalPicture",
headers={
"Authorization": "Bearer <token>",
},
files={"images": open('/path/to/file', 'rb'), "images": open('/path/to/file', 'rb'), "images": open('/path/to/file', 'rb')},
)
print(response.json())
const response = await fetch("https://alb.neural4d.com:3000/api/createNormalPicture", {
method: "POST",
headers: {
"Authorization": "Bearer <token>"
},
body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })(),
});
const data = await response.json();
console.log(data);
const response: Response = await fetch("https://alb.neural4d.com:3000/api/createNormalPicture", {
method: "POST",
headers: {
"Authorization": "Bearer <token>"
},
body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })(),
});
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://alb.neural4d.com:3000/api/createNormalPicture"))
.header("Authorization", "Bearer <token>")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
payload := nil
req, _ := http.NewRequest("POST", "https://alb.neural4d.com:3000/api/createNormalPicture", payload)
req.Header.Set("Authorization", "Bearer <token>")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
require "net/http"
require "json"
uri = URI("https://alb.neural4d.com:3000/api/createNormalPicture")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
<?php
$ch = curl_init("https://alb.neural4d.com:3000/api/createNormalPicture");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>"],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://alb.neural4d.com:3000/api/createNormalPicture");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
响应
- 200
{
"success": true,
"data": {
"pointsDeducted": 26,
"queueStatus": "queued",
"jobNum": 2,
"uuids": [
"834d7e8c-bd70-48d8-9830-ca1ad9886e33",
"774bd78d-d14f-4531-8972-321086c92edu"
]
}
}
⌘I
curl --request POST \
--url https://alb.neural4d.com:3000/api/createNormalPicture \
--header 'Authorization: Bearer <token>' \
--form 'prompt=a beautiful flower' \
--form 'images=@/path/to/file' \
--form 'images=@/path/to/file' \
--form 'images=@/path/to/file' \
--form 'jobNum=2' \
--form 'modelKey=image-2' \
--form 'aspectRatio=4:3'
import requests
response = requests.request(
"POST",
"https://alb.neural4d.com:3000/api/createNormalPicture",
headers={
"Authorization": "Bearer <token>",
},
files={"images": open('/path/to/file', 'rb'), "images": open('/path/to/file', 'rb'), "images": open('/path/to/file', 'rb')},
)
print(response.json())
const response = await fetch("https://alb.neural4d.com:3000/api/createNormalPicture", {
method: "POST",
headers: {
"Authorization": "Bearer <token>"
},
body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })(),
});
const data = await response.json();
console.log(data);
const response: Response = await fetch("https://alb.neural4d.com:3000/api/createNormalPicture", {
method: "POST",
headers: {
"Authorization": "Bearer <token>"
},
body: (() => { const form = new FormData(); form.append("file", fileInput.files[0]); return form; })(),
});
const data = await response.json();
console.log(data);
import java.net.URI;
import java.net.http.*;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://alb.neural4d.com:3000/api/createNormalPicture"))
.header("Authorization", "Bearer <token>")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
payload := nil
req, _ := http.NewRequest("POST", "https://alb.neural4d.com:3000/api/createNormalPicture", payload)
req.Header.Set("Authorization", "Bearer <token>")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bodyBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(bodyBytes))
require "net/http"
require "json"
uri = URI("https://alb.neural4d.com:3000/api/createNormalPicture")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
<?php
$ch = curl_init("https://alb.neural4d.com:3000/api/createNormalPicture");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>"],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://alb.neural4d.com:3000/api/createNormalPicture");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer <token>");
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
{
"success": true,
"data": {
"pointsDeducted": 26,
"queueStatus": "queued",
"jobNum": 2,
"uuids": [
"834d7e8c-bd70-48d8-9830-ca1ad9886e33",
"774bd78d-d14f-4531-8972-321086c92edu"
]
}
}

