Tailored Generation

Generate Image - Tailored model

Description This route allows you to generate images using a Tailored Model. Tailored models are trained on a visual IP (illustrations, photos, vectors) to faithfully reproduce specific IP elements or guidelines. You can train an engine through our Console or implement training on your platform via API.

Overview of Tailored Generation Training API The Tailored Generation Training API provides a set of endpoints to manage the entire lifecycle of a tailored generation project:

  1. Project Management: Create and manage projects which define the IP characteristics:

    • Create and Retrieve Projects: Use the /projects endpoints to create a new project or retrieve existing projects that belong to your organization.
    • Define IP Type: Specify the IP type (e.g., multi_object_set, defined_character, stylized_scene) and medium (currently illustration, with photography coming soon).
    • Manage Project Details: Use the /projects/{id} endpoints to update or delete specific projects.
  2. Dataset Management: Create and manage datasets within your projects. You can:

    • Create and Retrieve Datasets: Use the /datasets endpoints to create new datasets or retrieve existing ones.
    • Upload and Manage Images: Use the /datasets/{dataset_id}/images endpoints to upload images and manage their captions.
    • Clone Datasets: Create variations of existing datasets using the clone functionality.
  3. Model Management: Create and train models based on your datasets:

    • Create and Retrieve Models: Use the /models endpoints to create new models or list existing ones.
    • Choose Training Version: Select between "light" (for fast generation and structure reference compatibility) or "max" (for superior prompt alignment and enhanced learning capabilities).
    • Monitor and Control: Manage the model lifecycle including training start/stop and status monitoring.

Training Process Overview

To train a tailored model:

  1. Create a Project: Use the /projects endpoint to create a project and define your IP type and medium.

  2. Create a Dataset: Use the /datasets endpoint to create a dataset within your project.

  3. Upload Images: Upload images to your dataset using the /datasets/{dataset_id}/images endpoint. Images must be 1024x1024px minimum.

  4. Prepare Dataset: Review auto-generated captions and use the /datasets/{id} endpoint to set status to 'completed'.

  5. Create Model: Use the /models endpoint to create a model, selecting light or max training version.

  6. Start Training: Initiate training using the /models/{id}/start_training endpoint. Training takes 1-3 hours.

  7. Monitor Progress: Check training status using the /models/{id} endpoint until status shows 'Completed'.

  8. Generate Images: Once trained, your model can be used in multiple ways:

  • Use the /text-to-image/tailored/{model_id} endpoint for text-to-image generation
  • Use the /text-to-vector/tailored/{model_id} endpoint for generating illustrative vector graphics
  • Use the /reimagine/tailored/{model_id} endpoint for generating using a structure reference images
  • Access through the Bria platform interface

Alternatively, you can use the Bria platform to manage and train your tailored models through a user-friendly interface. Access the Bria platform here.

Guidance Methods

This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.

ControlNets:

A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.

  • controlnet_canny: Uses edge information from the input image to guide generation based on structural outlines.
  • controlnet_depth: Derives depth information to influence spatial arrangement in the generated image.
  • controlnet_recoloring: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
  • controlnet_color_grid: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.

Using ControlNets
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:

Guidance Method Prompt Scale Input Image Guidance Image Output Image
ControlNet Canny An exotic colorful shell on the beach 1.0 Input Image Guidance Image Output Image
ControlNet Depth A dog, exploring an alien planet 0.8 Input Image Guidance Image Output Image
ControlNet Recoloring A vibrant photo of a woman 1.00 Input Image Guidance Image Output Image
ControlNet Color Grid A dynamic fantasy illustration of an erupting volcano 0.7 Input Image Guidance Image Output Image

To use ControlNets guidance method, include the following parameters in your request:

  • guidance_method_X: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
  • guidance_method_X_scale: Set the impact of the guidance (0.0 to 1.0)
  • guidance_method_X_image_file: Provide the base64-encoded input image

IP_adapter:

Guides the model based on the input image and its associated style. This method offers two modes:

  • regular: Uses the full input image to condition the model, influencing both content and style.
  • style_only: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.

