Z Image Turbo 图像生成
curl --request POST \
--url https://api.highwayapi.ai/v3/async/z-image-turbo \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"mask": "<string>",
"seed": 123,
"size": "<string>",
"prompt": "<string>",
"strength": 123,
"image_url": "<string>",
"output_format": "<string>",
"enable_base64_output": true
}
'import requests
url = "https://api.highwayapi.ai/v3/async/z-image-turbo"
payload = {
"mask": "<string>",
"seed": 123,
"size": "<string>",
"prompt": "<string>",
"strength": 123,
"image_url": "<string>",
"output_format": "<string>",
"enable_base64_output": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
mask: '<string>',
seed: 123,
size: '<string>',
prompt: '<string>',
strength: 123,
image_url: '<string>',
output_format: '<string>',
enable_base64_output: true
})
};
fetch('https://api.highwayapi.ai/v3/async/z-image-turbo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/v3/async/z-image-turbo",
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([
'mask' => '<string>',
'seed' => 123,
'size' => '<string>',
'prompt' => '<string>',
'strength' => 123,
'image_url' => '<string>',
'output_format' => '<string>',
'enable_base64_output' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/async/z-image-turbo"
payload := strings.NewReader("{\n \"mask\": \"<string>\",\n \"seed\": 123,\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"strength\": 123,\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"enable_base64_output\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.highwayapi.ai/v3/async/z-image-turbo")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"mask\": \"<string>\",\n \"seed\": 123,\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"strength\": 123,\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"enable_base64_output\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/z-image-turbo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"mask\": \"<string>\",\n \"seed\": 123,\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"strength\": 123,\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"enable_base64_output\": true\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}图像
Z Image Turbo 图像生成
POST
/
v3
/
async
/
z-image-turbo
Z Image Turbo 图像生成
curl --request POST \
--url https://api.highwayapi.ai/v3/async/z-image-turbo \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"mask": "<string>",
"seed": 123,
"size": "<string>",
"prompt": "<string>",
"strength": 123,
"image_url": "<string>",
"output_format": "<string>",
"enable_base64_output": true
}
'import requests
url = "https://api.highwayapi.ai/v3/async/z-image-turbo"
payload = {
"mask": "<string>",
"seed": 123,
"size": "<string>",
"prompt": "<string>",
"strength": 123,
"image_url": "<string>",
"output_format": "<string>",
"enable_base64_output": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
mask: '<string>',
seed: 123,
size: '<string>',
prompt: '<string>',
strength: 123,
image_url: '<string>',
output_format: '<string>',
enable_base64_output: true
})
};
fetch('https://api.highwayapi.ai/v3/async/z-image-turbo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/v3/async/z-image-turbo",
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([
'mask' => '<string>',
'seed' => 123,
'size' => '<string>',
'prompt' => '<string>',
'strength' => 123,
'image_url' => '<string>',
'output_format' => '<string>',
'enable_base64_output' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/async/z-image-turbo"
payload := strings.NewReader("{\n \"mask\": \"<string>\",\n \"seed\": 123,\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"strength\": 123,\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"enable_base64_output\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.highwayapi.ai/v3/async/z-image-turbo")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"mask\": \"<string>\",\n \"seed\": 123,\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"strength\": 123,\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"enable_base64_output\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/z-image-turbo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"mask\": \"<string>\",\n \"seed\": 123,\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"strength\": 123,\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"enable_base64_output\": true\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}这是一个异步 API,仅返回异步 task_id。你需要使用 task_id 调用任务结果查询 API 获取生成结果。
这是一个异步API,只会返回异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 来检索生成结果。
请求头
枚举值:
application/jsonBearer 身份验证格式: Bearer {{API 密钥}}。
请求体
局部重绘(inpaint)的蒙版图像 URL。白色区域为重绘区域,黑色区域保持不变。需配合 image_url 使用
生成的随机种子。-1 表示使用随机种子。范围:-1 到 2147483647取值范围:[-1, 2147483647]
生成图像的像素尺寸(宽*高)。每个维度范围为 256 到 1536 像素
生成的正向提示词
图生图(img2img)的变换强度。0.0-0.3 增强模式,0.3-0.6 平衡变换,0.6-0.8 风格转换,0.8-1.0 创意重绘。需配合 image_url 使用取值范围:[0, 1]
图生图(img2img)的参考图像 URL
输出图像的格式。支持 jpeg、png、webp可选值:
jpeg, png, webp如果启用,输出将编码为 BASE64 字符串而不是 URL。此属性仅通过 API 可用
响应信息
使用 task_id 请求 查询任务结果 API 来检索生成的输出。
⌘I