Генерация изображения
Создаёт изображение по текстовому описанию. Чтобы использовать обученное лицо,
передайте character_id персонажа со статусом completed.
Без character_id выполняется обычная генерация по описанию.
curl --request POST \
--url https://api.nixai.ru/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": true,
"response_format": "b64_json"
}
'import requests
url = "https://api.nixai.ru/v1/images/generations"
payload = {
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": True,
"response_format": "b64_json"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'soul-2-1080p',
prompt: 'portrait in soft daylight, city background',
character_id: '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
aspect_ratio: '4:3',
style: 'General',
enhance_prompt: true,
response_format: 'b64_json'
})
};
fetch('https://api.nixai.ru/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.nixai.ru/v1/images/generations';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'soul-2-1080p',
prompt: 'portrait in soft daylight, city background',
character_id: '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
aspect_ratio: '4:3',
style: 'General',
enhance_prompt: true,
response_format: 'b64_json'
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixai.ru/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'soul-2-1080p',
'prompt' => 'portrait in soft daylight, city background',
'character_id' => '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
'aspect_ratio' => '4:3',
'style' => 'General',
'enhance_prompt' => true,
'response_format' => 'b64_json'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nixai.ru/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixai.ru/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixai.ru/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.nixai.ru/v1/images/generations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": true,
"response_format": "b64_json"
}'import Foundation
let parameters = [
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": true,
"response_format": "b64_json"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.nixai.ru/v1/images/generations")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/images/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/images/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'soul-2-1080p',
prompt: 'portrait in soft daylight, city background',
character_id: '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
aspect_ratio: '4:3',
style: 'General',
enhance_prompt: true,
response_format: 'b64_json'
})
};
fetch('https://api.nixai.ru/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/images/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/images/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}")
val request = Request.Builder()
.url("https://api.nixai.ru/v1/images/generations")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falsefalse{
"data": [
{
"url": "https://cdn.nixai.ru/images/db242923.png",
"b64_json": "base64"
}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Field `images` with reference photos is required.",
"code": "invalid_request",
"details": {
"reason": "images_required"
}
},
"request_id": "req_01k42y9m7r7g8f5qv3w6n2c1a0"
}character_id — необязательное поле. Без него выполняется обычная генерация по описанию, с ним лицо берётся из обученного персонажа.
Доступные модели: soul-2-1080p и soul-2-720p.
{
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"response_format": "url"
}
character_id можно использовать в любом количестве генераций. Если персонаж ещё обучается, дождитесь status: completed.Authorizations
Заголовок авторизации вида Bearer <token>, где <token> — ваш API-ключ.
Body
Идентификатор модели генерации изображений Higgsfield Soul 2.
soul-2-1080p, soul-2-720p "soul-2-1080p"
Текстовое описание желаемого изображения.
"portrait in soft daylight, city background"
Необязательный идентификатор обученного персонажа со статусом completed.
"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8"
Соотношение сторон изображения.
9:16, 16:9, 4:3, 3:4, 1:1, 2:3, 3:2 Визуальный стиль генерации. Полный каталог с превью — на странице «Стили генерации».
Y2K studio, Street photography, Editorial street style, Warm ambient, Drain, Neutral pastel film, Digital camera, Old smartphone, General, Asian nostalgia, Flash editorial, Frutiger aero, Muted cool film, Double exposure, Disposable camera, Surreal solarization, Underwater, Siren, Candy pop, Mystique city, Subtle flash, 80s horror, New Indie, Extraterrestrial, Theatrical light, Y2K street, Warm contrast film, Retro BW, Swag era, Nature light, 2000s band, Warm vivid film, BW film "General"
Автоматическое улучшение промпта. При false промпт используется как есть.
Формат результата — ссылка или изображение в base64.
url, b64_json Response
Изображение сгенерировано
Список сгенерированных изображений.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.nixai.ru/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": true,
"response_format": "b64_json"
}
'import requests
url = "https://api.nixai.ru/v1/images/generations"
payload = {
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": True,
"response_format": "b64_json"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'soul-2-1080p',
prompt: 'portrait in soft daylight, city background',
character_id: '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
aspect_ratio: '4:3',
style: 'General',
enhance_prompt: true,
response_format: 'b64_json'
})
};
fetch('https://api.nixai.ru/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.nixai.ru/v1/images/generations';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'soul-2-1080p',
prompt: 'portrait in soft daylight, city background',
character_id: '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
aspect_ratio: '4:3',
style: 'General',
enhance_prompt: true,
response_format: 'b64_json'
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixai.ru/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'soul-2-1080p',
'prompt' => 'portrait in soft daylight, city background',
'character_id' => '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
'aspect_ratio' => '4:3',
'style' => 'General',
'enhance_prompt' => true,
'response_format' => 'b64_json'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nixai.ru/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixai.ru/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixai.ru/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.nixai.ru/v1/images/generations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": true,
"response_format": "b64_json"
}'import Foundation
let parameters = [
"model": "soul-2-1080p",
"prompt": "portrait in soft daylight, city background",
"character_id": "3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8",
"aspect_ratio": "4:3",
"style": "General",
"enhance_prompt": true,
"response_format": "b64_json"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.nixai.ru/v1/images/generations")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/images/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.nixai.ru/v1/images/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'soul-2-1080p',
prompt: 'portrait in soft daylight, city background',
character_id: '3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8',
aspect_ratio: '4:3',
style: 'General',
enhance_prompt: true,
response_format: 'b64_json'
})
};
fetch('https://api.nixai.ru/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/images/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.nixai.ru/v1/images/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"model\": \"soul-2-1080p\",\n \"prompt\": \"portrait in soft daylight, city background\",\n \"character_id\": \"3b9c1e2a-2cd3-4b91-a50f-fcc59bde76a8\",\n \"aspect_ratio\": \"4:3\",\n \"style\": \"General\",\n \"enhance_prompt\": true,\n \"response_format\": \"b64_json\"\n}")
val request = Request.Builder()
.url("https://api.nixai.ru/v1/images/generations")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falsefalse{
"data": [
{
"url": "https://cdn.nixai.ru/images/db242923.png",
"b64_json": "base64"
}
]
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Field `images` with reference photos is required.",
"code": "invalid_request",
"details": {
"reason": "images_required"
}
},
"request_id": "req_01k42y9m7r7g8f5qv3w6n2c1a0"
}