Using IP-Adapter

Guidance Method Prompt Mode Scale Guidance Image Output Image
IP-adapter A drawing of a lion laid on a table. regular 0.85 Input Image Output Image
IP-adapter A drawing of a bird. style 1 Input Image Output Image
Request
path Parameters
model_id
required
string

The model id of the tailored model you would like to use in the request.

header Parameters
api_token
required
string
Request Body schema: application/json
required
prompt
string

The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.

num_results
integer [ 1 .. 4 ]
Default: 4

How many images you would like to generate. This parameter is optional. When fast=false, only num_results 1, 2 are supported. and when using any guidance method, please use the value 1.

aspect_ratio
string
Default: "1:1"

The aspect ratio of the image.

Enum: "1:1" "2:3" "3:2" "3:4" "4:3" "4:5" "5:4" "9:16" "16:9"
sync
boolean
Default: false

Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.

fast
boolean
Default: true

Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. When false, the regular mode will be utilized. At the moment, tailored models trained using the 'Max' training version, do not support fast generation.

seed
integer

You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.

steps_num
integer [ 4 .. 20 ]
Default: 8

The number of iterations the model goes through to refine the generated image. This parameter is optional. When fast=false, the default value is 30, the minimum is 20 and the maximum is 50.

model_influence
number <float> [ 0 .. 1 ]
Default: 1

The influence of the structure reference on the generated image. This parameter is optional. Higher value means more adherence to the reference structure.

include_generation_prefix
boolean
Default: true

When true, the model's generation prefix is automatically prepended to your prompt to maintain consistency with the training data, while false allows you to override the training prefix and write the complete prompt yourself, including any preferred prefix text.

guidance_method_1
string

Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.

Enum: "controlnet_canny" "controlnet_depth" "controlnet_recoloring" "controlnet_color_grid"
guidance_method_1_scale
number <float> [ 0 .. 1 ]
Default: 1

The impact of the guidance.

guidance_method_1_image_file
string

The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.

guidance_method_2
string

Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.

Enum: "controlnet_canny" "controlnet_depth" "controlnet_recoloring" "controlnet_color_grid"
guidance_method_2_scale
number <float> [ 0 .. 1 ]
Default: 1

The impact of the guidance.

guidance_method_2_image_file
string

The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.

image_prompt_mode
string
Default: "regular"

The mode to apply to the image guidance.

  • regular: Uses both content and style from the provided image for the generation.
  • style_only: Uses only the style from the provided image.
Enum: "regular" "style_only"
image_prompt_file
string

The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.

image_prompt_urls
Array of strings <uri>

A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp. The URLs should point to accessible, publicly available images.

image_prompt_scale
number <float> [ 0 .. 1 ]
Default: 1

The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).

Responses
200

Successful operation.

400

Bad request.

405

Method not allowed.

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error.

post/text-to-image/tailored/{model_id}
Request samples

Generate Vector Graphics - Tailored (Beta)

Description

This route allows you to generate vector graphics using a Tailored Model. Tailored Models are trained on your visual IP (illustrations, photos, vectors) to preserve and faithfully reproduce specific IP elements or guidelines, ensuring consistency across all generated outputs. To see a detailed description of the tailored models' functionalities, please refer to the /text-to-image/tailored/{model_id} route documentation. *Text-to-vector is compatible with tailored models in the illustrative domain.

Guidance Methods

This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.

ControlNets:

A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.

  • controlnet_canny: Uses edge information from the input image to guide generation based on structural outlines. - controlnet_depth: Derives depth information to influence spatial arrangement in the generated image. - controlnet_recoloring: Uses a grayscale version of the input image to guide recoloring while preserving geometry. - controlnet_color_grid: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.

Using ControlNets
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:

Guidance Method Prompt Scale Input Image Guidance Image Output Image
ControlNet Canny An exotic colorful shell on the beach 1.0 Input Image Guidance Image Output Image
ControlNet Depth A dog, exploring an alien planet 0.8 Input Image Guidance Image Output Image
ControlNet Recoloring A vibrant photo of a woman 1.00 Input Image Guidance Image Output Image
ControlNet Color Grid A dynamic fantasy illustration of an erupting volcano 0.7 Input Image Guidance Image Output Image

