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": "blurred, extra accessories"
}
],
"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": "<string>"
}
'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": "blurred, extra accessories"
}
],
"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": "<string>"
}
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: 'blurred, extra accessories'}
],
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: '<string>'
})
};
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' => 'blurred, extra accessories'
]
],
'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' => '<string>'
]),
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\": \"blurred, extra accessories\"\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\": \"<string>\"\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\": \"blurred, extra accessories\"\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\": \"<string>\"\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\": \"blurred, extra accessories\"\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\": \"<string>\"\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."
}NovelAI Text to Image API Documentation
Use the NovelAI text-to-image API to generate anime-style images from prompts for characters, illustrations, concept art, and creative ideation.
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": "blurred, extra accessories"
}
],
"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": "<string>"
}
'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": "blurred, extra accessories"
}
],
"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": "<string>"
}
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: 'blurred, extra accessories'}
],
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: '<string>'
})
};
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' => 'blurred, extra accessories'
]
],
'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' => '<string>'
]),
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\": \"blurred, extra accessories\"\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\": \"<string>\"\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\": \"blurred, extra accessories\"\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\": \"<string>\"\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\": \"blurred, extra accessories\"\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\": \"<string>\"\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."
}Authorizations
You can obtain your API key from the TTAPI Dashboard.
Body
Image description for generation or modification
Model to use
nai-diffusion-4-5-full, nai-diffusion-4-5-curated Number of images to generate 1 - 4
Image width
Image height
Seed
Number of sampling steps
A lower guidance scale produces softer, more painterly results. A higher guidance scale produces finer details and sharper effects.
Unwanted content
Quality toggle
Sampler
Euler Ancestral, Euler, DPM++ 2S Ancestral, DPM++ 2M SDE, DPM++ 2M, DPM++ SDE Noise schedule
karras, exponential, polyexponential Character list
Show child attributes
Show child attributes
Atmosphere transfer reference
Show child attributes
Show child attributes
Precise reference
Show child attributes
Show child attributes
Callback URL. The task completion or failure will be sent to this URL. The data structure is consistent with the fetch structure [blocked]. If not set, you need to call the fetch API [blocked] to query.