Bria Image Generation API

Generate images using tailored models

OpenAPI Specification

bria-image-generation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Tailored Generation API Reference Image Generation API
  version: ''
  description: "Tailored Generation provides capabilities to generate visuals (photos, illustrations, vectors) \nthat preserve and faithfully reproduce specific IP elements or guidelines, ensuring consistency \nacross all generated outputs.\n\nThe Tailored Generation APIs allow you to manage and train tailored models that maintain the \nintegrity of your visual IP. You can train models through our Console or implement training \ndirectly via API.\n\n**Fully Automated Training Mode**\nBria supports users in training high-quality finetuned models without the guesswork. Based on the selected IP type & dataset, Bria automatically selects the right training parameters. \nThis means that the user only needs to spend time curating their dataset.\n\n**Advanced Customization and Access:** Bria offers 2 types of advanced training customization: Expert training mode and source-code & weights.\n  - **Expert training mode** is for LoRa Finetune experts and provides the ability to finetune training parameters and upload larger training datasets.\n  - **Source-code & Weights** is for developers seeking deeper customization and access to Bria's source-available GenAI models via [Hugging Face](https://huggingface.co/briaai).  \n\nAll methods allow full control over fine-tuning, pipeline creation, and integration into proprietary workflows—empowering AI teams to develop and optimize their own generative AI solutions.\n\nThe Tailored Generation Training API provides a set of endpoints to manage the entire lifecycle \nof a tailored generation project:\n\n1. **Project Management**: Create and manage projects that define IP characteristics:\n  - **Create and Retrieve Projects**: Use the `/projects` endpoints to create a new project or \n    retrieve existing projects that belong to your organization.\n  - **Define IP Type**: Specify the IP type (e.g., multi_object_set, defined_character, \n    stylized_scene) and medium.\n  - **Manage Project Details**: Use the `/projects/{id}` endpoints to update or delete \n    specific projects.\n\n2. **Dataset Management**: Organize and refine datasets within your projects:\n  - **Create and Retrieve Datasets**: Use the `/datasets` endpoints to create new datasets or \n    retrieve existing ones.\n  - **Generate a Visual Schema**\n    - Use `/tailored-gen/generate_visual_schema` to create a structured visual schema using 5-10 sample images.\n  - **Refine Structured Data**\n    - Use `/tailored-gen/refine_structured_prompt` to iterate on your **Visual Schema** or **Image Captions** using natural language instructions.\n    - *Example:* You can send your generated schema with the instruction \"Character's name is Lucy\" to improve the training metadata programmatically.\n  - **Upload and Manage Images**: \n    - **Basic upload**: Use `/datasets/{dataset_id}/images` to upload up to 200 images individually.\n    - **Bulk upload**: Use `/datasets/{dataset_id}/images/bulk` to upload zip files with >200 high-quality images (Advanced).\n  - **Clone Datasets**: Create variations of existing datasets using the clone functionality.\n\n3. **Model Management**: Train and optimize tailored models based on your datasets:\n  - **Create and Retrieve Models**: Use the `/models` endpoints to create new models or list \n    existing ones.\n  - **Choose training mode**: Select between Fully automated mode (automatic training based on Bria's recipes) and Expert mode (for training parameter tweaking).\n  - **Monitor and Control**: Manage the model lifecycle, including training start/stop, \n    status monitoring, and version control over the training parameters.\n\n4. **Generation Capabilities**:\n  - **Image Generation**: Use `/image/generate/tailored` for text-to-image generation.\n  - **Structured Prompting**: Use `/structured_prompt/generate/tailored` to create structured prompts via VLM before generation.\n  - **Video Generation**: Use `/video/generate/tailored/image-to-video` to animate tailored images.\n\n### **Training Process**\n\nTo train a tailored model:\n\n1. **Create a Project**: Use the `/projects` endpoint to define your IP type and medium.\n2. **Create a Dataset**: Use the `/datasets` endpoint to create a dataset within your project.\n3. **Define Visual Identity**:\n   - **Step A (Generate):** Call `/tailored-gen/generate_visual_schema`, sampling 5-10 images from your input set.\n   - **Step B (Refine - Optional):** Call `/tailored-gen/refine_structured_prompt` with the generated schema and instructions to tweak the definitions (e.g., \"Remove references to blue background\").\n   - **Step C (Apply):** Update the dataset with the final schema using `/datasets/{dataset_id}`.\n4. **Upload Images**: Upload images using the `/datasets/{dataset_id}/images` or `/datasets/{dataset_id}/images/bulk` endpoints \n  (minimum resolution: 1024x1024px). note: if you upload images before updating the visual schema, use the Regenerate All Captions endpoint to caption the images.\n5. **Prepare Dataset**: Review auto-generated captions (you can also use `refine_structured_prompt` to fix specific image captions) and update the dataset status to 'completed'.\n6. **Create Model**: Use the `/models` endpoint to create a model, which requires a training mode.\n7. **Start Training**: Initiate training via the `/models/{id}/start_training` endpoint. \n  Training typically takes 4-6 hours.\n8. **Monitor Progress**: Check the training status using the `/models/{id}` endpoint until \n  training is 'Completed'.\n9. **Generate Images**: \n  - Use `v2/image/generate/tailored` for text-to-image generation.\n"
servers:
- url: https://engine.prod.bria-api.com/v2/
tags:
- name: Image Generation
  description: Generate images using tailored models