To use ControlNets guidance method, include the following parameters in your request:

  • guidance_method_X: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
  • guidance_method_X_scale: Set the impact of the guidance (0.0 to 1.0)
  • guidance_method_X_image_file: Provide the base64-encoded input image

IP_adapter:

Guides the model based on the input image and its associated style. This method offers two modes:

  • regular: Uses the full input image to condition the model, influencing both content and style.
  • style_only: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.

Using IP-Adapter

Guidance Method Prompt Mode Scale Guidance Image Output Image
IP-adapter A drawing of a lion laid on a table. regular 0.85 Input Image Output Image
IP-adapter A drawing of a bird. style 1 Input Image Output Image
Request
path Parameters
model_id
required
string

The model id of the tailored model you would like to use in the request.

header Parameters
api_token
required
string
Request Body schema: application/json
required
prompt
string

The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.

num_results
integer [ 1 .. 4 ]
Default: 4

How many images you would like to generate. This parameter is optional. When fast=false, only num_results 1, 2 are supported, and when using any guidance method, please use the value 1.

aspect_ratio
string
Default: "1:1"

The aspect ratio of the image.

Enum: "1:1" "2:3" "3:2" "3:4" "4:3" "4:5" "5:4" "9:16" "16:9"
sync
boolean
Default: true

Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready. This parameter is optional. When fast=false, it is reomcmned to use sync=false.

fast
boolean
Default: true

Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. When false, the regular mode will be utilized. At the moment, tailored models trained using the 'Max' training version, do not support fast generation.

seed
integer

You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.

steps_num
integer [ 4 .. 20 ]
Default: 8

The number of iterations the model goes through to refine the generated image. This parameter is optional. When fast=false, the default value is 30, the minimum is 20 and the maximum is 50.

model_influence
number <float> [ 0 .. 1 ]
Default: 1

The influence of the tailored model on the generation. Only relevant if tailored_model_id is provided. This parameter is optional. Higher value gives more weight to the tailored model.

include_generation_prefix
boolean
Default: true

When true, the model's generation prefix is automatically prepended to your prompt to maintain consistency with the training data, while false allows you to override the training prefix and write the complete prompt yourself, including any preferred prefix text.

guidance_method_1
string

Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.

Enum: "controlnet_canny" "controlnet_depth" "controlnet_recoloring" "controlnet_color_grid"
guidance_method_1_scale
number <float> [ 0 .. 1 ]
Default: 1

The impact of the guidance.

guidance_method_1_image_file
string

The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.

guidance_method_2
string

Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.

Enum: "controlnet_canny" "controlnet_depth" "controlnet_recoloring" "controlnet_color_grid"
guidance_method_2_scale
number <float> [ 0 .. 1 ]
Default: 1

The impact of the guidance.

guidance_method_2_image_file
string

The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.

image_prompt_mode
string
Default: "regular"

The mode to apply to the image guidance.

  • regular: Uses both content and style from the provided image for the generation.
  • style_only: Uses only the style from the provided image.
Enum: "regular" "style_only"
image_prompt_file
string

The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.

image_prompt_urls
Array of strings <uri>

A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp. The URLs should point to accessible, publicly available images.

image_prompt_scale
number <float> [ 0 .. 1 ]
Default: 1

The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).

Responses
200

Successful operation.

400

Bad request.

403

Forbidden. Insufficient permissions to access the image URL..

405

Method not allowed.

415

Unsupported Media Type. Invalid file type. Supported file types are jpeg, jpg, png, webp.

422

Unprocessable Entity. The URL does not point to a valid image or is inaccessible.

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error.

post/text-to-vector/tailored/{model_id}
Request samples

Create Project

Create a new project within the organization. A project encompasses all models trained and datasets created for the IP defined in the project.

The following IP types are supported:

