Create Image

HTTP request

POST /ai/image_generation

Authorization

Include your ACCESS TOKEN in HTTP Authorization header

Authorization: Bearer Token

Request Parameters

KEY
TYPE
VALUE

prompt

String

A brief description or theme for the image you want to generate. Example: “A beautiful flower”

configs

JSON

This parameter is a JSON object encompassing a variety of settings you can adjust to customize the image generation process. It includes several parameters, which we will describe next, allowing you to control different aspects of the generation.

model

String

Specifies the AI model used for generating the image. Default value is “sdxl-lightning”.

lora

String

Indicates the LoRA (Low-Rank Adaptation) used, which can affect the style or aspects of the generated image. LoRa is not used by default.

width

Integer

The width of the generated image in pixels. This should be a positive integer. Common range: 256 to 1024 pixels. Default value is 1024.

height

Integer

The height the of the generated image in pixels. This should be a positive integer. Common range: 256 to 1024 pixels. Default value is 1024.

steps

Integer

The number of steps the model will take to refine the image. Default value is 8 if using the sdxl-lightning model. For SD-1.5, SDXL models, a good setting is 50.

seed

Integer

An initial seed value for the random number generator used in image generation. Can be initialized with any random integer. Default value is -1.

negative_prompt

String

A description of elements you specifically want to exclude from the image. This helps in refining the output to better match your expectations. Example: "No humans, animals".

negative_prompt is not used by default.

enhance_prompt

Boolean

The model will utilize language modeling to enhance and clarify the initial prompt, potentially leading to more detailed and accurate representations. Default value is False.

User Guide

  1. Craft a Detailed Prompt: Begin by crafting a clear and detailed prompt for the image you have in mind. Incorporate all pertinent details to steer the image generation effectively.

  2. Adjust Configuration Settings: Tailor the configuration settings to your preferences. This involves making choices regarding image resolution (width and height), the level of detail (steps), and the expected processing time, balancing these elements according to your needs.

  3. Experiment with Seeds: Leverage the seed parameter to explore different variations of your image. Altering the seed can yield distinct outcomes based on the same initial prompt, offering a range of possibilities.

  4. Refine Using Negative Prompts: Employ the negative_prompt field to eliminate any elements you do not wish to include in your images. This step helps in fine-tuning the results to more accurately reflect your vision.

  5. Enhance Your Prompt for Better Outcomes: Should the results not meet your expectations, consider activating the enhance_prompt feature. A more elaborate prompt may lead to improved image generation.

Example Request

{
  "prompt": "A serene mountain landscape at sunrise.",
  "configs": {
    "model": "sdxl-lightning",
    "lora": "", 
    "negative_prompt": "No animals worst quality, low quality",
    "enhance_prompt": true,
    "height": 1024,
    "width": 1024,
    "seed": 1000,
    "steps": 8
  }
}

Parrot API

image_task = parrot.create_txt2img(prompt, model, lora, width, height, steps, seed, negative_prompt, enhance_prompt)

Response

Returns the ID of the successful task.

{
  "data": {
    "task_id": "4ab335dd3f0541e2848156f693f499c7",
    "prompt": "the beautiful flower",
    "negative_prompt": "",
    "config": {
      "model": "sdxl-lightning",
      "lora": "",
      "negative_prompt": "",
      "enhance_prompt": false,
      "height": 1024,
      "width": 1024,
      "seed": -1,
      "steps": 8,
      "cfg_scale": 0,
      "task_type": "SDXL_LIGHTNING",
      "queue_name": "sdxl_lightning_queue"
    }
  },
  "errors": [],
  "error_description": "",
  "start_time": "2024-03-02 20:32:13.808794",
  "end_time": "2024-03-02 20:32:13.833927",
  "host_of_client_call_request": "103.186.100.36",
  "total_time_by_second": 0.025145,
  "status": "success"
}

Last updated

Was this helpful?