openapi: 3.0.0
info:
  title: Overview
  version: ''
  description: >
    Tailored Generation provides capabilities to generate visuals (photos,
    illustrations, vectors) 

    that preserve and faithfully reproduce specific IP elements or guidelines,
    ensuring consistency 

    across all generated outputs.


    The Tailored Generation APIs allow you to manage and train tailored models
    that maintain the 

    integrity of your visual IP. You can train models through our Console or
    implement training 

    directly via API. Explore the Console
    [here](https://platform.bria.ai/console/tailored-generation).


    **Advanced Customization and Access:**  

    As part of Bria’s **Source Code & Weights** product, developers seeking
    deeper customization can access Bria’s source-available GenAI models via
    [Hugging Face](https://huggingface.co/briaai).  

    This allows full control over fine-tuning, pipeline creation, and
    integration into proprietary workflows—empowering AI teams to develop and
    optimize their own generative AI solutions.


    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 that define 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**: Organize and refine datasets within your
    projects:
      - **Create and Retrieve Datasets**: Use the `/datasets` endpoints to create new datasets or 
        retrieve existing ones.
      - **Generate an Advanced Caption Prefix** (For `stylized_scene` IP type)  
        - If the IP type is `stylized_scene`, it is **recommended** to generate an advanced prefix before uploading images.  
        - Use `/tailored-gen/generate_prefix` to generate a structured caption prefix using 1-6 sample images from the input images provided for training (preferably 6 if available).  
        - Update the dataset with the generated prefix using `/datasets/{dataset_id}` before proceeding with image uploads.  
      - **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**: Train and optimize tailored 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**


    To train a tailored model:


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

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

    3. **Generate an Advanced Caption Prefix** *(For `stylized_scene` IP type
    only)*:  
     - Before uploading images, call `/tailored-gen/generate_prefix`, sampling 1-6 images from the input images provided for training (preferably 6 if available).  
     - Update the dataset with the generated prefix using `/datasets/{dataset_id}`.  
    3. **Upload Images**: Upload images using the
    `/datasets/{dataset_id}/images` endpoint 
      (minimum resolution: 1024x1024px).
    4. **Prepare Dataset**: Review auto-generated captions and update the
    dataset status to 'completed'.

    5. **Create Model**: Use the `/models` endpoint to create a model, selecting
    either the 
      "light" or "max" training version.
    6. **Start Training**: Initiate training via the
    `/models/{id}/start_training` endpoint. 
      Training typically takes 1-3 hours.
    7. **Monitor Progress**: Check the training status using the `/models/{id}`
    endpoint until 
      training is 'Completed'.
    8. **Generate Images**: Once trained, your model can be used in multiple
    ways:
      - Use `/text-to-image/tailored/{model_id}` for text-to-image generation.
      - Use `/text-to-vector/tailored/{model_id}` for generating illustrative vector graphics.
      - Use `/reimagine/tailored/{model_id}` for structure-based generation.
      - Access through the Bria platform interface.

    Alternatively, manage and train tailored models through Bria's user-friendly
    Console.  

    Get started [here](https://platform.bria.ai/console/tailored-generation).


    ### Restyle Portraits


    The Restyle Portrait feature enables you to change the style of portrait
    images while preserving the identity of the subject. It utilizes a reference
    image of the person alongside a trained tailored model, ensuring consistent
    representation of facial features and identity across different visual
    styles.


    Restyle Portrait is specifically optimized for portraits captured from the
    torso upward, with an ideal face resolution of at least 500×500 pixels.
    Using images below these recommended dimensions may lead to inconsistent or
    unsatisfactory results.


    To use Restyle Portrait:


    * Reference Image: Provide a clear portrait image that meets the recommended
    guidelines.


    * Tailored Model: Select a tailored model trained specifically to reflect
    your desired style or visual IP.


    Use the `/tailored-gen/restyle_portrait` endpoint to access this capability
    directly, allowing seamless integration of personalized style
    transformations into your workflow.


    <img
    src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/restyle_portraits/a_beauriful_portrait_of_a_person__close_up_on_the_face+(2).png"
    width="200"/><img
    src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/restyle_portraits/image+(1).webp"
    width="200"/>


    <img
    src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/restyle_portraits/a_handsome_man.png"
    width="200"/><img
    src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/restyle_portraits/image.webp"
    width="200"/>


    ### **Guidance Methods**  


    Some of the APIs below support various guidance methods to provide greater
    control over generation. These methods enable to guide the generation using
    not only a textual prompt, but also visuals.


    The following APIs support guidance methods:


    - `/text-to-image/tailored`  

    - `/text-to-vector/tailored`  


    **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.  


    You can specify up to two 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. 


    When using multiple ControlNets, all input images must have the same aspect
    ratio, which will determine the aspect ratio of the generated results. 


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


    - `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the
    parameter `guidance_method_2` is used, `guidance_method_1` must also be
    used. If you want to use only one method, use `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.


    <table>
      <tr>
        <th>Guidance Method</th>
        <th>Prompt</th>
        <th>Scale</th>
        <th style="width: 150px;">Input Image</th>
        <th style="width: 150px;">Guidance Image</th>
        <th style="width: 150px;">Output Image</th>
      </tr>
      <tr>
        <td>ControlNet Canny</td>
        <td>An exotic colorful shell on the beach</td>
        <td>1.0</td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/canny_input.jpg"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/canny_map.png"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/canny_output.png"></td>
      </tr>
      <tr>
        <td>ControlNet Depth</td>
        <td>A dog, exploring an alien planet</td>
        <td>0.8</td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/depth_input.jpg"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/depth_map.webp"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/depth_output.png"></td>
      </tr>
      <tr>
        <td>ControlNet Recoloring</td>
        <td>A vibrant photo of a woman</td>
        <td>1.00</td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/recoloring_input.png"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/recoloring_map.webp"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/recoloring_output.png"></td>
      </tr>
      <tr>
        <td>ControlNet Color Grid</td>
        <td>A dynamic fantasy illustration of an erupting volcano</td>
        <td>0.7</td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/colorgrid_input.png"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/colorgrid_map.png"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.amazonaws.com/api_doc/cns/colorgrid_output.png"></td>
      </tr>
    </table>  


    **Image Prompt Adapter:**  


    This method offers two modes:  


    - **regular**: Uses the image’s content, style elements, and color palette
    to guide generation.

    - **style_only**: Uses the image’s high-level style elements and color
    palette to influence the generated output.


    To use **Image Prompt Adapter** as guidance, include the following
    parameters in your request:


    - `image_prompt_mode`: Specify how the input image influences the
    generation.

    - `image_prompt_scale`: Set the impact of the provided image on the
    generated result (0.0 to 1.0).

    - `image_prompt_file`: Provide the base64-encoded image file to be used as
    guidance.


    or

    - `image_prompt_urls`: Provide a list of URLs pointing to publicly
    accessible images to be used as guidance.


    <table>
      <tr>
        <th>Guidance Method</th>
        <th>Prompt</th>
        <th>Mode</th>
        <th>Scale</th>
        <th style="width: 150px;">Guidance Image</th>
        <th style="width: 150px;">Output Image</th>
      </tr>
      <tr>
        <td>Image Prompt Adapter</td>
        <td>A drawing of a lion laid on a table.</td>
        <td>regular</td>
        <td>0.85</td>
        <td style="width: 150px;"><img src="https://images.pexels.com/photos/3246665/pexels-photo-3246665.png"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/image.png"></td>
      </tr>
      <tr>
        <td>Image Prompt Adapter</td>
        <td>A drawing of a bird.</td>
        <td>style</td>
        <td>1</td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/photo-1575995872537-3793d29d972c.avif"></td>
        <td style="width: 150px;"><img src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/seed_627499055.png"></td>
      </tr>
    </table>  
externalDocs:
  description: Register and get API Access
  url: https://platform.bria.ai/console/account/api-keys
servers:
  - url: https://engine.prod.bria-api.com/v1
paths:
  /text-to-image/tailored/{model_id}:
    post:
      summary: Generate Image - Tailored model
      tags:
        - Generation Endpoints
      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.


        This API endpoint supports content moderation via an optional parameter
        that can prevent generation if input images contain inappropriate
        content, and filters out unsafe generated images - the first blocked
        input image will fail the entire request.
      operationId: text-to-image-tailored
      parameters:
        - in: path
          name: model_id
          schema:
            type: string
          required: true
          description: >-
            The model id of the tailored model you would like to use in the
            request.
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: >-
                    The prompt you would like to use to generate images. Bria
                    currently supports prompts in English only, excluding
                    special characters.
                num_results:
                  type: integer
                  description: >-
                    How many images you would like to generate. This parameter
                    is optional. When fast=false, only num_results 1, 2 are
                    supported.
                  minimum: 1
                  maximum: 4
                  default: 4
                aspect_ratio:
                  type: string
                  description: >-
                    The aspect ratio of the image. When a ControlNet is being
                    used, the aspect ratio is defined by the guidance image and
                    this parameter is ignored.
                  default: '1:1'
                  enum:
                    - '1:1'
                    - '2:3'
                    - '3:2'
                    - '3:4'
                    - '4:3'
                    - '4:5'
                    - '5:4'
                    - '9:16'
                    - '16:9'
                sync:
                  type: boolean
                  description: >-
                    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.
                  default: false
                fast:
                  type: boolean
                  default: true
                  description: >-
                    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:
                  type: integer
                  description: >-
                    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:
                  type: integer
                  description: >-
                    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.
                  minimum: 4
                  maximum: 20
                  default: 8
                model_influence:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1.5
                  default: 1
                  description: >-
                    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:
                  type: boolean
                  default: true
                  description: >-
                    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.
                faces_refiner:
                  type: boolean
                  default: false
                  description: >-
                    When set to true, automatically detects and refines
                    generated human faces for enhanced realism and detail.
                content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to both input
                    visuals and generated outputs.


                    For input images:

                    - Processing stops at the first image that fails moderation

                    - Returns a 422 error with details about which parameter
                    failed


                    For synchronous requests (sync=true):

                    - If all generated images fail moderation, returns a 422
                    error

                    - If some images pass and others fail, returns a 200
                    response with successful generations and "blocked" objects
                    for failed ones


                    For asynchronous requests (sync=false):

                    - Failed images are replaced with zero-byte files at their
                    placeholder URLs

                    - Successful images are stored at their original placeholder
                    URLs
                guidance_method_1:
                  type: string
                  enum:
                    - controlnet_canny
                    - controlnet_depth
                    - controlnet_recoloring
                    - controlnet_color_grid
                  description: >-
                    Which guidance type you would like to include in the
                    generation. Up to 2 guidance methods can be combined during
                    a single inference. This parameter is optional.
                guidance_method_1_scale:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: The impact of the guidance.
                guidance_method_1_image_file:
                  type: string
                  description: >-
                    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:
                  type: string
                  enum:
                    - controlnet_canny
                    - controlnet_depth
                    - controlnet_recoloring
                    - controlnet_color_grid
                  description: >-
                    Which guidance type you would like to include in the
                    generation. Up to 2 guidance methods can be combined during
                    a single inference. This parameter is optional.
                guidance_method_2_scale:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: The impact of the guidance.
                guidance_method_2_image_file:
                  type: string
                  description: >-
                    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:
                  type: string
                  enum:
                    - regular
                    - style_only
                  default: regular
                  description: >
                    - `regular`: Uses the image’s content, style elements, and
                    color palette to guide generation.

                    - `style_only`: Uses the image’s high-level style elements
                    and color palette to influence the generated output.

                    At the moment, tailored models trained using the 'Max'
                    training version, do not support image prompt guidense.
                image_prompt_file:
                  type: string
                  description: >
                    The image file to be used as guidance, in base64 format.
                    Accepted formats are jpeg, jpg, png, webp.

                    Maximum file size 12MB. This image can be of any aspect
                    ratio, even when it's not alligned with the one defined in
                    the parameter 'aspect_ratio' or by visuals provided to the
                    ControlNets.
                image_prompt_urls:
                  type: array
                  items:
                    type: string
                    format: uri
                  description: >
                    A list of URLs of images that should be used as guidance.
                    The images can be of different aspect ratios. Accepted
                    formats are jpeg, jpg, png, webp.

                    The URLs should point to accessible, publicly available
                    images.
                image_prompt_scale:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: >
                    The impact of the provided image on the generated results. A
                    value between 0.0 (no impact) and 1.0 (full impact).
            examples:
              valid prompt:
                value:
                  prompt: a book
                  num_results: 2
                  sync: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    description: >-
                      There are multiple objects in this array (based on the
                      amount specified in num_results) and each object
                      represents a single image or a blocked result.
                    items:
                      oneOf:
                        - type: object
                          properties:
                            seed:
                              type: integer
                              description: >-
                                If you want to recreate the result again, you
                                should use in the request the prompt and the
                                seed of the response.
                            urls:
                              type: string
                              description: >-
                                This is the URL where the generated image can be
                                found. It will take a few seconds for the image
                                to become available via this URL if sync=false.
                            uuid:
                              type: string
                        - type: object
                          properties:
                            blocked:
                              type: boolean
                            error_code:
                              type: string
                            description:
                              type: string
              examples:
                success:
                  value:
                    result:
                      - urls: >-
                          https://storage.server/generate_image/some_uuid/seed_111111.png
                        seed: 111111
                        uuid: some_uuid_111111
                      - urls: >-
                          https://storage.server/generate_image/some_uuid/seed_222222.png
                        seed: 222222
                        uuid: some_uuid_222222
                partial_success:
                  value:
                    result:
                      - urls: >-
                          https://storage.server/generate_image/some_uuid/seed_111111.png
                        seed: 111111
                        uuid: some_uuid_111111
                      - blocked: true
                        error_code: '422'
                        description: >-
                          The request could not be completed because the
                          generated visual did not pass content moderation.
        '209':
          description: >-
            Successful operation, a model version that is no longer available
            was requested. The request was redirected to the latest model
            version.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    description: >-
                      There are multiple objects in this array (based on the
                      amount specified in num_results) and each object
                      represents a single image or a blocked result.
                    items:
                      oneOf:
                        - type: object
                          properties:
                            seed:
                              type: integer
                              description: >-
                                If you want to recreate the result again, you
                                should use in the request the prompt and the
                                seed of the response.
                            urls:
                              type: string
                              description: >-
                                This is the URL where the generated image can be
                                found. It will take a few seconds for the image
                                to become available via this URL if sync=false.
                            uuid:
                              type: string
                        - type: object
                          properties:
                            blocked:
                              type: boolean
                            error_code:
                              type: string
                            description:
                              type: string
        '400':
          description: Bad request.
        '403':
          description: Forbidden. Insufficient permissions to access the image URL.
        '404':
          description: Not Found. Model with the specified ID does not exist
        '405':
          description: Method not allowed.
        '415':
          description: >-
            Unsupported Media Type. Invalid file type. Supported file types are
            jpeg, jpg, png, webp.
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                type: string
              examples:
                input_violation:
                  value: >-
                    The request could not be completed because the visual in the
                    '{parameter_name}' parameter did not pass content
                    moderation.
                all_outputs_blocked:
                  value: >-
                    The request could not be completed because all generated
                    visuals did not pass content moderation.
                invalid_url:
                  value: >-
                    Unprocessable Entity. The URL does not point to a valid
                    image or is inaccessible.
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error.
  /text-to-vector/tailored/{model_id}:
    post:
      summary: Generate Vector Graphics - Tailored (Beta)
      tags:
        - Generation Endpoints
      description: >-


        **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.

        This API endpoint supports content moderation via an optional parameter
        that can prevent generation if input images contain inappropriate
        content, and filters out unsafe generated images - the first blocked
        input image will fail the entire request.
      operationId: text-to-vector-tailored
      parameters:
        - in: path
          name: model_id
          schema:
            type: string
          required: true
          description: >-
            The model id of the tailored model you would like to use in the
            request.
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: >-
                    The prompt you would like to use to generate images. Bria
                    currently supports prompts in English only, excluding
                    special characters.
                num_results:
                  type: integer
                  description: >-
                    How many images you would like to generate. This parameter
                    is optional. When fast=false, only num_results 1, 2 are
                    supported.
                  minimum: 1
                  maximum: 4
                  default: 4
                aspect_ratio:
                  type: string
                  description: >-
                    The aspect ratio of the image. When a ControlNet is being
                    used, the aspect ratio is defined by the guidance image and
                    this parameter is ignored.
                  default: '1:1'
                  enum:
                    - '1:1'
                    - '2:3'
                    - '3:2'
                    - '3:4'
                    - '4:3'
                    - '4:5'
                    - '5:4'
                    - '9:16'
                    - '16:9'
                sync:
                  type: boolean
                  description: >-
                    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.
                  default: true
                fast:
                  type: boolean
                  default: true
                  description: >-
                    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:
                  type: integer
                  description: >-
                    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:
                  type: integer
                  description: >-
                    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.
                  minimum: 4
                  maximum: 20
                  default: 8
                model_influence:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1.5
                  default: 1
                  description: >-
                    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:
                  type: boolean
                  default: true
                  description: >-
                    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.
                content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to both input
                    visuals and generated outputs.


                    For input images:

                    - Processing stops at the first image that fails moderation

                    - Returns a 422 error with details about which parameter
                    failed


                    For synchronous requests (sync=true):

                    - If all generated images fail moderation, returns a 422
                    error

                    - If some images pass and others fail, returns a 200
                    response with successful generations and "blocked" objects
                    for failed ones


                    For asynchronous requests (sync=false):

                    - Failed images are replaced with zero-byte files at their
                    placeholder URLs

                    - Successful images are stored at their original placeholder
                    URLs
                guidance_method_1:
                  type: string
                  enum:
                    - controlnet_canny
                    - controlnet_depth
                    - controlnet_recoloring
                    - controlnet_color_grid
                  description: >-
                    Which guidance type you would like to include in the
                    generation. Up to 2 guidance methods can be combined during
                    a single inference. This parameter is optional.
                guidance_method_1_scale:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: The impact of the guidance.
                guidance_method_1_image_file:
                  type: string
                  description: >-
                    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:
                  type: string
                  enum:
                    - controlnet_canny
                    - controlnet_depth
                    - controlnet_recoloring
                    - controlnet_color_grid
                  description: >-
                    Which guidance type you would like to include in the
                    generation. Up to 2 guidance methods can be combined during
                    a single inference. This parameter is optional.
                guidance_method_2_scale:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: The impact of the guidance.
                guidance_method_2_image_file:
                  type: string
                  description: >-
                    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:
                  type: string
                  enum:
                    - regular
                    - style_only
                  default: regular
                  description: >
                    - `regular`: Uses the image’s content, style elements, and
                    color palette to guide generation.

                    - `style_only`: Uses the image’s high-level style elements
                    and color palette to influence the generated output.

                    At the moment, tailored models trained using the 'Max'
                    training version, do not support image prompt guidense.
                image_prompt_file:
                  type: string
                  description: >
                    The image file to be used as guidance, in base64 format.
                    Accepted formats are jpeg, jpg, png, webp.

                    Maximum file size 12MB. This image can be of any aspect
                    ratio, even when it's not alligned with the one defined in
                    the parameter 'aspect_ratio' or by visuals provided to the
                    ControlNets.
                image_prompt_urls:
                  type: array
                  items:
                    type: string
                    format: uri
                  description: >
                    A list of URLs of images that should be used as guidance.
                    The images can be of different aspect ratios. Accepted
                    formats are jpeg, jpg, png, webp.

                    The URLs should point to accessible, publicly available
                    images.
                image_prompt_scale:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: >
                    The impact of the provided image on the generated results. A
                    value between 0.0 (no impact) and 1.0 (full impact).
            examples:
              valid prompt:
                value:
                  prompt: a book
                  num_results: 2
                  sync: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    description: >-
                      There are multiple objects in this array (based on the
                      amount specified in num_results) and each object
                      represents a single image or a blocked result.
                    items:
                      oneOf:
                        - type: object
                          properties:
                            seed:
                              type: integer
                              description: >-
                                If you want to recreate the result again, you
                                should use in the request the prompt and the
                                seed of the response.
                            urls:
                              type: string
                              description: >-
                                This is the URL where the generated image can be
                                found. It will take a few seconds for the image
                                to become available via this URL if sync=false.
                            uuid:
                              type: string
                        - type: object
                          properties:
                            blocked:
                              type: boolean
                            error_code:
                              type: string
                            description:
                              type: string
              examples:
                success:
                  value:
                    result:
                      - urls: >-
                          https://storage.server/generate_image/some_uuid/seed_111111.png
                        seed: 111111
                        uuid: some_uuid_111111
                      - urls: >-
                          https://storage.server/generate_image/some_uuid/seed_222222.png
                        seed: 222222
                        uuid: some_uuid_222222
                partial_success:
                  value:
                    result:
                      - urls: >-
                          https://storage.server/generate_image/some_uuid/seed_111111.png
                        seed: 111111
                        uuid: some_uuid_111111
                      - blocked: true
                        error_code: '422'
                        description: >-
                          The request could not be completed because the
                          generated visual did not pass content moderation.
        '209':
          description: >-
            Successful operation, a model version that is no longer available
            was requested. The request was redirected to the latest model
            version.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    description: >-
                      There are multiple objects in this array (based on the
                      amount specified in num_results) and each object
                      represents a single image or a blocked result.
                    items:
                      oneOf:
                        - type: object
                          properties:
                            seed:
                              type: integer
                              description: >-
                                If you want to recreate the result again, you
                                should use in the request the prompt and the
                                seed of the response.
                            urls:
                              type: string
                              description: >-
                                This is the URL where the generated image can be
                                found. It will take a few seconds for the image
                                to become available via this URL if sync=false.
                            uuid:
                              type: string
                        - type: object
                          properties:
                            blocked:
                              type: boolean
                            error_code:
                              type: string
                            description:
                              type: string
        '400':
          description: Bad request.
        '403':
          description: Forbidden. Insufficient permissions to access the image URL.
        '404':
          description: Not Found. Model with the specified ID does not exist
        '405':
          description: Method not allowed.
        '415':
          description: >-
            Unsupported Media Type. Invalid file type. Supported file types are
            jpeg, jpg, png, webp.
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                type: string
              examples:
                input_violation:
                  value: >-
                    The request could not be completed because the visual in the
                    '{parameter_name}' parameter did not pass content
                    moderation.
                all_outputs_blocked:
                  value: >-
                    The request could not be completed because all generated
                    visuals did not pass content moderation.
                invalid_url:
                  value: >-
                    Unprocessable Entity. The URL does not point to a valid
                    image or is inaccessible.
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error.
  /tailored-gen/restyle_portrait:
    post:
      summary: Restyle Portrait
      tags:
        - Generation Endpoints
      description: >
        This endpoint lets you change the style of a portrait while keeping the
        person’s id. 

        It works by using a reference image of the person along with a trained
        tailored model.


        This capability is specifically designed for portraits that capture the
        subject from the torso up, with a recommended face size of at least
        500×500 pixels. Images that do not meet these guidelines may produce
        inconsistent results.
      operationId: restyle-portrait
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id_image_url:
                  type: string
                  format: uri
                  description: >
                    The URL of the ID reference image. If both `id_image_url`
                    and `id_image_file` are provided, 

                    `id_image_url` will be used. Accepted formats: `jpeg`,
                    `jpg`, `png`, `webp`.
                id_image_file:
                  type: string
                  format: binary
                  description: >
                    The image file containing the ID reference. This parameter
                    is used if `id_image_url` is not provided. 

                    Accepted formats: `jpeg`, `jpg`, `png`, `webp`.
                tailored_model_id:
                  type: string
                  description: The ID of the tailored model to use for generation.
                  required: true
                tailored_model_influence:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1.5
                  default: 0.9
                  description: The influence of the tailored model on the generated image.
                id_strength:
                  type: number
                  format: float
                  minimum: 0
                  maximum: 1
                  default: 0.7
                  description: Strength of the instant ID.
                sync:
                  type: boolean
                  default: true
                  description: >-
                    Determines the response mode. When `true`, the request is
                    synchronous.
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    description: List of generated images or blocked results.
                    items:
                      type: object
                      properties:
                        image_url:
                          type: string
                          format: uri
                          description: URL where the generated image is stored.
        '400':
          description: Bad request. Missing or invalid parameters.
        '401':
          description: Unauthorized. Invalid API key or authentication token.
        '403':
          description: Forbidden. Insufficient permissions to access the image URL.
        '415':
          description: >-
            Unsupported Media Type. Accepted formats `jpeg`, `jpg`, `png`,
            `webp`.
        '422':
          description: >-
            Unprocessable Entity. The provided image URL is invalid or
            inaccessible.
        '500':
          description: Internal Server Error. A server-side error occurred.
  /tailored-gen/projects:
    post:
      summary: Create Project
      tags:
        - Training Endpoints
      description: >
        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.

        <img
        src="https://bria-datasets.s3.us-east-1.amazonaws.com/api_doc/tailored_gen/multi_object_set.png"
        alt="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.

        <img
        src="https://bria-datasets.s3.us-east-1.amazonaws.com/api_doc/tailored_gen/object_variants.png"
        alt="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.

        <img
        src="https://bria-datasets.s3.us-east-1.amazonaws.com/api_doc/tailored_gen/icons.png"
        alt="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.

        <img
        src="https://bria-datasets.s3.us-east-1.amazonaws.com/api_doc/tailored_gen/defined_character.png"
        alt="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.

        <img
        src="https://bria-datasets.s3.us-east-1.amazonaws.com/api_doc/tailored_gen/character_variants.png"
        alt="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.

        <img
        src="https://bria-datasets.s3.us-east-1.amazonaws.com/api_doc/tailored_gen/stylized_scene.png"
        alt="Example of stylized scene showing cohesive environment" />
      operationId: create-project
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                project_name:
                  type: string
                  description: Name of the project (required)
                project_description:
                  type: string
                  description: Description of the project (optional)
                ip_name:
                  type: string
                  description: >-
                    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:
                  type: string
                  description: >-
                    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:
                  type: string
                  enum:
                    - photography
                    - illustration
                  description: |
                    Medium of the IP (required)
                    * photography
                    * illustration
                ip_type:
                  type: string
                  enum:
                    - multi_object_set
                    - object_variants
                    - icons
                    - defined_character
                    - character_variants
                    - stylized_scene
                    - other
                  description: >
                    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
            example:
              project_name: Branded Character
              ip_name: Adventure Series Characters
              ip_description: A set of adventure game characters with unique personalities
              ip_medium: illustration
              ip_type: defined_character
      responses:
        '201':
          description: Project successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the project
                  project_name:
                    type: string
                    description: Name of the project
                  project_description:
                    type: string
                    description: Description of the project
                  ip_name:
                    type: string
                    description: Name of the IP
                  ip_description:
                    type: string
                    description: Description of the IP
                  ip_medium:
                    type: string
                    description: Medium of the IP
                  ip_type:
                    type: string
                    description: Type of the IP
                  status:
                    type: string
                    enum:
                      - active
                    description: Status of the project
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the project was created
              example:
                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'
        '400':
          description: Bad request - validation error
        '401':
          description: Unauthorized
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    get:
      summary: Get Projects
      tags:
        - Training Endpoints
      description: >-
        Retrieve all projects within the organization. If there are no projects,
        returns an empty array.
      operationId: get-projects
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved projects
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the project
                    project_name:
                      type: string
                      description: Name of the project
                    project_description:
                      type: string
                      description: Description of the project
                    ip_name:
                      type: string
                      description: Name of the IP
                    ip_description:
                      type: string
                      description: Description of the IP
                    ip_medium:
                      type: string
                      description: Medium of the IP
                      enum:
                        - photography
                        - illustration
                    ip_type:
                      type: string
                      description: Type of the IP
                      enum:
                        - multi_object_set
                        - object_variants
                        - defined_object
                        - icons
                        - defined_character
                        - character_variants
                        - stylized_scene
                        - other
                    status:
                      type: string
                      description: Status of the project
                      enum:
                        - active
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the project was created
                    updated_at:
                      type: string
                      format: date-time
                      description: Timestamp when the project was last updated
              example:
                - 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'
                  updated_at: '2024-05-26T14:30:00Z'
                - id: 124
                  project_name: Branded icons
                  project_description: ''
                  ip_name: ''
                  ip_description: ''
                  ip_medium: illustration
                  ip_type: icons
                  status: active
                  created_at: '2024-05-27T09:00:00Z'
                  updated_at: '2024-05-27T10:15:00Z'
        '401':
          description: Unauthorized
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/projects/{project_id}:
    get:
      summary: Get Project by ID
      tags:
        - Training Endpoints
      description: >-
        Retrieve full project information including project name and
        description, IP name and description, IP medium
        (photography/illustration), IP type, status, and timestamps.
      operationId: get-project-by-id
      parameters:
        - in: path
          name: project_id
          schema:
            type: string
          required: true
          description: Project ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved project
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the project
                  project_name:
                    type: string
                    description: Name of the project
                  project_description:
                    type: string
                    description: Description of the project
                  ip_name:
                    type: string
                    description: Name of the IP
                  ip_description:
                    type: string
                    description: Description of the IP
                  ip_medium:
                    type: string
                    description: Medium of the IP
                    enum:
                      - photography
                      - illustration
                  ip_type:
                    type: string
                    description: Type of the IP
                    enum:
                      - multi_object_set
                      - object_variants
                      - defined_object
                      - icons
                      - defined_character
                      - character_variants
                      - stylized_scene
                      - other
                  status:
                    type: string
                    description: Status of the project
                    enum:
                      - active
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the project was created
              example:
                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'
        '401':
          description: Unauthorized
        '404':
          description: Project not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    put:
      summary: Update Project
      tags:
        - Training Endpoints
      description: Update a specific project
      operationId: update-project
      parameters:
        - in: path
          name: project_id
          schema:
            type: string
          required: true
          description: Project ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                project_name:
                  type: string
                  description: New project name (optional)
                project_description:
                  type: string
                  description: New project description (optional)
                ip_name:
                  type: string
                  description: New IP name (optional)
                ip_description:
                  type: string
                  description: New IP description (optional)
            example:
              ip_description: A girl with purple hair
      responses:
        '200':
          description: Project successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the project
                  project_name:
                    type: string
                    description: Name of the project
                  project_description:
                    type: string
                    description: Description of the project
                  ip_name:
                    type: string
                    description: Name of the IP
                  ip_description:
                    type: string
                    description: Description of the IP
                  ip_medium:
                    type: string
                    description: Medium of the IP
                    enum:
                      - photography
                      - illustration
                  ip_type:
                    type: string
                    description: Type of the IP
                    enum:
                      - multi_object_set
                      - object_variants
                      - defined_object
                      - icons
                      - defined_character
                      - character_variants
                      - stylized_scene
                      - other
                  status:
                    type: string
                    description: Status of the project
                    enum:
                      - active
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the project was created
              example:
                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'
        '401':
          description: Unauthorized
        '404':
          description: Project not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    delete:
      summary: Delete Project
      tags:
        - Training Endpoints
      description: >-
        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.
      operationId: delete-project
      parameters:
        - in: path
          name: project_id
          schema:
            type: string
          required: true
          description: Project ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Project successfully deleted
        '401':
          description: Unauthorized
        '404':
          description: Project not found
        '409':
          description: Cannot delete project while models are in training
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/generate_prefix:
    post:
      summary: Generate Caption Prefix
      tags:
        - Training Endpoints
      description: >
        Generates a caption prefix based on the provided images.  



        This is currently supported only when `ip_type` is `stylized_scene`
        (both `illustration` and `photography` mediums).  



        ##### Usage Scenarios:

        1. **Before uploading visuals to a new dataset**  
          - This use case applies when creating a new dataset.  
          - In the first step, you can **create the dataset entity in parallel** while calling this endpoint.  
          - Randomly **sample 1-6 images from the input images provided for training**. If there are **6 or more images**, provide exactly **6** for the best results.  
          - Once you receive the prefix, update the dataset using the **Update Dataset** endpoint.  
          - Then, proceed with uploading images to the dataset.

        2. **To regenerate a new prefix (even if previously generated)**  
          - This allows users to select the prefix they prefer.  
          - Randomly **sample 1-6 images from the input images provided for training**. If there are **6 or more images**, provide exactly **6** for the best results.  
          - Update the dataset with the new prefix.  
          - Then, use the **Regenerate All Captions** endpoint to ensure all images in the dataset get updated captions.



        If any image fails validation, the request will fail.  



        This API endpoint supports content moderation via an optional parameter
        that can prevent processing if input images contain inappropriate
        content - the first blocked input image will fail the entire request.
      operationId: generate-prefix
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
          description: Authentication token.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                image_urls:
                  type: array
                  items:
                    type: string
                  description: >-
                    An array of 1-6 image URLs. Either `image_urls` or `images`
                    must be provided, but not both.
                images:
                  type: array
                  items:
                    type: string
                  description: >-
                    An array of 1-6 base64-encoded images. Either `image_urls`
                    or `images` must be provided, but not both.
                ip_type:
                  type: string
                  enum:
                    - stylized_scene
                  description: Must be `stylized_scene`. Other values are not supported.
                ip_medium:
                  type: string
                  enum:
                    - photography
                    - illustration
                  description: The IP medium of the dataset.
                content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to both input
                    visuals and generated outputs.

                    - Processing stops at the first image that fails moderation

                    - Returns a 422 error with details about which parameter
                    failed
            examples:
              example_request_urls:
                summary: Example request using image URLs
                value:
                  image_urls:
                    - https://fake-image-host.com/images/sample1.jpg
                    - https://fake-image-host.com/images/sample2.jpg
                    - https://fake-image-host.com/images/sample3.jpg
                  ip_type: stylized_scene
                  ip_medium: illustration
                  content_moderation: true
              example_request_base64:
                summary: Example request using base64 images
                value:
                  images:
                    - /9j/4AAQSkZJRgABAQAAAQABAAD...
                    - /9j/4AAQSkZJRgABAQAAAQABAAD...
                  ip_type: stylized_scene
                  ip_medium: photography
                  content_moderation: false
      responses:
        '200':
          description: Successfully generated caption prefix.
          content:
            application/json:
              schema:
                type: object
                properties:
                  prefix:
                    type: string
                    description: The generated caption prefix.
              example:
                prefix: >-
                  A photo in a style defined by vibrant purple hues, moody
                  lighting effects, featuring 
        '400':
          description: Bad request. The request is malformed.
        '401':
          description: Unauthorized. Missing or invalid API token.
        '415':
          description: Unsupported Media Type. One or more images are in an invalid format.
          content:
            application/json:
              schema:
                type: object
                properties:
                  prefix:
                    type: string
                    nullable: true
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        error_code:
                          type: integer
                          description: HTTP status code of the error.
                        description:
                          type: string
                          description: Error message.
                        image_number:
                          type: integer
                          description: Index of the image that caused the error.
              examples:
                single_image_failure:
                  summary: Example response for a single failed image
                  value: The provided image is not in a supported media type.
                multiple_image_errors:
                  summary: Example response for multiple image failures
                  value:
                    prefix: null
                    errors:
                      - error_code: 415
                        description: The provided image is not in a supported media type.
                        image_number: 0
                      - error_code: 415
                        description: The provided image is not in a supported media type.
                        image_number: 2
                      - error_code: 422
                        description: The provided image did not pass content moderation.
                        image_number: 3
        '422':
          description: >-
            Unprocessable Entity. The provided image did not pass content
            moderation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  prefix:
                    type: string
                    nullable: true
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        error_code:
                          type: integer
                          description: HTTP status code of the error.
                        description:
                          type: string
                          description: Error message.
                        image_number:
                          type: integer
                          description: Index of the image that caused the error.
              examples:
                single_image_failure:
                  summary: Example response for a single failed image (422)
                  value: The provided image did not pass content moderation.
                multiple_image_errors:
                  summary: Example response for multiple image failures (422)
                  value:
                    prefix: null
                    errors:
                      - error_code: 422
                        description: The provided image did not pass content moderation.
                        image_number: 1
                      - error_code: 422
                        description: The provided image did not pass content moderation.
                        image_number: 3
                      - error_code: 415
                        description: The provided image is not in a supported media type.
                        image_number: 4
        '429':
          description: Request limit exceeded. Too many requests in a short time.
        '500':
          description: Internal server error.
  /tailored-gen/datasets:
    post:
      summary: Create Dataset
      tags:
        - Training Endpoints
      description: >
        Create a new dataset.


        Constraints:

        * Dataset must have at least 1 image to be completed

        * Maximum of 200 images per dataset



        When creating a dataset, a defoult caption prefix is created in all
        cases.


        **Generating an advanced Caption Prefix Before Uploading Images**  

        When creating a dataset with `ip_type = stylized_scene` (for both
        `illustration` and `photography` mediums), it is **recommended** to
        generate an advanced caption prefix before uploading images.  


        To do this, use the **/tailored-gen/generate_prefix** endpoint, send up
        to 6 images, and update the dataset with the received prefix using the
        **Update Dataset** endpoint. Once the prefix is updated, proceed with
        uploading images.
      operationId: create-dataset
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                project_id:
                  type: integer
                  description: Associated project ID (required)
                name:
                  type: string
                  description: Dataset name (required)
            example:
              project_id: 123
              name: dataset v1
      responses:
        '201':
          description: Dataset successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the dataset
                  project_id:
                    type: integer
                    description: Associated project ID
                  name:
                    type: string
                    description: Dataset name
                  caption_prefix:
                    type: string
                    description: >-
                      Text automatically prepended to all image captions in the
                      dataset. Each image caption should naturally continues
                      this prefix. A default prefix is automatically created but
                      can be modified, and this same prefix is later used as the
                      default generation prefix during image generation.
                  status:
                    type: string
                    description: Status of the dataset
                    enum:
                      - draft
                  captions_update_status:
                    type: string
                    description: Status of captions update process
                    enum:
                      - empty
                      - in_progress
                      - completed
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was last updated
              example:
                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'
        '400':
          description: Bad request - validation error
        '401':
          description: Unauthorized
        '404':
          description: Project not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    get:
      summary: Get Datasets
      tags:
        - Training Endpoints
      description: >-
        Retrieve a list of all datasets. If there are no datasets, returns an
        empty array.
      operationId: get-datasets
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved datasets
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the dataset
                    project_id:
                      type: integer
                      description: Associated project ID
                    name:
                      type: string
                      description: Dataset name
                    caption_prefix:
                      type: string
                      description: >-
                        Text automatically prepended to all image captions in
                        the dataset. Each image caption should naturally
                        continues this prefix. A default prefix is automatically
                        created but can be modified, and this same prefix is
                        later used as the default generation prefix during image
                        generation.
                    status:
                      type: string
                      description: Status of the dataset
                      enum:
                        - draft
                        - completed
                    captions_update_status:
                      type: string
                      description: Status of captions update process
                      enum:
                        - empty
                        - in_progress
                        - completed
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the dataset was created
                    updated_at:
                      type: string
                      format: date-time
                      description: Timestamp when the dataset was last updated
              example:
                - 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-26T14:30:00Z'
                - id: 457
                  project_id: 124
                  name: dataset v2
                  caption_prefix: >-
                    An illustration of a character named Max, a male character
                    with spiky black hair,
                  status: draft
                  captions_update_status: empty
                  created_at: '2024-05-27T09:00:00Z'
                  updated_at: '2024-05-27T09:00:00Z'
        '401':
          description: Unauthorized
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/projects/{project_id}/datasets:
    get:
      summary: Get Datasets by Project
      tags:
        - Training Endpoints
      description: Retrieve all datasets for a specific project
      operationId: get-datasets-by-project
      parameters:
        - in: path
          name: project_id
          schema:
            type: string
          required: true
          description: Project ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
        - in: query
          name: include_models
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            If true, a list of model objects using the dataset should be
            included in the response under the parameter 'models'
        - in: query
          name: include_models_ids
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            If true, a list of model ids using the dataset should be included in
            the response under the parameter 'model_ids'
      responses:
        '200':
          description: Successfully retrieved datasets
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the dataset
                    project_id:
                      type: integer
                      description: Associated project ID
                    name:
                      type: string
                      description: Dataset name
                    caption_prefix:
                      type: string
                      description: >-
                        Text automatically prepended to all image captions in
                        the dataset. Each image caption should naturally
                        continues this prefix. A default prefix is automatically
                        created but can be modified, and this same prefix is
                        later used as the default generation prefix during image
                        generation.
                    images_count:
                      type: integer
                      description: Number of images in the dataset
                    status:
                      type: string
                      description: Status of the dataset
                      enum:
                        - draft
                        - completed
                    captions_update_status:
                      type: string
                      description: Status of captions update process
                      enum:
                        - empty
                        - in_progress
                        - completed
                    models:
                      type: array
                      description: >-
                        List of model objects using this dataset. Only included
                        when include_models=true
                      items:
                        type: object
                    model_ids:
                      type: array
                      description: >-
                        List of model IDs using this dataset. Only included when
                        include_models_ids=true
                      items:
                        type: string
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the dataset was created
                    updated_at:
                      type: string
                      format: date-time
                      description: Timestamp when the dataset was last updated
              example:
                - id: 456
                  project_id: 123
                  name: dataset v1
                  caption_prefix: >-
                    An illustration of a character named Lora, a female
                    character with purple hair,
                  images_count: 15
                  status: completed
                  captions_update_status: empty
                  created_at: '2024-05-26T12:00:00Z'
                  updated_at: '2024-05-26T14:30:00Z'
                - id: 457
                  project_id: 123
                  name: dataset v2
                  caption_prefix: >-
                    An illustration of a character named Max, a male character
                    with spiky black hair,
                  images_count: 8
                  status: draft
                  captions_update_status: empty
                  created_at: '2024-05-27T09:00:00Z'
                  updated_at: '2024-05-27T09:00:00Z'
        '401':
          description: Unauthorized
        '404':
          description: Project not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/datasets/{dataset_id}:
    get:
      summary: Get Dataset by ID
      tags:
        - Training Endpoints
      description: Retrieve a specific dataset
      operationId: get-dataset-by-id
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved dataset
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the dataset
                  project_id:
                    type: integer
                    description: Associated project ID
                  name:
                    type: string
                    description: Dataset name
                  caption_prefix:
                    type: string
                    description: >-
                      Text automatically prepended to all image captions in the
                      dataset. Each image caption should naturally continues
                      this prefix. A default prefix is automatically created but
                      can be modified, and this same prefix is later used as the
                      default generation prefix during image generation.
                  status:
                    type: string
                    description: Status of the dataset
                    enum:
                      - draft
                      - completed
                  captions_update_status:
                    type: string
                    description: Status of captions update process
                    enum:
                      - empty
                      - in_progress
                      - completed
                  images_count:
                    type: integer
                    description: Number of images in the dataset
                  images:
                    type: array
                    description: Array of images in the dataset
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: Unique identifier for the image
                        dataset_id:
                          type: integer
                          description: ID of the dataset this image belongs to
                        caption:
                          type: string
                          description: >-
                            Once an image is uploaded, a caption is generated
                            automatically. The caption is a natural continuation
                            of the caption_prefix.
                        caption_source:
                          type: string
                          description: Source of the caption
                          enum:
                            - automatic
                            - manual
                        image_name:
                          type: string
                          description: Name of the image
                        image_url:
                          type: string
                          description: URL of the original image file
                        thumbnail_url:
                          type: string
                          description: URL of the image thumbnail
                        created_at:
                          type: string
                          format: date-time
                          description: Timestamp when the image was created
                        updated_at:
                          type: string
                          format: date-time
                          description: Timestamp when the image was last updated
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was last updated
              example:
                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:
                  - id: 789
                    dataset_id: 456
                    caption: standing in a confident pose wearing a blue dress
                    caption_source: automatic
                    image_name: lora_standing.png
                    image_url: https://api.example.com/files/lora_standing.png
                    thumbnail_url: https://api.example.com/files/lora_standing_thumb.png
                    created_at: '2024-05-26T12:30:00Z'
                    updated_at: '2024-05-26T12:30:00Z'
                  - id: 790
                    dataset_id: 456
                    caption: sitting on a chair with a gentle smile
                    caption_source: automatic
                    image_name: lora_sitting.png
                    image_url: https://api.example.com/files/lora_sitting.png
                    thumbnail_url: https://api.example.com/files/lora_sitting_thumb.png
                    created_at: '2024-05-26T12:45:00Z'
                    updated_at: '2024-05-26T12:45:00Z'
                created_at: '2024-05-26T12:00:00Z'
                updated_at: '2024-05-26T14:30:00Z'
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    put:
      summary: Update Dataset
      tags:
        - Training Endpoints
      description: >
        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



        **Updating the Caption Prefix**  

        If the caption prefix needs to be changed, update it here first,  

        then use the **Regenerate All Captions** endpoint to refresh all
        captions with the new prefix.  

        If you want to generate an advanced **new caption prefix**,  

        use the `/tailored-gen/generate_prefix` endpoint before updating the
        dataset.



        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
      operationId: update-dataset
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New dataset name (optional)
                caption_prefix:
                  type: string
                  description: >-
                    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/. Use
                    `/tailored-gen/generate_prefix` to generate an advanced
                    prefix.
                status:
                  type: string
                  description: >-
                    Dataset status (optional). Can be set to completed to enable
                    usage in model training
                  enum:
                    - draft
                    - completed
            example:
              status: completed
      responses:
        '200':
          description: Dataset successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the dataset
                  project_id:
                    type: integer
                    description: Associated project ID
                  name:
                    type: string
                    description: Dataset name
                  caption_prefix:
                    type: string
                    description: >-
                      Text automatically prepended to all image captions in the
                      dataset. Each image caption should naturally continues
                      this prefix. A default prefix is automatically created but
                      can be modified, and this same prefix is later used as the
                      default generation prefix during image generation.
                  status:
                    type: string
                    description: Status of the dataset
                    enum:
                      - draft
                      - completed
                  captions_update_status:
                    type: string
                    description: Status of captions update process
                    enum:
                      - empty
                      - in_progress
                      - completed
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was last updated
              example:
                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'
        '400':
          description: Bad request - validation error
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '409':
          description: Conflict error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message explaining the conflict
              examples:
                caption_prefix_error:
                  value:
                    message: Cannot update caption prefix for a completed dataset
                completion_error:
                  value:
                    message: >-
                      Cannot mark dataset as completed. Dataset must have at
                      least 1 image
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    delete:
      summary: Delete Dataset
      tags:
        - Training Endpoints
      description: Delete a specific dataset. Deletes all associated images.
      operationId: delete-dataset
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Dataset successfully deleted
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '409':
          description: Cannot delete a dataset that is used by a model that is in training
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/datasets/{dataset_id}/clone:
    post:
      summary: Clone Dataset As Draft
      tags:
        - Training Endpoints
      description: >-
        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).
      operationId: clone-dataset
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New dataset name. Defaults to "Copy of [original name]"
                description:
                  type: string
                  description: New dataset description. Defaults to original description
            example:
              name: Copy of dataset v1 - modified version
              description: Modified version with additional poses
      responses:
        '201':
          description: Dataset successfully cloned
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the dataset
                  project_id:
                    type: integer
                    description: Associated project ID
                  name:
                    type: string
                    description: Dataset name
                  caption_prefix:
                    type: string
                    description: >-
                      Text automatically prepended to all image captions in the
                      dataset. Each image caption should naturally continues
                      this prefix. A default prefix is automatically created but
                      can be modified, and this same prefix is later used as the
                      default generation prefix during image generation.
                  status:
                    type: string
                    description: Status of the dataset
                    enum:
                      - draft
                  captions_update_status:
                    type: string
                    description: Status of captions update process
                    enum:
                      - empty
                      - in_progress
                      - completed
                  images_count:
                    type: integer
                    description: Number of images in the dataset
                  images:
                    type: array
                    description: Array of images in the dataset
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: Unique identifier for the image
                        dataset_id:
                          type: integer
                          description: ID of the dataset this image belongs to
                        caption:
                          type: string
                          description: >-
                            Once an image is uploaded, a caption is generated
                            automatically. The caption is a natural continuation
                            of the caption_prefix.
                        caption_source:
                          type: string
                          description: Source of the caption
                          enum:
                            - automatic
                        image_name:
                          type: string
                          description: Name of the image
                        image_url:
                          type: string
                          description: URL of the original image file
                        thumbnail_url:
                          type: string
                          description: URL of the image thumbnail
                        created_at:
                          type: string
                          format: date-time
                          description: Timestamp when the image was created
                        updated_at:
                          type: string
                          format: date-time
                          description: Timestamp when the image was last updated
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was last updated
              example:
                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:
                  - id: 791
                    dataset_id: 457
                    caption: standing in a confident pose wearing a blue dress
                    caption_source: automatic
                    image_name: lora_standing.png
                    image_url: https://api.example.com/files/lora_standing.png
                    thumbnail_url: https://api.example.com/files/lora_standing_thumb.png
                    created_at: '2024-05-26T15:30:00Z'
                    updated_at: '2024-05-26T15:30:00Z'
                  - id: 792
                    dataset_id: 457
                    caption: sitting on a chair with a gentle smile
                    caption_source: automatic
                    image_name: lora_sitting.png
                    image_url: https://api.example.com/files/lora_sitting.png
                    thumbnail_url: https://api.example.com/files/lora_sitting_thumb.png
                    created_at: '2024-05-26T15:30:00Z'
                    updated_at: '2024-05-26T15:30:00Z'
                created_at: '2024-05-26T15:30:00Z'
                updated_at: '2024-05-26T15:30:00Z'
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/datasets/{dataset_id}/images:
    post:
      summary: Upload Image
      tags:
        - Training Endpoints
      description: >
        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


        This API endpoint supports content moderation via an optional parameter
        that can prevent processing if input images contain inappropriate
        content - the first blocked input image will fail the entire request.
      operationId: upload-image
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: Image file to upload (required if image_url not provided)
                image_url:
                  type: string
                  description: URL of image to upload (required if file not provided)
                image_name:
                  type: string
                  description: Custom name for the image (optional)
                content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visuals.


                    For input images:

                    - Processing stops at the first image that fails moderation

                    - Returns a 422 error with details about which parameter
                    failed
            example:
              image_url: https://example.com/images/character_pose.jpg
              image_name: character_standing_pose.jpg
      responses:
        '201':
          description: Image successfully uploaded
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the image
                  dataset_id:
                    type: integer
                    description: ID of the dataset this image belongs to
                  caption:
                    type: string
                    description: >-
                      Once an image is uploaded, a caption is generated
                      automatically. The caption is a natural continuation of
                      the caption_prefix.
                  caption_source:
                    type: string
                    description: Source of the caption
                    enum:
                      - automatic
                      - manual
                  image_name:
                    type: string
                    description: Name of the image
                  file:
                    type: string
                    description: >-
                      file of the original image file in base64 format. Either
                      file or image_url should be provided, not both.
                  image_url:
                    type: string
                    description: URL of the original image file.
                  thumbnail_url:
                    type: string
                    description: URL of the image thumbnail
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the image was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the image was last updated
              example:
                id: 789
                dataset_id: 456
                caption: standing in a confident pose wearing a blue dress
                caption_source: automatic
                image_name: lora_standing.png
                image_url: https://api.example.com/files/lora_standing.png
                thumbnail_url: https://api.example.com/files/lora_standing_thumb.png
                created_at: '2024-05-26T12:30:00Z'
                updated_at: '2024-05-26T12:30:00Z'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '409':
          description: Conflict error
          content:
            application/json:
              schema:
                type: string
              examples:
                completed_dataset:
                  value: Cannot upload an image to a completed dataset
                max_images:
                  value: Maximum number of images (200) reached
        '412':
          description: Precondition Failed.
          content:
            application/json:
              schema:
                type: string
              example:
                value: The image height and width must be at least 1024x1024 pixels.
        '415':
          description: Unsupported Media Type.
          content:
            application/json:
              schema:
                type: string
              example:
                value: >-
                  The image format must be one of the following: jpg, jpeg, png,
                  webp.
        '422':
          description: Unprocessable Entity.
          content:
            application/json:
              schema:
                type: string
              examples:
                input_violation:
                  value: >-
                    The request could not be completed because the visual in the
                    '{parameter_name}' parameter did not pass content
                    moderation.
                invalid_image:
                  value: The provided image_url does not lead to an accessible image.
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    get:
      summary: Get Images
      tags:
        - Training Endpoints
      description: >-
        Retrieve all images in a specific dataset. If there are no images,
        returns an empty array.
      operationId: get-images
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved images
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the image
                    dataset_id:
                      type: integer
                      description: ID of the dataset this image belongs to
                    caption:
                      type: string
                      description: Caption describing the image
                    caption_source:
                      type: string
                      description: >-
                        Source of the caption. 'unknown' value only appears for
                        images that were uploaded using an old version of
                        Tailored Generation.
                      enum:
                        - automatic
                        - manual
                        - unknown
                    image_name:
                      type: string
                      description: Name of the image
                    image_url:
                      type: string
                      description: URL of the original image file
                    thumbnail_url:
                      type: string
                      description: URL of the image thumbnail
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the image was created
                    updated_at:
                      type: string
                      format: date-time
                      description: Timestamp when the image was last updated
              example:
                - id: 789
                  dataset_id: 456
                  caption: standing in a confident pose wearing a blue dress
                  caption_source: automatic
                  image_name: lora_standing.png
                  image_url: https://api.example.com/files/lora_standing.png
                  thumbnail_url: https://api.example.com/files/lora_standing_thumb.png
                  created_at: '2024-05-26T12:30:00Z'
                  updated_at: '2024-05-26T12:30:00Z'
                - id: 790
                  dataset_id: 456
                  caption: sitting on a chair with a gentle smile
                  caption_source: manual
                  image_name: lora_sitting.png
                  image_url: https://api.example.com/files/lora_sitting.png
                  thumbnail_url: https://api.example.com/files/lora_sitting_thumb.png
                  created_at: '2024-05-26T12:45:00Z'
                  updated_at: '2024-05-26T13:15:00Z'
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    put:
      summary: Regenerate All Captions
      tags:
        - Training Endpoints
      description: >
        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'.
      operationId: regenerate-all-captions
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '202':
          description: Caption regeneration process started
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the dataset
                  project_id:
                    type: integer
                    description: Associated project ID
                  name:
                    type: string
                    description: Dataset name
                  caption_prefix:
                    type: string
                    description: >-
                      Text automatically prepended to all image captions in the
                      dataset. Each image caption should naturally continues
                      this prefix. A default prefix is automatically created but
                      can be modified, and this same prefix is later used as the
                      default generation prefix during image generation.
                  status:
                    type: string
                    description: Status of the dataset
                    enum:
                      - draft
                      - completed
                  captions_update_status:
                    type: string
                    description: Status of captions update process
                    enum:
                      - empty
                      - in_progress
                      - completed
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the dataset was last updated
              example:
                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'
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/datasets/{dataset_id}/images/{image_id}:
    get:
      summary: Get Image by ID
      tags:
        - Training Endpoints
      description: >-
        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.
      operationId: get-image
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: path
          name: image_id
          required: true
          schema:
            type: integer
          description: Image ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved image
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the image
                  dataset_id:
                    type: integer
                    description: ID of the dataset this image belongs to
                  caption:
                    type: string
                    description: Caption describing the image
                  caption_source:
                    type: string
                    description: >-
                      Source of the caption. 'unknown' value only appears for
                      images that were uploaded using an old version of Tailored
                      Generation.
                    enum:
                      - automatic
                      - manual
                      - unknown
                  image_name:
                    type: string
                    description: Name of the image
                  image_url:
                    type: string
                    description: URL of the original image file
                  thumbnail_url:
                    type: string
                    description: URL of the image thumbnail
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the image was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the image was last updated
              example:
                id: 789
                dataset_id: 456
                caption: standing in a confident pose wearing a blue dress
                caption_source: automatic
                image_name: lora_standing.png
                image_url: https://api.example.com/files/lora_standing.png
                thumbnail_url: https://api.example.com/files/lora_standing_thumb.png
                created_at: '2024-05-26T12:30:00Z'
                updated_at: '2024-05-26T12:30:00Z'
        '401':
          description: Unauthorized
        '404':
          description: Image or dataset not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    put:
      summary: Update Image Caption
      tags:
        - Training Endpoints
      description: >
        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
      operationId: update-image-caption
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: path
          name: image_id
          required: true
          schema:
            type: integer
          description: Image ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                caption:
                  type: string
                  description: >-
                    New caption text. When provided, sets caption_source to
                    "manual"
                regenerate_caption:
                  type: boolean
                  default: false
                  description: >-
                    When true, generates new caption automatically and sets
                    caption_source to "automatic"
            examples:
              manual_caption:
                summary: Update with manual caption
                value:
                  caption: standing confidently in a defensive pose wearing armor
              regenerate_caption:
                summary: Request automatic caption regeneration
                value:
                  regenerate_caption: true
      responses:
        '200':
          description: Caption successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the image
                  dataset_id:
                    type: integer
                    description: ID of the dataset this image belongs to
                  caption:
                    type: string
                    description: Updated caption for the image
                  caption_source:
                    type: string
                    description: Source of the updated caption
                    enum:
                      - automatic
                      - manual
                  image_name:
                    type: string
                    description: Name of the image
                  image_url:
                    type: string
                    description: URL of the original image file
                  thumbnail_url:
                    type: string
                    description: URL of the image thumbnail
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the image was created
                  updated_at:
                    type: string
                    format: date-time
                    description: Timestamp when the image was last updated
              example:
                id: 789
                dataset_id: 456
                caption: standing confidently in a defensive pose wearing armor
                caption_source: manual
                image_name: lora_standing.png
                image_url: https://api.example.com/files/lora_standing.png
                thumbnail_url: https://api.example.com/files/lora_standing_thumb.png
                created_at: '2024-05-26T12:30:00Z'
                updated_at: '2024-05-26T15:45:00Z'
        '400':
          description: Bad request - Both caption and regenerate_caption provided
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
              example:
                error: Cannot provide both caption and regenerate_caption parameters
        '401':
          description: Unauthorized
        '404':
          description: Image or dataset not found
        '409':
          description: Cannot update caption in a completed dataset
        '410':
          description: Dataset deleted
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    delete:
      summary: Delete Image
      tags:
        - Training Endpoints
      description: >
        Permanently remove an image from a dataset. This will also delete the
        image files and associated thumbnails. 


        Constraints:

        * Cannot delete images from completed datasets
      operationId: delete-image
      parameters:
        - in: path
          name: dataset_id
          schema:
            type: string
          required: true
          description: Dataset ID
        - in: path
          name: image_id
          required: true
          schema:
            type: integer
          description: Image ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Image successfully deleted
        '401':
          description: Unauthorized
        '404':
          description: Image or dataset not found
        '409':
          description: Cannot delete an image from a completed dataset
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message explaining the conflict
              example:
                message: Cannot delete an image from a completed dataset
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/models:
    post:
      summary: Create Model
      tags:
        - Training Endpoints
      description: >-
        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.
      operationId: create-model
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the model (required)
                dataset_id:
                  type: integer
                  description: ID of the dataset to use (required)
                training_version:
                  type: string
                  enum:
                    - light
                    - max
                  description: >
                    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. 
                description:
                  type: string
                  description: Description of the model (optional)
            example:
              name: Lora Character Model
              dataset_id: 456
              training_version: max
              description: A model trained on Lora character illustrations
      responses:
        '201':
          description: Model successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the model
                  name:
                    type: string
                    description: Name of the model
                  description:
                    type: string
                    description: Description of the model
                  status:
                    type: string
                    description: Status of the model
                    enum:
                      - created
                  training_version:
                    type: string
                    description: Training version
                    enum:
                      - light
                      - max
                  generation_prefix:
                    type: string
                    description: >-
                      Text drawn from the dataset's caption_prefix that is
                      automatically prepended to generation prompts to maintain
                      consistency. It matches the dataset's caption_prefix. It
                      can be bypassed during generation by setting
                      include_generation_prefix=false. This field is empty upon
                      model creation, and filled after the training starts.
                  project_id:
                    type: integer
                    description: ID of the project this model belongs to
                  dataset_id:
                    type: integer
                    description: ID of the dataset used for training
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the model was created
              example:
                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'
        '400':
          description: Bad request - validation error
        '401':
          description: Unauthorized
        '404':
          description: Dataset not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    get:
      summary: Get Models
      tags:
        - Training Endpoints
      description: >-
        Retrieve a list of models. If there are no models, an empty array is
        returned.
      operationId: get-models
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved models
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the model
                    name:
                      type: string
                      description: Name of the model
                    description:
                      type: string
                      description: Description of the model
                    status:
                      type: string
                      description: Status of the model
                      enum:
                        - Created
                        - InProgress
                        - Completed
                        - Failed
                        - Stopping
                        - Stopped
                    training_version:
                      type: string
                      description: Training version
                      enum:
                        - light
                        - max
                    generation_prefix:
                      type: string
                      description: >-
                        Text drawn from the dataset's caption_prefix that is
                        automatically prepended to generation prompts to
                        maintain consistency. It matches the dataset's
                        caption_prefix. It can be bypassed during generation by
                        setting include_generation_prefix=false.
                    project_id:
                      type: integer
                      description: ID of the project this model belongs to
                    dataset_id:
                      type: integer
                      description: ID of the dataset used for training
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the model was created
              example:
                - 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'
                - id: 790
                  name: Max Character Model
                  description: A model trained for faster generation
                  status: InProgress
                  training_version: max
                  generation_prefix: >-
                    An illustration of a character named Max, a male character
                    with spiky black hair,
                  project_id: 123
                  dataset_id: 457
                  created_at: '2024-05-27T09:00:00Z'
        '401':
          description: Unauthorized
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/models/upload_model:
    post:
      summary: Upload Model
      tags:
        - Training Endpoints
      description: >
        This API allows users to upload a pre-trained tailored model to Bria’s
        infrastructure, and run them within Bria’s ecosystem.


        Model has to be in .safetensors format. Maximum model size supported is
        3GB.


        You can find out the model's status by using the
        [`/tailored-gen/models/{model_id}`](https://docs.bria.ai/tailored-generation/endpoints/get-model)
        route. Potential statuses are: "syncing" or "completed".
      operationId: upload-model
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
          description: API authentication token.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model_url:
                  type: string
                  description: URL of the tailored model file to be uploaded.
                training_version:
                  type: string
                  description: Training version
                  enum:
                    - light
                    - max
                model_name:
                  type: string
                  description: Name of the new tailored model.
                caption_prefix:
                  type: string
                  description: >-
                    Words automatically appended to prompts when running the
                    model.
                project_id:
                  type: integer
                  description: >-
                    ID of the project the model should be assigned to. If
                    omitted, a new project will be created.
                project_parameters:
                  type: object
                  description: >-
                    Parameters for creating a new project, required only if
                    `project_id` is not provided.
                  properties:
                    project_name:
                      type: string
                      description: Name of the project.
                    ip_medium:
                      type: string
                      enum:
                        - photography
                        - illustration
                      description: Medium of the IP.
                    project_description:
                      type: string
                      description: Description of the project.
                    ip_type:
                      type: string
                      enum:
                        - multi_object_set
                        - object_variants
                        - icons
                        - defined_character
                        - character_variants
                        - stylized_scene
                        - other
                      default: other
                      description: Type of IP for the project.
              required:
                - model_url
                - training_version
      responses:
        '200':
          description: Successful model upload
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  name:
                    type: string
                  description:
                    type: string
                  status:
                    type: string
                  training_version:
                    type: string
                  generation_prefix:
                    type: string
                  project_id:
                    type: integer
                  dataset_id:
                    type: integer
                  created_at:
                    type: string
                    format: date-time
              example:
                id: 789
                name: Lora Character Model
                description: A model trained on my character
                status: Completed
                training_version: max
                generation_prefix: An illustration of a character purple hair,
                project_id: 123
                dataset_id: 456
                created_at: '2024-05-26T12:00:00Z'
        '400':
          description: Bad request. Missing or invalid parameters.
        '403':
          description: Forbidden. Insufficient permissions to access the model URL.
        '404':
          description: Not found.
        '415':
          description: Unsupported Media Type. Invalid file format.
        '422':
          description: >-
            Unprocessable Entity. The provided URL or parameters are invalid or
            inaccessible.
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests.
        '500':
          description: Internal server error.
  /tailored-gen/projects/{project_id}/models:
    get:
      summary: Get Models by Project
      tags:
        - Training Endpoints
      description: >-
        Retrieve all models for a project. If there are no models, an empty
        array is returned.
      operationId: get-models-by-project
      parameters:
        - in: path
          name: project_id
          required: true
          schema:
            type: integer
          description: Project ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved models
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the model
                    name:
                      type: string
                      description: Name of the model
                    description:
                      type: string
                      description: Description of the model
                    status:
                      type: string
                      description: Status of the model
                      enum:
                        - Created
                        - InProgress
                        - Completed
                        - Failed
                        - Stopping
                        - Stopped
                    training_version:
                      type: string
                      description: Training version
                      enum:
                        - light
                        - max
                    generation_prefix:
                      type: string
                      description: >-
                        Text drawn from the dataset's caption_prefix that is
                        automatically prepended to generation prompts to
                        maintain consistency. It matches the dataset's
                        caption_prefix. It can be bypassed during generation by
                        setting include_generation_prefix=false.
                    project_id:
                      type: integer
                      description: ID of the project this model belongs to
                    dataset_id:
                      type: integer
                      description: ID of the dataset used for training
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the model was created
                    updated_at:
                      type: string
                      format: date-time
                      description: Timestamp when the model was last updated
              example:
                - 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'
                  updated_at: '2024-05-26T14:30:00Z'
                - id: 790
                  name: Max Character Model
                  description: A model trained for faster generation
                  status: InProgress
                  training_version: max
                  generation_prefix: >-
                    An illustration of a character named Max, a male character
                    with spiky black hair,
                  project_id: 123
                  dataset_id: 457
                  created_at: '2024-05-27T09:00:00Z'
                  updated_at: '2024-05-27T09:00:00Z'
        '401':
          description: Unauthorized
        '404':
          description: Project not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/models/{model_id}:
    get:
      summary: Get Model by ID
      tags:
        - Training Endpoints
      description: >-
        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.
      operationId: get-model
      parameters:
        - in: path
          name: model_id
          required: true
          schema:
            type: integer
          description: Model ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successfully retrieved model
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the model
                  name:
                    type: string
                    description: Name of the model
                  description:
                    type: string
                    description: Description of the model
                  status:
                    type: string
                    description: Status of the model
                    enum:
                      - Created
                      - InProgress
                      - Completed
                      - Failed
                      - Stopping
                      - Stopped
                  training_version:
                    type: string
                    description: Training version
                    enum:
                      - light
                      - max
                  generation_prefix:
                    type: string
                    description: >-
                      Text drawn from the dataset's caption_prefix that is
                      automatically prepended to generation prompts to maintain
                      consistency. It matches the dataset's caption_prefix. It
                      can be bypassed during generation by setting
                      include_generation_prefix=false.
                  project_id:
                    type: integer
                    description: ID of the project this model belongs to
                  dataset_id:
                    type: integer
                    description: ID of the dataset used for training
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the model was created
              example:
                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'
        '401':
          description: Unauthorized
        '404':
          description: Model not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    put:
      summary: Update Model
      tags:
        - Training Endpoints
      description: >-
        Update a model's name and description. Other model attributes such as
        training version and dataset cannot be modified after creation.
      operationId: update-model
      parameters:
        - in: path
          name: model_id
          required: true
          schema:
            type: integer
          description: Model ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New model name (optional)
                description:
                  type: string
                  description: New model description (optional)
            example:
              name: Updated Lora Character Model
              description: An updated model trained on Lora character illustrations
      responses:
        '200':
          description: Model successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the model
                  name:
                    type: string
                    description: Name of the model
                  description:
                    type: string
                    description: Description of the model
                  status:
                    type: string
                    description: Status of the model
                    enum:
                      - Created
                      - InProgress
                      - Completed
                      - Failed
                      - Stopping
                      - Stopped
                  training_version:
                    type: string
                    description: Training version
                    enum:
                      - light
                      - max
                  generation_prefix:
                    type: string
                    description: >-
                      Text drawn from the dataset's caption_prefix that is
                      automatically prepended to generation prompts to maintain
                      consistency. It matches the dataset's caption_prefix. It
                      can be bypassed during generation by setting
                      include_generation_prefix=false.
                  project_id:
                    type: integer
                    description: ID of the project this model belongs to
                  dataset_id:
                    type: integer
                    description: ID of the dataset used for training
                  created_at:
                    type: string
                    format: date-time
                    description: Timestamp when the model was created
              example:
                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'
        '401':
          description: Unauthorized
        '404':
          description: Model not found
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
    delete:
      summary: Delete Model
      tags:
        - Training Endpoints
      description: Delete a specific model. Changes status to Deleted.
      operationId: delete-model
      parameters:
        - in: path
          name: model_id
          required: true
          schema:
            type: integer
          description: Model ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Model successfully deleted
        '401':
          description: Unauthorized
        '404':
          description: Model not found
        '409':
          description: Cannot delete a model that is currently in training
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message explaining the conflict
              example:
                message: Cannot delete model while it is in training
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/models/{model_id}/start_training:
    post:
      summary: Start Training
      tags:
        - Training Endpoints
      description: >
        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
      operationId: start-training
      parameters:
        - in: path
          name: model_id
          required: true
          schema:
            type: integer
          description: Model ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                lr_scheduler:
                  type: string
                  description: >-
                    The learning rate scheduler used to adjust the learning rate
                    throughout the training process.
                  enum:
                    - linear
                    - cosine
                    - cosine_with_restarts
                    - polynomial
                    - constant
                    - constant_with_warmup
                learning_rate:
                  type: number
                  format: float
                  minimum: 0
                  description: >-
                    The initial learning rate used for optimizing the model
                    weights during training.
                gradient_accumulation_steps:
                  type: number
                  format: integer
                  minimum: 1
                  maximum: 16
                  description: >-
                    The number of gradient calculation steps to accumulate
                    before performing a single optimization step, effectively
                    increasing the batch size without additional memory
                    requirements.
                max_train_steps:
                  type: number
                  format: integer
                  minimum: 1
                  maximum: 3000
                  description: >-
                    The total number of training optimization steps the model
                    will perform during the training run.
      responses:
        '200':
          description: Training successfully started
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Unique identifier for the model
                  status:
                    type: string
                    description: Status of the model
                    enum:
                      - InProgress
              example:
                id: 789
                status: InProgress
        '401':
          description: Unauthorized
        '404':
          description: Model not found
        '409':
          description: Training already started/cannot be resumed
        '412':
          description: Dataset status must be 'completed' to start training
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/models/{model_id}/stop_training:
    post:
      summary: Stop Training
      tags:
        - Training Endpoints
      description: >-
        Stop an ongoing model training process. Once stopped, training cannot be
        resumed - a new model would need to be created and trained.
      operationId: stop-training
      parameters:
        - in: path
          name: model_id
          required: true
          schema:
            type: integer
          description: Model ID
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Training job successfully stopped
        '401':
          description: Unauthorized
        '404':
          description: Model not found
        '409':
          description: Training already stopped/not in training
        '429':
          description: >-
            Request limit exceeded. Your account has reached its maximum allowed
            requests. Please upgrade your plan or try again later.
        '500':
          description: Internal server error
  /tailored-gen/models/{model_id}/download:
    get:
      summary: Download Tailored Model
      tags:
        - Training Endpoints
      description: >
        Enables users to download a trained tailored generation model after
        completing the training process. 

        The response includes a pre-signed URL for downloading the model,
        details about the base model used, 

        and the prompt prefix applied during training.


        To use the tailored model source code, access to the base model source
        code is required. 

        The base model source code is exclusively available through Bria's
        **Source Code and Weights** product. 

        For more information or to gain access, contact us at **info@bria.ai**.
      operationId: download-tailored-model
      parameters:
        - in: path
          name: model_id
          required: true
          schema:
            type: string
          description: The unique identifier of the tailored model.
        - in: header
          name: api_token
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful retrieval of the tailored model download details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  download_url:
                    type: string
                    description: >-
                      A pre-signed URL allowing users to download the tailored
                      model.
                  base_model_name:
                    type: string
                    description: The name of the base model used for training.
                    enum:
                      - BRIA-2.3
                      - BRIA-4B-Adapt
                  base_model_card:
                    type: string
                    description: >-
                      URL to the Hugging Face model card of the respective base
                      model.
                  prompt_prefix:
                    type: string
                    description: >-
                      The prompt prefix automatically applied during generation
                      with the tailored model.
              example:
                download_url: https://download-url-for-tailored-model.com
                base_model_name: BRIA-2.3
                base_model_card: https://huggingface.co/briaai/BRIA-2.3
                prompt_prefix: 'An illustration of '
        '400':
          description: Bad request. The request is malformed.
        '401':
          description: Unauthorized. Invalid or missing API token.
        '404':
          description: Not found. The requested model_id does not exist.
        '500':
          description: Internal server error.
components: {}