Multi-Object Set A collection of different objects sharing a common style, design language, or color scheme. Objects are typically isolated on solid backgrounds. Example of multi-object set showing different objects with consistent style

Object Variants Multiple variations of the same object type, maintaining consistent style and structure while showing different interpretations. Objects are typically isolated on solid backgrounds. Example of object variants showing different versions of the same object

Icons A collection of cohesive, small-scale illustrations or symbols designed to represent concepts, actions, or objects in interfaces and applications. Maintains consistent visual style across the set. Example of icon set with consistent design language

Defined Character A specific character that maintains consistent identity and unique traits while being reproduced in different poses, situations, and actions. Example of defined character in different poses

Character Variants Multiple characters sharing the same fundamental structure, style, and color palette, allowing creation of new characters that fit within the established design system. Example of character variants showing different characters with consistent style

Stylized Scene Complete environments or scenes created with a consistent visual style, look, and feel. Example of stylized scene showing cohesive environment

Request
header Parameters
api_token
required
string
Request Body schema: application/json
required
project_name
string

Name of the project (required)

project_description
string

Description of the project (optional)

ip_name
string

Required only for defined_character IP type. The name of the character (1-3 words, e.g., "Lora", "Captain Smith"). This name will be incorporated into the automatically created caption prefix and generation prefix, used consistently during training and generation.

ip_description
string

Required only for defined_character and object_variants IP types. A short phrase (up to 6 words) describing only the most crucial distinguishing features of your character (e.g., "a female character with purple hair"). Keep it brief as the model will learn additional details from the training images. This description will be incorporated into the automatically created caption prefix and generation prefix, used during training and generation.

ip_medium
string

Medium of the IP (required)

  • photography (Beta)
  • illustration
Enum: "photography" "illustration"
ip_type
string

Type of the IP (required):

  • multi_object_set: Multiple distinct objects that share a mutual style, design language, or color scheme. These objects are often isolated on a solid background. This is currently valid only when ip_medium = illustration.
  • object_variants: Variations of the same object type, designed with consistent style, structure, and coloring, showcasing different interpretations. These objects are often isolated on a solid background. This is currently valid only when ip_medium = illustration.
  • icons: A collection of small, visually distinct illustrations, such as symbols or graphical elements, designed with a cohesive style and used to represent concepts, actions, or objects in interfaces, applications, or visual communication materials. This is valid only when ip_medium = illustration.
  • defined_character: A specific predefined character or person that can be reproduced consistently in different situations, poses, or actions, preserving their identity and unique traits.
  • character_variants: Multiple characters sharing the same structure, style, and color palette, with the ability to create new characters that adhere to these shared characteristics while introducing unique elements. This is currently valid only when ip_medium = illustration.
  • stylized_scene: A complete scene or environment, such as a gaming background or a series of photos with a shared color palette, created with a cohesive style, look, and feel.
  • other: For IP types that don't fit into the above categories
Enum: "multi_object_set" "object_variants" "icons" "defined_character" "character_variants" "stylized_scene" "other"
Responses
201

Project successfully created

400

Bad request - validation error

401

Unauthorized

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/projects
Request samples
Response samples
application/json
{
  • "id": 123,
  • "project_name": "Branded Character",
  • "project_description": "",
  • "ip_name": "Lora",
  • "ip_description": "A female character with purple hair",
  • "ip_medium": "illustration",
  • "ip_type": "defined_character",
  • "status": "active",
  • "created_at": "2024-05-26T12:00:00Z"
}

Get Projects

Retrieve all projects within the organization. If there are no projects, returns an empty array.

Request
header Parameters
api_token
required
string
Responses
200

Successfully retrieved projects

401

Unauthorized

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/projects
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Get Project by ID

Retrieve full project information including project name and description, IP name and description, IP medium (photography/illustration), IP type, status, and timestamps.

Request
path Parameters
project_id
required
string

Project ID

header Parameters
api_token
required
string
Responses
200

Successfully retrieved project

401

Unauthorized

404

