API Documentation / Text To Image

Text-to-Image

Overview

The Text to Image API is a service that generates high-quality images based on text prompts. AI creates images according to text descriptions provided by users. This service supports API key authentication, rate limiting, and usage-based billing through a stardust token system. Currently, it provides basic image generation capabilities, with plans to add more diverse and customized image generation features using the illustrious model and LoRA (Low-Rank Adaptation) technology in the future.

Generate an image from text

This API endpoint generates images from text. It creates images based on user-provided prompts, negative prompts, and various generation parameters. Users can configure numerous detailed settings including image resolution, generation steps, CFG scale, seed value, and sampler options. After image generation, stardust tokens are deducted, and the API returns the image along with the amount of tokens used and the remaining token balance. If the token balance is insufficient, an error occurs.

Parameters

This endpoint generates an image based on the input prompt and configuration parameters.

modelId

·

integer

required

Enter the ID of the model to use for image generation. Available model list can be checked with a '/model/list' request.

Example:

1

prompt

·

string

required

Enter the prompt for image generation. The prompt must be between 1 and 3000 characters.

Example:

"masterpiece, extremely aesthetic, newest, very vibrant colors"

negativePrompt

·

string

required

Enter the negative prompt for image generation. The negative prompt must be between 1 and 3000 characters.

Example:

"worst quality, low quality, low details, bad quality, poorly drawn, bad anatomy, multiple views, bad hands, blurry, artist sign, weibo username"

height

·

integer

required

Enter the height of the image to be generated. The height must be between 256 and 2880 pixels.

Example:

512

width

·

integer

required

Enter the width of the image to be generated. The width must be between 256 and 2880 pixels.

Example:

512

steps

·

integer

required

Enter the number of steps for image generation. The steps must be between 16 and 50.

Example:

28

cfgScale

·

integer

required

Enter the cfgScale for image generation. The cfgScale must be a number between 1.0 and 15.0, in steps of 0.1.

Example:

7.5

seed

·

integer

required

Enter the seed for image generation. The seed must be a number between -1 and 4,294,967,295. If you enter -1, a random seed will be used.

Example:

-1

samplerName

·

string

required

Enter the sampler name for image generation. Must be one of:
'euler'
'euler_cfg_pp'
'euler_ancestral'
'euler_ancestral_cfg_pp'
'dpm_2'
'dpm_2_ancestral'
'dpmpp_2s_ancestral'
'dpmpp_2s_ancestral_cfg_pp'.

Example:

"euler_ancestral"

scheduler

·

string

required

Enter the scheduler type for image generation. Must be one of:
'normal'
'karras'
'exponential'
'sgm_uniform'
'simple'
'ddim_uniform'
'beta'.

Example:

"normal"

Rate Limit

The Text to Image API implements rate limiting to prevent excessive requests. In cases of abuse such as sudden high volume of requests, continuous automated repetitive requests, etc., action may be taken without warning.

Status Codes

All API queries return HTTP status codes that can tell you more about the response.

201 Created

The request was successful.

400 Bad Request

The request was invalid or cannot be otherwise served. An accompanying error message will explain further.

429 Too Many Requests

The request was rate limited. Please try again later.

404 Not Found

The requested resource was not found.

500 Internal Server Error

The server encountered an error. Please try again later or contact support.

Post

/text-to-image/generate

Copied!
1
Content-Type: application/json
x-illustrious-api-key: YOUR_API_KEY

{
  “modelId”: : 5,
  “steps”: 28,
  “width”: 768,
  “height”: 768,
  “prompt”: A vibrant girl with long, flowing pastel pink hair and sparkling violet eyes, seen from the waist up. She smiles gently with a soft blush, raising one hand in a playful wave. Her outfit is a detailed cropped jacket with metallic accents, paired with a layered lace corset and choker adorned with a glowing crystal pendant. Her hair is styled in loose twin tails with butterfly clips and ribbon strands. Behind her, soft bokeh lights and luminous clouds create a dreamy sunset atmosphere. Petals and sparkles drift in the air. Her expression is warm and inviting, full of charm and softness, as if she’s about to speak directly to the viewer.,
  “negative_prompt”: worst quality, low quality, lowers, low details, bad quality, poorly drawn, bad anatomy, multiple views, bad hands, blurry, artist sign, weibo username,
  “cfgScale”: 7.4,
  “seed”: -1,
  “samplerName”: “euler”,
  “scheduler”: “normal”,
}

Response

Copied!
1
{
  “images”: [...base64String],
  “stardustUsage”: “3”,
  “stardustBalance”: “98949385”
}

by Onoma AI

Address : 201, 2F, D-dong, 47, Maeheon-ro 8-gil, Seocho-gu, Seoul, 06770, Rep. of KOREA

Business Registration Certificate : 450-86-02454

CEO : Min Song

Contact : illustrious@onomaai.com