cURL
curl --request POST \
--url https://api.ttapi.io/novelai/text-to-image \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model": "nai-diffusion-4-5-curated",
"n": 1,
"width": 1024,
"height": 1024,
"seed": "<string>",
"steps": 23,
"scale": 5,
"negative_prompt": "<string>",
"quality_toggle": true,
"sampler": "Euler Ancestral",
"noise_schedule": "karras",
"character_prompts": [
{
"prompt": "<string>",
"center": {
"x": 0.5,
"y": 0.5
},
"uc": "模糊画质,多余饰品"
}
],
"vibe_transfer": [
{
"image": "https://example.com/ref1.jpg",
"strength": 0.6
}
],
"character_reference": [
{
"image": "https://example.com/ref2.jpg",
"type": "character&style",
"strength": 1,
"fidelity": 0
}
],
"hook_url": "https://example.com/callback"
}
'import requests
url = "https://api.ttapi.io/novelai/text-to-image"
payload = {
"prompt": "<string>",
"model": "nai-diffusion-4-5-curated",
"n": 1,
"width": 1024,
"height": 1024,
"seed": "<string>",
"steps": 23,
"scale": 5,
"negative_prompt": "<string>",
"quality_toggle": True,
"sampler": "Euler Ancestral",
"noise_schedule": "karras",
"character_prompts": [
{
"prompt": "<string>",
"center": {
"x": 0.5,
"y": 0.5
},
"uc": "模糊画质,多余饰品"
}
],
"vibe_transfer": [
{
"image": "https://example.com/ref1.jpg",
"strength": 0.6
}
],
"character_reference": [
{
"image": "https://example.com/ref2.jpg",
"type": "character&style",
"strength": 1,
"fidelity": 0
}
],
"hook_url": "https://example.com/callback"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model: 'nai-diffusion-4-5-curated',
n: 1,
width: 1024,
height: 1024,
seed: '<string>',
steps: 23,
scale: 5,
negative_prompt: '<string>',
quality_toggle: true,
sampler: 'Euler Ancestral',
noise_schedule: 'karras',
character_prompts: [{prompt: '<string>', center: {x: 0.5, y: 0.5}, uc: '模糊画质,多余饰品'}],
vibe_transfer: [{image: 'https://example.com/ref1.jpg', strength: 0.6}],
character_reference: [
{
image: 'https://example.com/ref2.jpg',
type: 'character&style',
strength: 1,
fidelity: 0
}
],
hook_url: 'https://example.com/callback'
})
};
fetch('https://api.ttapi.io/novelai/text-to-image', 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.ttapi.io/novelai/text-to-image",
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' => '<string>',
'model' => 'nai-diffusion-4-5-curated',
'n' => 1,
'width' => 1024,
'height' => 1024,
'seed' => '<string>',
'steps' => 23,
'scale' => 5,
'negative_prompt' => '<string>',
'quality_toggle' => true,
'sampler' => 'Euler Ancestral',
'noise_schedule' => 'karras',
'character_prompts' => [
[
'prompt' => '<string>',
'center' => [
'x' => 0.5,
'y' => 0.5
],
'uc' => '模糊画质,多余饰品'
]
],
'vibe_transfer' => [
[
'image' => 'https://example.com/ref1.jpg',
'strength' => 0.6
]
],
'character_reference' => [
[
'image' => 'https://example.com/ref2.jpg',
'type' => 'character&style',
'strength' => 1,
'fidelity' => 0
]
],
'hook_url' => 'https://example.com/callback'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/novelai/text-to-image"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"nai-diffusion-4-5-curated\",\n \"n\": 1,\n \"width\": 1024,\n \"height\": 1024,\n \"seed\": \"<string>\",\n \"steps\": 23,\n \"scale\": 5,\n \"negative_prompt\": \"<string>\",\n \"quality_toggle\": true,\n \"sampler\": \"Euler Ancestral\",\n \"noise_schedule\": \"karras\",\n \"character_prompts\": [\n {\n \"prompt\": \"<string>\",\n \"center\": {\n \"x\": 0.5,\n \"y\": 0.5\n },\n \"uc\": \"模糊画质,多余饰品\"\n }\n ],\n \"vibe_transfer\": [\n {\n \"image\": \"https://example.com/ref1.jpg\",\n \"strength\": 0.6\n }\n ],\n \"character_reference\": [\n {\n \"image\": \"https://example.com/ref2.jpg\",\n \"type\": \"character&style\",\n \"strength\": 1,\n \"fidelity\": 0\n }\n ],\n \"hook_url\": \"https://example.com/callback\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/novelai/text-to-image")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"nai-diffusion-4-5-curated\",\n \"n\": 1,\n \"width\": 1024,\n \"height\": 1024,\n \"seed\": \"<string>\",\n \"steps\": 23,\n \"scale\": 5,\n \"negative_prompt\": \"<string>\",\n \"quality_toggle\": true,\n \"sampler\": \"Euler Ancestral\",\n \"noise_schedule\": \"karras\",\n \"character_prompts\": [\n {\n \"prompt\": \"<string>\",\n \"center\": {\n \"x\": 0.5,\n \"y\": 0.5\n },\n \"uc\": \"模糊画质,多余饰品\"\n }\n ],\n \"vibe_transfer\": [\n {\n \"image\": \"https://example.com/ref1.jpg\",\n \"strength\": 0.6\n }\n ],\n \"character_reference\": [\n {\n \"image\": \"https://example.com/ref2.jpg\",\n \"type\": \"character&style\",\n \"strength\": 1,\n \"fidelity\": 0\n }\n ],\n \"hook_url\": \"https://example.com/callback\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/novelai/text-to-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"nai-diffusion-4-5-curated\",\n \"n\": 1,\n \"width\": 1024,\n \"height\": 1024,\n \"seed\": \"<string>\",\n \"steps\": 23,\n \"scale\": 5,\n \"negative_prompt\": \"<string>\",\n \"quality_toggle\": true,\n \"sampler\": \"Euler Ancestral\",\n \"noise_schedule\": \"karras\",\n \"character_prompts\": [\n {\n \"prompt\": \"<string>\",\n \"center\": {\n \"x\": 0.5,\n \"y\": 0.5\n },\n \"uc\": \"模糊画质,多余饰品\"\n }\n ],\n \"vibe_transfer\": [\n {\n \"image\": \"https://example.com/ref1.jpg\",\n \"strength\": 0.6\n }\n ],\n \"character_reference\": [\n {\n \"image\": \"https://example.com/ref2.jpg\",\n \"type\": \"character&style\",\n \"strength\": 1,\n \"fidelity\": 0\n }\n ],\n \"hook_url\": \"https://example.com/callback\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Novel AI
NovelAI 文生图 API 文档
通过 NovelAI 文生图 API 根据文本提示生成动漫风格图片,适用于角色设定、插画创作和视觉灵感生成。
POST
/
novelai
/
text-to-image
cURL
curl --request POST \
--url https://api.ttapi.io/novelai/text-to-image \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model": "nai-diffusion-4-5-curated",
"n": 1,
"width": 1024,
"height": 1024,
"seed": "<string>",
"steps": 23,
"scale": 5,
"negative_prompt": "<string>",
"quality_toggle": true,
"sampler": "Euler Ancestral",
"noise_schedule": "karras",
"character_prompts": [
{
"prompt": "<string>",
"center": {
"x": 0.5,
"y": 0.5
},
"uc": "模糊画质,多余饰品"
}
],
"vibe_transfer": [
{
"image": "https://example.com/ref1.jpg",
"strength": 0.6
}
],
"character_reference": [
{
"image": "https://example.com/ref2.jpg",
"type": "character&style",
"strength": 1,
"fidelity": 0
}
],
"hook_url": "https://example.com/callback"
}
'import requests
url = "https://api.ttapi.io/novelai/text-to-image"
payload = {
"prompt": "<string>",
"model": "nai-diffusion-4-5-curated",
"n": 1,
"width": 1024,
"height": 1024,
"seed": "<string>",
"steps": 23,
"scale": 5,
"negative_prompt": "<string>",
"quality_toggle": True,
"sampler": "Euler Ancestral",
"noise_schedule": "karras",
"character_prompts": [
{
"prompt": "<string>",
"center": {
"x": 0.5,
"y": 0.5
},
"uc": "模糊画质,多余饰品"
}
],
"vibe_transfer": [
{
"image": "https://example.com/ref1.jpg",
"strength": 0.6
}
],
"character_reference": [
{
"image": "https://example.com/ref2.jpg",
"type": "character&style",
"strength": 1,
"fidelity": 0
}
],
"hook_url": "https://example.com/callback"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model: 'nai-diffusion-4-5-curated',
n: 1,
width: 1024,
height: 1024,
seed: '<string>',
steps: 23,
scale: 5,
negative_prompt: '<string>',
quality_toggle: true,
sampler: 'Euler Ancestral',
noise_schedule: 'karras',
character_prompts: [{prompt: '<string>', center: {x: 0.5, y: 0.5}, uc: '模糊画质,多余饰品'}],
vibe_transfer: [{image: 'https://example.com/ref1.jpg', strength: 0.6}],
character_reference: [
{
image: 'https://example.com/ref2.jpg',
type: 'character&style',
strength: 1,
fidelity: 0
}
],
hook_url: 'https://example.com/callback'
})
};
fetch('https://api.ttapi.io/novelai/text-to-image', 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.ttapi.io/novelai/text-to-image",
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' => '<string>',
'model' => 'nai-diffusion-4-5-curated',
'n' => 1,
'width' => 1024,
'height' => 1024,
'seed' => '<string>',
'steps' => 23,
'scale' => 5,
'negative_prompt' => '<string>',
'quality_toggle' => true,
'sampler' => 'Euler Ancestral',
'noise_schedule' => 'karras',
'character_prompts' => [
[
'prompt' => '<string>',
'center' => [
'x' => 0.5,
'y' => 0.5
],
'uc' => '模糊画质,多余饰品'
]
],
'vibe_transfer' => [
[
'image' => 'https://example.com/ref1.jpg',
'strength' => 0.6
]
],
'character_reference' => [
[
'image' => 'https://example.com/ref2.jpg',
'type' => 'character&style',
'strength' => 1,
'fidelity' => 0
]
],
'hook_url' => 'https://example.com/callback'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/novelai/text-to-image"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"nai-diffusion-4-5-curated\",\n \"n\": 1,\n \"width\": 1024,\n \"height\": 1024,\n \"seed\": \"<string>\",\n \"steps\": 23,\n \"scale\": 5,\n \"negative_prompt\": \"<string>\",\n \"quality_toggle\": true,\n \"sampler\": \"Euler Ancestral\",\n \"noise_schedule\": \"karras\",\n \"character_prompts\": [\n {\n \"prompt\": \"<string>\",\n \"center\": {\n \"x\": 0.5,\n \"y\": 0.5\n },\n \"uc\": \"模糊画质,多余饰品\"\n }\n ],\n \"vibe_transfer\": [\n {\n \"image\": \"https://example.com/ref1.jpg\",\n \"strength\": 0.6\n }\n ],\n \"character_reference\": [\n {\n \"image\": \"https://example.com/ref2.jpg\",\n \"type\": \"character&style\",\n \"strength\": 1,\n \"fidelity\": 0\n }\n ],\n \"hook_url\": \"https://example.com/callback\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/novelai/text-to-image")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"nai-diffusion-4-5-curated\",\n \"n\": 1,\n \"width\": 1024,\n \"height\": 1024,\n \"seed\": \"<string>\",\n \"steps\": 23,\n \"scale\": 5,\n \"negative_prompt\": \"<string>\",\n \"quality_toggle\": true,\n \"sampler\": \"Euler Ancestral\",\n \"noise_schedule\": \"karras\",\n \"character_prompts\": [\n {\n \"prompt\": \"<string>\",\n \"center\": {\n \"x\": 0.5,\n \"y\": 0.5\n },\n \"uc\": \"模糊画质,多余饰品\"\n }\n ],\n \"vibe_transfer\": [\n {\n \"image\": \"https://example.com/ref1.jpg\",\n \"strength\": 0.6\n }\n ],\n \"character_reference\": [\n {\n \"image\": \"https://example.com/ref2.jpg\",\n \"type\": \"character&style\",\n \"strength\": 1,\n \"fidelity\": 0\n }\n ],\n \"hook_url\": \"https://example.com/callback\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/novelai/text-to-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"nai-diffusion-4-5-curated\",\n \"n\": 1,\n \"width\": 1024,\n \"height\": 1024,\n \"seed\": \"<string>\",\n \"steps\": 23,\n \"scale\": 5,\n \"negative_prompt\": \"<string>\",\n \"quality_toggle\": true,\n \"sampler\": \"Euler Ancestral\",\n \"noise_schedule\": \"karras\",\n \"character_prompts\": [\n {\n \"prompt\": \"<string>\",\n \"center\": {\n \"x\": 0.5,\n \"y\": 0.5\n },\n \"uc\": \"模糊画质,多余饰品\"\n }\n ],\n \"vibe_transfer\": [\n {\n \"image\": \"https://example.com/ref1.jpg\",\n \"strength\": 0.6\n }\n ],\n \"character_reference\": [\n {\n \"image\": \"https://example.com/ref2.jpg\",\n \"type\": \"character&style\",\n \"strength\": 1,\n \"fidelity\": 0\n }\n ],\n \"hook_url\": \"https://example.com/callback\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}专注动漫风格图像生成,支持文生图、草图转正稿、图片重绘等功能。
请求体
application/json
生成图像或修改图像描述词
使用模型
可用选项:
nai-diffusion-4-5-full, nai-diffusion-4-5-curated 生成图片数量 1 - 4
图像宽度
图像高度
种子
采样数
人工智能对提示的响应程度较低的指导值可以产生更具绘画感和柔和的效果,而较高的指导值可以提供更精细的细节和更清晰的效果
不想要的内容
质量开关
采样器
可用选项:
Euler Ancestral, Euler, DPM++ 2S Ancestral, DPM++ 2M SDE, DPM++ 2M, DPM++ SDE 噪声曲线
可用选项:
karras, exponential, polyexponential 角色列表
Show child attributes
Show child attributes
氛围转移参考
Show child attributes
Show child attributes
精确参考
Show child attributes
Show child attributes
回调地址,任务完成或失败将通过请地址进行通知,通知数据结构与fetch结构 [blocked]一致。如果未设置,则需要请求fetch接口 [blocked]进行查询
示例:
"https://example.com/callback"
最后修改于 2026年3月21日
⌘I