Project not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/projects/{project_id}
Request samples
Response samples
application/json
{
  • "id": 123,
  • "project_name": "Branded Character",
  • "project_description": "",
  • "ip_name": "Lora",
  • "ip_description": "A female character with purple hair",
  • "ip_medium": "illustration",
  • "ip_type": "defined_character",
  • "status": "active",
  • "created_at": "2024-05-26T12:00:00Z"
}

Update Project

Update a specific project

Request
path Parameters
project_id
required
string

Project ID

header Parameters
api_token
required
string
Request Body schema: application/json
required
project_name
string

New project name (optional)

project_description
string

New project description (optional)

ip_name
string

New IP name (optional)

ip_description
string

New IP description (optional)

Responses
200

Project successfully updated

401

Unauthorized

404

Project not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

put/tailored-gen/projects/{project_id}
Request samples
Response samples
application/json
{
  • "id": 123,
  • "project_name": "Branded Character",
  • "project_description": "",
  • "ip_name": "Lora",
  • "ip_description": "A girl with purple hair",
  • "ip_medium": "illustration",
  • "ip_type": "defined_character",
  • "status": "active",
  • "created_at": "2024-05-26T12:00:00Z"
}

Delete Project

Permanently delete a project and all its associated resources, including all datasets, images, and models. This action cannot be undone. Training models must be stopped before deletion.

Request
path Parameters
project_id
required
string

Project ID

header Parameters
api_token
required
string
Responses
204

Project successfully deleted

401

Unauthorized

404

Project not found

409

Cannot delete project while models are in training

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

delete/tailored-gen/projects/{project_id}
Request samples

Create Dataset

Create a new dataset.

Constraints:

  • Dataset must have at least 1 image to be completed
  • Maximum of 200 images per dataset
Request
header Parameters
api_token
required
string
Request Body schema: application/json
required
project_id
integer

Associated project ID (required)

name
string

Dataset name (required)

Responses
201

Dataset successfully created

400

Bad request - validation error

401

Unauthorized

404

Project not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/datasets
Request samples
Response samples
application/json
{
  • "id": 456,
  • "project_id": 123,
  • "name": "dataset v1",
  • "caption_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "status": "draft",
  • "captions_update_status": "empty",
  • "created_at": "2024-05-26T12:00:00Z",
  • "updated_at": "2024-05-26T12:00:00Z"
}

Get Datasets

Retrieve a list of all datasets. If there are no datasets, returns an empty array.

Request
header Parameters
api_token
required
string
Responses
200

Successfully retrieved datasets

401

Unauthorized

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/datasets
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Get Datasets by Project

Retrieve all datasets for a specific project

Request
path Parameters
project_id
required
string

Project ID

query Parameters
include_models
boolean
Default: false

If true, a list of model objects using the dataset should be included in the response under the parameter 'models'

include_models_ids
boolean
Default: false

If true, a list of model ids using the dataset should be included in the response under the parameter 'model_ids'

header Parameters
api_token
required
string
Responses
200

Successfully retrieved datasets

401

Unauthorized

404

Project not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/projects/{project_id}/datasets
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Get Dataset by ID

Retrieve a specific dataset

Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Responses
200

Successfully retrieved dataset

401

Unauthorized

404

Dataset not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/datasets/{dataset_id}
Request samples
Response samples
application/json
{
  • "id": 456,
  • "project_id": 123,
  • "name": "dataset v1",
  • "caption_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "status": "completed",
  • "captions_update_status": "empty",
  • "images_count": 2,
  • "images": [],
  • "created_at": "2024-05-26T12:00:00Z",
  • "updated_at": "2024-05-26T14:30:00Z"
}

Update Dataset

Update a dataset.

In order to use a dataset in a model training, its status must be set to completed.

Once a dataset status is changed to completed:

  • Images cannot be added or removed
  • Image captions cannot be edited
  • Caption prefix cannot be modified

It is recommended to use the route Clone Dataset As Draft in order to create a new version of a dataset.

Constraints:

  • Cannot update caption_prefix if dataset status is completed
  • Dataset must have at least 1 image to be marked as completed
Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Request Body schema: application/json
required
name
string