paths:
  /image/generate/tailored:
    post:
      summary: Generate Image - Tailored Model
      tags:
      - Image Generation
      servers:
      - url: https://engine.prod.bria-api.com/v2
      description: '**Description**


        Generates a new image using a tailored model.


        This endpoint translates your input (`prompt` and/or `structured_prompt`) into a structured JSON prompt using the state-of-the-art **Gemini 2.5 Flash** VLM bridge. It internally uses the model''s visual schema (backbone) to ensure the generated image matches your trained visual identity.


        The response includes both the final `image_url` and the `structured_prompt` (JSON).


        **Input Combination Rules**

        The request body must include **one** of the following mutually exclusive combinations:

        * `prompt`: Generates a new image from text.

        * `structured_prompt`: Recreates a previous image exactly (requires seed).

        * `structured_prompt` + `prompt`: Refines a previous image using new text instructions.

        '
      operationId: image-generate-tailored
      parameters:
      - in: header
        name: api_token
        schema:
          type: string
        required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - tailored_model_id
              properties:
                tailored_model_id:
                  type: string
                  description: The ID of the tailored model.
                tailored_model_influence:
                  type: number
                  format: float
                  description: Controls the strength of the tailored model's influence (0.0 - 1.5).
                  default: 1
                  minimum: 0
                  maximum: 1.5
                prompt:
                  type: string
                  description: Text-based instruction for generation or refinement.
                structured_prompt:
                  type: string
                  description: A string containing the structured prompt in JSON format for precise recreation/refinement.
                negative_prompt:
                  type: string
                  description: Concepts to exclude from the generated image.
                guidance_scale:
                  type: integer
                  description: Adherence to the prompt (3-5).
                  default: 5
                  minimum: 3
                  maximum: 5
                aspect_ratio:
                  type: string
                  default: '1:1'
                  enum:
                  - '1:1'
                  - '2:3'
                  - '3:2'
                  - '3:4'
                  - '4:3'
                  - '4:5'
                  - '5:4'
                  - '9:16'
                  - '16:9'
                steps_num:
                  type: integer
                  default: 50
                  minimum: 20
                  maximum: 50
                seed:
                  type: integer
                  description: Seed for deterministic generation.
                sync:
                  type: boolean
                  default: false
                  description: If false, returns a 202 and status URL. If true, returns 200 with result.
                prompt_content_moderation:
                  type: boolean
                  default: true
                visual_output_content_moderation:
                  type: boolean
                  default: true
            examples:
              New Generation:
                value:
                  tailored_model_id: model_123
                  prompt: A product photo in the brand's visual style
      responses:
        '200':
          description: Successful operation (Synchronous).
          content:
            application/json:
              schema:
                type: object
                properties:
                  image_url:
                    type: string
                  structured_prompt:
                    type: string
        '202':
          description: Accepted (Asynchronous).
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                  status_url:
                    type: string
        '400':
          description: Bad request. Invalid parameters.
        '403':
          description: Forbidden. Model does not belong to organization.
        '422':
          description: Unprocessable Entity (Moderation failure).
        '429':
          description: Request limit exceeded.
        '500':
          description: Internal Server Error.
  /structured_prompt/generate/tailored:
    post:
      summary: Generate Structured Prompt - Tailored Model
      tags:
      - Image Generation
      servers:
      - url: https://engine.prod.bria-api.com/v2
      description: '**Description**


        Creates a new detailed, machine-readable structured prompt in JSON format or refines an existing one using text inputs and a tailored model''s visual schema (backbone).


        This endpoint uses the state-of-the-art **Gemini 2.5 Flash** VLM bridge. The tailored model''s visual schema is provided as input to Gemini along with the user prompt to generate the structured prompt.


        **It returns ONLY the JSON string and does not generate an image.**


        **Use Cases:**

        * **Control & Auditability:** Inspect or programmatically edit the JSON *before* generating an image.

        * **Consistency:** Generate one `structured_prompt` and pass it to `/image/generate/tailored` multiple times.

        * **Hybrid Deployment:** Use Bria''s VLM bridge via API while hosting the FIBO image model on a private cloud.


        **Input Combination Rules**

        The request body must use exactly one of the following combinations:

        * **Text Only**: `prompt`

        * **Structured Prompt and Text**: `structured_prompt` and `prompt` (Refinement)

        '
      operationId: structured-prompt-generate-tailored
      parameters:
      - in: header
        name: api_token
        schema:
          type: string
        required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - tailored_model_id
              properties:
                tailored_model_id:
                  type: string
                  description: The ID of the tailored model.
                prompt:
                  type: string
                  description: Text-based instruction.
                structured_prompt:
                  type: string
                  description: JSON string from a previous response for refinement.
                seed:
                  type: integer
                  description: Seed for deterministic generation.
                sync:
                  type: boolean
                  default: false
                  description: If false, returns 202. If true, returns 200.
                prompt_content_moderation:
                  type: boolean
                  default: true
            examples:
              Text Only:
                value:
                  tailored_model_id: model_123
                  prompt: A product photo in the brand's visual style
              Refinement:
                value:
                  tailored_model_id: model_123
                  structured_prompt: '{"main_subject": ...}'
                  prompt: add dramatic lighting
      responses:
        '200':
          description: Successful operation (Synchronous).
          content:
            application/json:
              schema:
                type: object
                properties:
                  structured_prompt:
                    type: string
                    description: The generated structured prompt JSON string.
        '202':
          description: Accepted (Asynchronous).
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                  status_url:
                    type: string
        '400':
          description: Bad request. Invalid parameters.
        '403':
          description: Forbidden. Model does not belong to organization.
        '422':
          description: Unprocessable Entity (Moderation failure).
        '429':
          description: Request limit exceeded.
        '500':
          description: Internal Server Error.
externalDocs:
  description: Register and get API Access
  url: https://platform.bria.ai/organization-management/api-keys
x-tagGroups:
- name: Training Endpoints
  tags:
  - Project
  - Dataset
  - Model
- name: Generation Endpoints
  tags:
  - Image Generation
  - Video Generation