Z-Image Turbo Free 图片生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/hf/z-image-turbo \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A beautiful sunset over mountains",
"nsfw_threshold": 0.02,
"num_images": 1,
"resolution": "1024x1024",
"seed": -1
}
'import requests
url = "https://api.sinancode.com/v1/generate/hf/z-image-turbo"
payload = {
"prompt": "A beautiful sunset over mountains",
"nsfw_threshold": 0.02,
"num_images": 1,
"resolution": "1024x1024",
"seed": -1
}
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({
prompt: 'A beautiful sunset over mountains',
nsfw_threshold: 0.02,
num_images: 1,
resolution: '1024x1024',
seed: -1
})
};
fetch('https://api.sinancode.com/v1/generate/hf/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.sinancode.com/v1/generate/hf/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([
'prompt' => 'A beautiful sunset over mountains',
'nsfw_threshold' => 0.02,
'num_images' => 1,
'resolution' => '1024x1024',
'seed' => -1
]),
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.sinancode.com/v1/generate/hf/z-image-turbo"
payload := strings.NewReader("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"nsfw_threshold\": 0.02,\n \"num_images\": 1,\n \"resolution\": \"1024x1024\",\n \"seed\": -1\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.sinancode.com/v1/generate/hf/z-image-turbo")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"nsfw_threshold\": 0.02,\n \"num_images\": 1,\n \"resolution\": \"1024x1024\",\n \"seed\": -1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/hf/z-image-turbo")
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 \"prompt\": \"A beautiful sunset over mountains\",\n \"nsfw_threshold\": 0.02,\n \"num_images\": 1,\n \"resolution\": \"1024x1024\",\n \"seed\": -1\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}图片生成 - Z-Image
Z-Image Turbo Free
使用通义万相 Z-Image Turbo 免费版本生成图片(异步)
POST
/
generate
/
hf
/
z-image-turbo
Z-Image Turbo Free 图片生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/hf/z-image-turbo \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A beautiful sunset over mountains",
"nsfw_threshold": 0.02,
"num_images": 1,
"resolution": "1024x1024",
"seed": -1
}
'import requests
url = "https://api.sinancode.com/v1/generate/hf/z-image-turbo"
payload = {
"prompt": "A beautiful sunset over mountains",
"nsfw_threshold": 0.02,
"num_images": 1,
"resolution": "1024x1024",
"seed": -1
}
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({
prompt: 'A beautiful sunset over mountains',
nsfw_threshold: 0.02,
num_images: 1,
resolution: '1024x1024',
seed: -1
})
};
fetch('https://api.sinancode.com/v1/generate/hf/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.sinancode.com/v1/generate/hf/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([
'prompt' => 'A beautiful sunset over mountains',
'nsfw_threshold' => 0.02,
'num_images' => 1,
'resolution' => '1024x1024',
'seed' => -1
]),
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.sinancode.com/v1/generate/hf/z-image-turbo"
payload := strings.NewReader("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"nsfw_threshold\": 0.02,\n \"num_images\": 1,\n \"resolution\": \"1024x1024\",\n \"seed\": -1\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.sinancode.com/v1/generate/hf/z-image-turbo")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A beautiful sunset over mountains\",\n \"nsfw_threshold\": 0.02,\n \"num_images\": 1,\n \"resolution\": \"1024x1024\",\n \"seed\": -1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/hf/z-image-turbo")
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 \"prompt\": \"A beautiful sunset over mountains\",\n \"nsfw_threshold\": 0.02,\n \"num_images\": 1,\n \"resolution\": \"1024x1024\",\n \"seed\": -1\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}使用阿里云通义万相 Z-Image Turbo 模型免费生成图片。
模型特点:
这是免费版本,功能有限。如需生产环境使用,请考虑付费版 Z-Image Turbo。
- 完全免费 - 无需付费即可生成图片
- 速度快 - 6B 参数蒸馏模型,推理速度快
- 双语文字渲染 - 精准渲染中英文文字,解决乱码、笔画缺失问题
- 多分辨率支持 - 支持多种长宽比(1024x1024、1280x720 等)
授权
请使用您的 API Token 进行认证
请求体
application/json
任务参数
提示词文本(必填)
Minimum string length:
1示例:
"A beautiful sunset over mountains"
NSFW 检测宽松度,值越大越宽松。0.0 最严格,默认 0.02
必填范围:
0 <= x <= 1示例:
0.02
生成图片数量,1-4
必填范围:
1 <= x <= 4示例:
1
分辨率设置(支持 1024/1280/1536 系列)
可用选项:
1024x1024, 1152x896, 896x1152, 1280x720, 720x1280, 1280x1280, 1440x1120, 1536x1024, 1536x864, 1536x1536, 1728x1344, 2048x1152, 1152x2048 示例:
"1024x1024"
随机种子,-1 表示随机
示例:
-1
响应
OK
Task ID
示例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I