New dataset name (optional)

caption_prefix
string

New caption prefix (optional). Cannot be updated if dataset status is completed. If the user has updated the caption prefix, it is crucial to Regenerate All Captions using the endpoint PUT /datasets/{dataset_id}/images/

status
string

Dataset status (optional). Can be set to completed to enable usage in model training

Enum: "draft" "completed"
Responses
200

Dataset successfully updated

400

Bad request - validation error

401

Unauthorized

404

Dataset not found

409

Conflict error

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

put/tailored-gen/datasets/{dataset_id}
Request samples
Response samples
application/json
{
  • "id": 456,
  • "project_id": 123,
  • "name": "dataset v1",
  • "caption_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "status": "completed",
  • "captions_update_status": "empty",
  • "created_at": "2024-05-26T12:00:00Z",
  • "updated_at": "2024-05-26T15:30:00Z"
}

Delete Dataset

Delete a specific dataset. Deletes all associated images.

Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Responses
204

Dataset successfully deleted

401

Unauthorized

404

Dataset not found

409

Cannot delete a dataset that is used by a model that is in training

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

delete/tailored-gen/datasets/{dataset_id}
Request samples

Clone Dataset As Draft

Create a new draft dataset based on existing one. This is useful when you would like to use the same dataset again for another training, but with some modification (create a variation).

Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Request Body schema: application/json
optional
name
string

New dataset name. Defaults to "Copy of [original name]"

description
string

New dataset description. Defaults to original description

Responses
201

Dataset successfully cloned

401

Unauthorized

404

Dataset not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/datasets/{dataset_id}/clone
Request samples
Response samples
application/json
{
  • "id": 457,
  • "project_id": 123,
  • "name": "Copy of dataset v1 - modified version",
  • "caption_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "status": "draft",
  • "captions_update_status": "empty",
  • "images_count": 2,
  • "images": [],
  • "created_at": "2024-05-26T15:30:00Z",
  • "updated_at": "2024-05-26T15:30:00Z"
}

Upload Image

Upload new image to a dataset.

Image Requirements:

  • Minimum resolution: 1024x1024 pixels
  • Supported formats: jpg, jpeg, png, webp
  • Preferably use original high-quality assets
  • For best results, use 1:1 aspect ratio or ensure main content is centered

Dataset Guidelines:

  • Recommended: 5-50 images for optimal results when using Max training version, 15-100 for optimal results when using Light training version
  • Maximum supported: 200 images
  • Ensure consistency in style, structure, and visual elements
  • Balance diversity in content (poses, scenes, objects) while maintaining consistency in key elements (style, colors, theme)
  • Note: Larger datasets may introduce more variety, which can reduce overall consistency

For optimal training (especially for characters/objects):

  • Subject should occupy most of the image area
  • Minimize unnecessary margins around the subject
  • Transparent backgrounds will be converted to black
  • For character datasets: include diverse poses, environments, attires, and interactions

Captions and Generation:

  • Each image receives an automatic caption that continues from the dataset's caption prefix
  • Default caption prefix is recommended for initial training
  • Captions can be modified to include domain-specific terms
  • Both captions and prefix influence training and future generations
  • Focus on essential elements rather than extensive details

Constraints:

  • Dataset must have at least 1 image
  • Dataset cannot exceed 200 images
  • Cannot upload to a completed dataset
Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Request Body schema: application/json
required
file
string <binary>

Image file to upload (required if image_url not provided)

image_url
string

URL of image to upload (required if file not provided)

image_name
string

Custom name for the image (optional)

Responses
201

Image successfully uploaded

400

Bad request

401

Unauthorized

404

Dataset not found

409

Conflict error

412

Precondition Failed.

415

Unsupported Media Type.

422

Unprocessable Entity.

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/datasets/{dataset_id}/images
Request samples
Response samples
application/json
{}

Get Images

Retrieve all images in a specific dataset. If there are no images, returns an empty array.

Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Responses
200

Successfully retrieved images

401

Unauthorized

404

Dataset not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/datasets/{dataset_id}/images
Request samples
Response samples
application/json
[]

Regenerate All Captions

Regenerate captions for all images in dataset. This action is crucial after the user updates the caption_prefix, and then it's recommended to regenerate all the captions of all images, to have full compatibility with the new caption_prefix.

This is an asynchronous operation. Once this endpoint is called, Get Dataset by ID should be sampled until the captions_update_status changes to 'completed'.

Request
path Parameters
dataset_id
required
string

Dataset ID

header Parameters
api_token
required
string
Responses
202

Caption regeneration process started

401

Unauthorized

404

Dataset not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

put/tailored-gen/datasets/{dataset_id}/images
Request samples
Response samples
application/json
{
  • "id": 456,
  • "project_id": 123,
  • "name": "dataset v1",
  • "caption_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "status": "draft",
  • "captions_update_status": "in_progress",
  • "created_at": "2024-05-26T12:00:00Z",
  • "updated_at": "2024-05-26T15:45:00Z"
}

Get Image by ID

Retrieve full image information including caption (which naturally continues the dataset's caption_prefix), caption source (automatic/manual/unknown), image name, URL and thumbnail URL, dataset ID, and timestamps.

Request
path Parameters
dataset_id
required
string

Dataset ID

image_id
required
integer

Image ID

header Parameters
api_token
required
string
Responses
200

Successfully retrieved image

401

Unauthorized

404

Image or dataset not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/datasets/{dataset_id}/images/{image_id}
Request samples
Response samples
application/json
{}

Update Image Caption

Update the caption of a specific image. There are two mutually exclusive ways to update a caption:

  1. Provide a new caption text:

    • Use the caption parameter
    • This will set caption_source to "manual"
    • Reflects a human-written caption
  2. Request automatic caption regeneration:

    • Set regenerate_caption to true
    • This will set caption_source to "automatic"
    • A new caption will be generated automatically based on the image and caption_prefix
    • For the same caption_prefix, regenerate_caption will always return the same caption
    • Useful for resetting captions or regenerating them after changing the caption_prefix

Note: You cannot provide both parameters simultaneously as they represent different update approaches.

Constraints:

  • Cannot update captions in a completed dataset
  • Cannot provide both caption and regenerate_caption in the same request
Request
path Parameters
dataset_id
required
string

Dataset ID

image_id
required
integer

Image ID

header Parameters
api_token
required
string
Request Body schema: application/json
required
caption
string

New caption text. When provided, sets caption_source to "manual"

regenerate_caption
boolean
Default: false

When true, generates new caption automatically and sets caption_source to "automatic"

Responses
200

Caption successfully updated

400

Bad request - Both caption and regenerate_caption provided

401

Unauthorized

404

Image or dataset not found

409

Cannot update caption in a completed dataset

410

Dataset deleted

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

put/tailored-gen/datasets/{dataset_id}/images/{image_id}
Request samples
Response samples
application/json
{}

Delete Image

Permanently remove an image from a dataset. This will also delete the image files and associated thumbnails.

Constraints:

  • Cannot delete images from completed datasets
Request
path Parameters
dataset_id
required
string

Dataset ID

image_id
required
integer

Image ID

header Parameters
api_token
required
string
Responses
204

Image successfully deleted

401

Unauthorized

404

Image or dataset not found

409

Cannot delete an image from a completed dataset

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

delete/tailored-gen/datasets/{dataset_id}/images/{image_id}
Request samples
Response samples
application/json
{
  • "message": "Cannot delete an image from a completed dataset"
}

Create Model

Create new model. A dataset can be used to train multiple models with different training versions (e.g., one light and one max). The model will belong to the same project as its dataset.

Request
header Parameters
api_token
required
string
Request Body schema: application/json
required
name
string

Name of the model (required)

dataset_id
integer

ID of the dataset to use (required)

training_version
string

Training version (required):

  • Light: Choose this version when you need fast generation times and compatibility with our structure reference feature.
  • Max: Best for complex IPs requiring high fidelity and precise prompt alignment. Choose this version when accurate replication of specific attributes is your top priority. This version is currently not available when ip_medium=photography.
Enum: "light" "max"
description
string

Description of the model (optional)

Responses
201

Model successfully created

400

Bad request - validation error

401

Unauthorized

404

Dataset not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/models
Request samples
Response samples
application/json
{
  • "id": 789,
  • "name": "Lora Character Model",
  • "description": "A model trained on Lora character illustrations",
  • "status": "created",
  • "training_version": "max",
  • "generation_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "project_id": 123,
  • "dataset_id": 456,
  • "created_at": "2024-05-26T12:00:00Z"
}

Get Models

Retrieve a list of models. If there are no models, an empty array is returned.

Request
header Parameters
api_token
required
string
Responses
200

Successfully retrieved models

401

Unauthorized

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/models
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Get Models by Project

Retrieve all models for a project. If there are no models, an empty array is returned.

Request
path Parameters
project_id
required
integer

Project ID

header Parameters
api_token
required
string
Responses
200

Successfully retrieved models

401

Unauthorized

404

Project not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/projects/{project_id}/models
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Get Model by ID

Retrieve full model information including name, description, status (Created/InProgress/Completed/Failed/Stopping/Stopped), training version (Light/Max), generation prefix, project ID, dataset ID, and timestamps.

Request
path Parameters
model_id
required
integer

Model ID

header Parameters
api_token
required
string
Responses
200

Successfully retrieved model

401

Unauthorized

404

Model not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

get/tailored-gen/models/{model_id}
Request samples
Response samples
application/json
{
  • "id": 789,
  • "name": "Lora Character Model",
  • "description": "A model trained on Lora character illustrations",
  • "status": "Completed",
  • "training_version": "max",
  • "generation_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "project_id": 123,
  • "dataset_id": 456,
  • "created_at": "2024-05-26T12:00:00Z"
}

Update Model

Update a model's name and description. Other model attributes such as training version and dataset cannot be modified after creation.

Request
path Parameters
model_id
required
integer

Model ID

header Parameters
api_token
required
string
Request Body schema: application/json
required
name
string

New model name (optional)

description
string

New model description (optional)

Responses
200

Model successfully updated

401

Unauthorized

404

Model not found

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

put/tailored-gen/models/{model_id}
Request samples
Response samples
application/json
{
  • "id": 789,
  • "name": "Updated Lora Character Model",
  • "description": "An updated model trained on Lora character illustrations",
  • "status": "Completed",
  • "training_version": "max",
  • "generation_prefix": "An illustration of a character named Lora, a female character with purple hair,",
  • "project_id": 123,
  • "dataset_id": 456,
  • "created_at": "2024-05-26T12:00:00Z"
}

Delete Model

Delete a specific model. Changes status to Deleted.

Request
path Parameters
model_id
required
integer

Model ID

header Parameters
api_token
required
string
Responses
204

Model successfully deleted

401

Unauthorized

404

Model not found

409

Cannot delete a model that is currently in training

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

delete/tailored-gen/models/{model_id}
Request samples
Response samples
application/json
{
  • "message": "Cannot delete model while it is in training"
}

Start Training

Start model training (1-3 hours duration). The associated dataset must have status 'completed' before training can begin.

Constraints:

  • Dataset must be in 'completed' status
Request
path Parameters
model_id
required
integer

Model ID

header Parameters
api_token
required
string
Responses
200

Training successfully started

401

Unauthorized

404

Model not found

409

Training already started/cannot be resumed

412

Dataset status must be 'completed' to start training

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/models/{model_id}/start_training
Request samples
Response samples
application/json
{
  • "id": 789,
  • "status": "InProgress"
}

Stop Training

Stop an ongoing model training process. Once stopped, training cannot be resumed - a new model would need to be created and trained.

Request
path Parameters
model_id
required
integer

Model ID

header Parameters
api_token
required
string
Responses
200

Training job successfully stopped

401

Unauthorized

404

Model not found

409

Training already stopped/not in training

429

Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.

500

Internal server error

post/tailored-gen/models/{model_id}/stop_training
Request samples