Skip to content

Training Endpoints

Model training and fine-tuning jobs.


Overview

Method Endpoint Description
POST /training/ Start training job
GET /training/{task_id} Get training status
POST /training/{task_id}/cancel Cancel training

Training Workflow

flowchart LR
    DS[Dataset] --> TRAIN[Training Job]
    TRAIN --> LORA[LoRA Weights]
    LORA --> GEN[Use in Generation]

API Reference

Custom API - Training 1.0.0

This is a very custom OpenAPI schema


Training


POST /api/v1/training/

Create Training Task

Description

Create and start a new training task.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token

Request body

{
    "training_type": "FULL",
    "entity_type": "SUBJECT",
    "entity_id": null,
    "trigger_word": "string",
    "rank": null,
    "steps": null,
    "learning_rate": null,
    "sample_prompts": null,
    "source_images": null,
    "base_model_path": null,
    "bypass_guidance_embedding": null,
    "webhook_url": null,
    "origin_instance": null,
    "origin_zone": null,
    "origin_version": null,
    "origin_tenant_id": null,
    "preprocessing_transforms": null,
    "preprocessing_captioning_strategy": null,
    "preprocessing_captioning_prompt": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "training_type": {
            "$ref": "#/components/schemas/TrainingType",
            "default": "LORA"
        },
        "entity_type": {
            "$ref": "#/components/schemas/EntityType",
            "default": "PRODUCT"
        },
        "entity_id": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "uuid"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Entity Id"
        },
        "trigger_word": {
            "type": "string",
            "title": "Trigger Word"
        },
        "rank": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Rank",
            "default": 16
        },
        "steps": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Steps",
            "default": 1000
        },
        "learning_rate": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Learning Rate",
            "default": 0.0001
        },
        "sample_prompts": {
            "anyOf": [
                {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Sample Prompts",
            "default": []
        },
        "source_images": {
            "anyOf": [
                {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Source Images",
            "default": []
        },
        "base_model_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Base Model Path",
            "default": "black-forest-labs/FLUX.1-dev"
        },
        "bypass_guidance_embedding": {
            "anyOf": [
                {
                    "type": "boolean"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Bypass Guidance Embedding",
            "default": false
        },
        "webhook_url": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Webhook Url"
        },
        "origin_instance": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Instance",
            "description": "Identifier for the instance that created this task (e.g., 'production', 'staging')",
            "default": "unknown"
        },
        "origin_zone": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Zone",
            "description": "Environment identifier (e.g., 'eu', 'us')"
        },
        "origin_version": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Version",
            "description": "Version of the backend that created this task"
        },
        "origin_tenant_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Tenant Id",
            "description": "Optional tenant/organization identifier for multi-tenant setups"
        },
        "preprocessing_transforms": {
            "anyOf": [
                {
                    "items": {
                        "additionalProperties": true,
                        "type": "object"
                    },
                    "type": "array"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Transforms",
            "description": "List of image transformations to apply"
        },
        "preprocessing_captioning_strategy": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/CaptioningStrategy"
                },
                {
                    "type": "null"
                }
            ],
            "description": "Strategy for image captioning",
            "default": "trigger_only"
        },
        "preprocessing_captioning_prompt": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Captioning Prompt",
            "description": "Custom prompt for captioning"
        }
    },
    "type": "object",
    "required": [
        "trigger_word"
    ],
    "title": "TrainingTaskCreate",
    "description": "Schema for creating new training tasks"
}

Responses

{
    "id": "efb26cb3-a2df-4650-9340-da253b462bf7",
    "created_at": "2022-04-13T15:42:05.901Z",
    "updated_at": "2022-04-13T15:42:05.901Z",
    "origin_instance": "string",
    "origin_zone": null,
    "origin_version": null,
    "origin_tenant_id": null,
    "training_type": "FULL",
    "entity_type": "SUBJECT",
    "entity_id": null,
    "status": "PENDING",
    "progress": 10.12,
    "current_step": 0,
    "total_steps": 0,
    "eta_seconds": null,
    "trigger_word": "string",
    "training_folder": "string",
    "rank": 0,
    "save_every": 0,
    "max_step_saves_to_keep": 0,
    "batch_size": 0,
    "steps": 0,
    "learning_rate": 10.12,
    "gradient_accumulation": 0,
    "optimizer": "string",
    "bypass_guidance_embedding": true,
    "base_model_path": "string",
    "local_model_path": null,
    "sample_every": 0,
    "sample_steps": 0,
    "sample_prompts": [
        "string"
    ],
    "started_at": null,
    "completed_at": null,
    "logs": "string",
    "error_message": null,
    "webhook_url": "string",
    "celery_training_task_id": null,
    "celery_preprocessing_task_id": null,
    "celery_chain_task_id": null,
    "preprocessing_stage": null,
    "processed_files_count": null,
    "total_files_count": null,
    "preprocessing_started_at": null,
    "preprocessing_completed_at": null,
    "source_images": [
        "string"
    ],
    "processed_dataset_path": null,
    "preprocessing_transforms": null,
    "preprocessing_captioning_strategy": "string",
    "preprocessing_captioning_prompt": null,
    "priority": 0,
    "priority_changed_at": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
        },
        "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
        },
        "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
        },
        "origin_instance": {
            "type": "string",
            "title": "Origin Instance",
            "description": "Identifier for the instance that created this task (e.g., 'production', 'staging')",
            "default": "unknown"
        },
        "origin_zone": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Zone",
            "description": "Environment identifier (e.g., 'eu', 'us')"
        },
        "origin_version": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Version",
            "description": "Version of the backend that created this task"
        },
        "origin_tenant_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Tenant Id",
            "description": "Optional tenant/organization identifier for multi-tenant setups"
        },
        "training_type": {
            "$ref": "#/components/schemas/TrainingType",
            "default": "LORA"
        },
        "entity_type": {
            "$ref": "#/components/schemas/EntityType",
            "default": "PRODUCT"
        },
        "entity_id": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "uuid"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Entity Id"
        },
        "status": {
            "$ref": "#/components/schemas/TrainingStatus",
            "default": "PENDING"
        },
        "progress": {
            "type": "number",
            "title": "Progress",
            "default": 0.0
        },
        "current_step": {
            "type": "integer",
            "title": "Current Step",
            "default": 0
        },
        "total_steps": {
            "type": "integer",
            "title": "Total Steps",
            "default": 1000
        },
        "eta_seconds": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Eta Seconds"
        },
        "trigger_word": {
            "type": "string",
            "title": "Trigger Word"
        },
        "training_folder": {
            "type": "string",
            "title": "Training Folder",
            "default": ""
        },
        "rank": {
            "type": "integer",
            "title": "Rank",
            "default": 16
        },
        "save_every": {
            "type": "integer",
            "title": "Save Every",
            "default": 2000
        },
        "max_step_saves_to_keep": {
            "type": "integer",
            "title": "Max Step Saves To Keep",
            "default": 4
        },
        "batch_size": {
            "type": "integer",
            "title": "Batch Size",
            "default": 1
        },
        "steps": {
            "type": "integer",
            "title": "Steps",
            "default": 1000
        },
        "learning_rate": {
            "type": "number",
            "title": "Learning Rate",
            "default": 0.0001
        },
        "gradient_accumulation": {
            "type": "integer",
            "title": "Gradient Accumulation",
            "default": 1
        },
        "optimizer": {
            "type": "string",
            "title": "Optimizer",
            "default": "adamw8bit"
        },
        "bypass_guidance_embedding": {
            "type": "boolean",
            "title": "Bypass Guidance Embedding",
            "default": false
        },
        "base_model_path": {
            "type": "string",
            "title": "Base Model Path",
            "default": "black-forest-labs/FLUX.1-dev"
        },
        "local_model_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Local Model Path"
        },
        "sample_every": {
            "type": "integer",
            "title": "Sample Every",
            "default": 250
        },
        "sample_steps": {
            "type": "integer",
            "title": "Sample Steps",
            "default": 25
        },
        "sample_prompts": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Sample Prompts"
        },
        "started_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Started At"
        },
        "completed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Completed At"
        },
        "logs": {
            "type": "string",
            "title": "Logs",
            "default": ""
        },
        "error_message": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Error Message"
        },
        "webhook_url": {
            "type": "string",
            "title": "Webhook Url",
            "default": ""
        },
        "celery_training_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Training Task Id"
        },
        "celery_preprocessing_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Preprocessing Task Id"
        },
        "celery_chain_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Chain Task Id"
        },
        "preprocessing_stage": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Stage",
            "description": "Current preprocessing stage (downloading, validating, etc.)"
        },
        "processed_files_count": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Processed Files Count",
            "description": "Number of files processed during preprocessing"
        },
        "total_files_count": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Total Files Count",
            "description": "Total number of files to process"
        },
        "preprocessing_started_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Started At",
            "description": "When preprocessing phase started"
        },
        "preprocessing_completed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Completed At",
            "description": "When preprocessing phase completed"
        },
        "source_images": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Source Images",
            "description": "Original image paths from source system"
        },
        "processed_dataset_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Processed Dataset Path",
            "description": "Path to the processed dataset on compute server"
        },
        "preprocessing_transforms": {
            "anyOf": [
                {
                    "items": {
                        "additionalProperties": true,
                        "type": "object"
                    },
                    "type": "array"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Transforms",
            "description": "List of image transformations to apply"
        },
        "preprocessing_captioning_strategy": {
            "type": "string",
            "title": "Preprocessing Captioning Strategy",
            "description": "Strategy for image captioning",
            "default": "trigger_only"
        },
        "preprocessing_captioning_prompt": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Captioning Prompt",
            "description": "Custom prompt for captioning"
        },
        "priority": {
            "$ref": "#/components/schemas/TaskPriority",
            "description": "Task priority affecting queue position",
            "default": 1
        },
        "priority_changed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Priority Changed At",
            "description": "Timestamp of last priority change"
        }
    },
    "type": "object",
    "required": [
        "trigger_word"
    ],
    "title": "TrainingTask"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

GET /api/v1/training/

List Training Tasks

Description

List all training tasks with pagination.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
limit query integer 10 No
skip query integer 0 No

Responses

[
    {
        "id": "77989797-0c6b-4b24-9af0-ad0044c2e1ec",
        "created_at": "2022-04-13T15:42:05.901Z",
        "updated_at": "2022-04-13T15:42:05.901Z",
        "origin_instance": "string",
        "origin_zone": null,
        "origin_version": null,
        "origin_tenant_id": null,
        "training_type": "FULL",
        "entity_type": "SUBJECT",
        "entity_id": null,
        "status": "PENDING",
        "progress": 10.12,
        "current_step": 0,
        "total_steps": 0,
        "eta_seconds": null,
        "trigger_word": "string",
        "training_folder": "string",
        "rank": 0,
        "save_every": 0,
        "max_step_saves_to_keep": 0,
        "batch_size": 0,
        "steps": 0,
        "learning_rate": 10.12,
        "gradient_accumulation": 0,
        "optimizer": "string",
        "bypass_guidance_embedding": true,
        "base_model_path": "string",
        "local_model_path": null,
        "sample_every": 0,
        "sample_steps": 0,
        "sample_prompts": [
            "string"
        ],
        "started_at": null,
        "completed_at": null,
        "logs": "string",
        "error_message": null,
        "webhook_url": "string",
        "celery_training_task_id": null,
        "celery_preprocessing_task_id": null,
        "celery_chain_task_id": null,
        "preprocessing_stage": null,
        "processed_files_count": null,
        "total_files_count": null,
        "preprocessing_started_at": null,
        "preprocessing_completed_at": null,
        "source_images": [
            "string"
        ],
        "processed_dataset_path": null,
        "preprocessing_transforms": null,
        "preprocessing_captioning_strategy": "string",
        "preprocessing_captioning_prompt": null,
        "priority": 0,
        "priority_changed_at": null
    }
]
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "array",
    "items": {
        "$ref": "#/components/schemas/TrainingTask"
    },
    "title": "Response List Training Tasks"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

GET /api/v1/training/{task_id}

Get Training Status

Description

Get status of a training task.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
task_id path string No

Responses

{
    "id": "43e1c950-3cf8-4939-9a03-560c73f8579e",
    "created_at": "2022-04-13T15:42:05.901Z",
    "updated_at": "2022-04-13T15:42:05.901Z",
    "origin_instance": "string",
    "origin_zone": null,
    "origin_version": null,
    "origin_tenant_id": null,
    "training_type": "FULL",
    "entity_type": "SUBJECT",
    "entity_id": null,
    "status": "PENDING",
    "progress": 10.12,
    "current_step": 0,
    "total_steps": 0,
    "eta_seconds": null,
    "trigger_word": "string",
    "training_folder": "string",
    "rank": 0,
    "save_every": 0,
    "max_step_saves_to_keep": 0,
    "batch_size": 0,
    "steps": 0,
    "learning_rate": 10.12,
    "gradient_accumulation": 0,
    "optimizer": "string",
    "bypass_guidance_embedding": true,
    "base_model_path": "string",
    "local_model_path": null,
    "sample_every": 0,
    "sample_steps": 0,
    "sample_prompts": [
        "string"
    ],
    "started_at": null,
    "completed_at": null,
    "logs": "string",
    "error_message": null,
    "webhook_url": "string",
    "celery_training_task_id": null,
    "celery_preprocessing_task_id": null,
    "celery_chain_task_id": null,
    "preprocessing_stage": null,
    "processed_files_count": null,
    "total_files_count": null,
    "preprocessing_started_at": null,
    "preprocessing_completed_at": null,
    "source_images": [
        "string"
    ],
    "processed_dataset_path": null,
    "preprocessing_transforms": null,
    "preprocessing_captioning_strategy": "string",
    "preprocessing_captioning_prompt": null,
    "priority": 0,
    "priority_changed_at": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
        },
        "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
        },
        "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
        },
        "origin_instance": {
            "type": "string",
            "title": "Origin Instance",
            "description": "Identifier for the instance that created this task (e.g., 'production', 'staging')",
            "default": "unknown"
        },
        "origin_zone": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Zone",
            "description": "Environment identifier (e.g., 'eu', 'us')"
        },
        "origin_version": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Version",
            "description": "Version of the backend that created this task"
        },
        "origin_tenant_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Tenant Id",
            "description": "Optional tenant/organization identifier for multi-tenant setups"
        },
        "training_type": {
            "$ref": "#/components/schemas/TrainingType",
            "default": "LORA"
        },
        "entity_type": {
            "$ref": "#/components/schemas/EntityType",
            "default": "PRODUCT"
        },
        "entity_id": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "uuid"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Entity Id"
        },
        "status": {
            "$ref": "#/components/schemas/TrainingStatus",
            "default": "PENDING"
        },
        "progress": {
            "type": "number",
            "title": "Progress",
            "default": 0.0
        },
        "current_step": {
            "type": "integer",
            "title": "Current Step",
            "default": 0
        },
        "total_steps": {
            "type": "integer",
            "title": "Total Steps",
            "default": 1000
        },
        "eta_seconds": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Eta Seconds"
        },
        "trigger_word": {
            "type": "string",
            "title": "Trigger Word"
        },
        "training_folder": {
            "type": "string",
            "title": "Training Folder",
            "default": ""
        },
        "rank": {
            "type": "integer",
            "title": "Rank",
            "default": 16
        },
        "save_every": {
            "type": "integer",
            "title": "Save Every",
            "default": 2000
        },
        "max_step_saves_to_keep": {
            "type": "integer",
            "title": "Max Step Saves To Keep",
            "default": 4
        },
        "batch_size": {
            "type": "integer",
            "title": "Batch Size",
            "default": 1
        },
        "steps": {
            "type": "integer",
            "title": "Steps",
            "default": 1000
        },
        "learning_rate": {
            "type": "number",
            "title": "Learning Rate",
            "default": 0.0001
        },
        "gradient_accumulation": {
            "type": "integer",
            "title": "Gradient Accumulation",
            "default": 1
        },
        "optimizer": {
            "type": "string",
            "title": "Optimizer",
            "default": "adamw8bit"
        },
        "bypass_guidance_embedding": {
            "type": "boolean",
            "title": "Bypass Guidance Embedding",
            "default": false
        },
        "base_model_path": {
            "type": "string",
            "title": "Base Model Path",
            "default": "black-forest-labs/FLUX.1-dev"
        },
        "local_model_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Local Model Path"
        },
        "sample_every": {
            "type": "integer",
            "title": "Sample Every",
            "default": 250
        },
        "sample_steps": {
            "type": "integer",
            "title": "Sample Steps",
            "default": 25
        },
        "sample_prompts": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Sample Prompts"
        },
        "started_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Started At"
        },
        "completed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Completed At"
        },
        "logs": {
            "type": "string",
            "title": "Logs",
            "default": ""
        },
        "error_message": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Error Message"
        },
        "webhook_url": {
            "type": "string",
            "title": "Webhook Url",
            "default": ""
        },
        "celery_training_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Training Task Id"
        },
        "celery_preprocessing_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Preprocessing Task Id"
        },
        "celery_chain_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Chain Task Id"
        },
        "preprocessing_stage": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Stage",
            "description": "Current preprocessing stage (downloading, validating, etc.)"
        },
        "processed_files_count": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Processed Files Count",
            "description": "Number of files processed during preprocessing"
        },
        "total_files_count": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Total Files Count",
            "description": "Total number of files to process"
        },
        "preprocessing_started_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Started At",
            "description": "When preprocessing phase started"
        },
        "preprocessing_completed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Completed At",
            "description": "When preprocessing phase completed"
        },
        "source_images": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Source Images",
            "description": "Original image paths from source system"
        },
        "processed_dataset_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Processed Dataset Path",
            "description": "Path to the processed dataset on compute server"
        },
        "preprocessing_transforms": {
            "anyOf": [
                {
                    "items": {
                        "additionalProperties": true,
                        "type": "object"
                    },
                    "type": "array"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Transforms",
            "description": "List of image transformations to apply"
        },
        "preprocessing_captioning_strategy": {
            "type": "string",
            "title": "Preprocessing Captioning Strategy",
            "description": "Strategy for image captioning",
            "default": "trigger_only"
        },
        "preprocessing_captioning_prompt": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Captioning Prompt",
            "description": "Custom prompt for captioning"
        },
        "priority": {
            "$ref": "#/components/schemas/TaskPriority",
            "description": "Task priority affecting queue position",
            "default": 1
        },
        "priority_changed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Priority Changed At",
            "description": "Timestamp of last priority change"
        }
    },
    "type": "object",
    "required": [
        "trigger_word"
    ],
    "title": "TrainingTask"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /api/v1/training/{task_id}/cancel

Cancel Training

Description

Cancel a running training task.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
task_id path string No

Responses

{
    "id": "914e9cf3-f702-4368-ae8e-a750de66891b",
    "created_at": "2022-04-13T15:42:05.901Z",
    "updated_at": "2022-04-13T15:42:05.901Z",
    "origin_instance": "string",
    "origin_zone": null,
    "origin_version": null,
    "origin_tenant_id": null,
    "training_type": "FULL",
    "entity_type": "SUBJECT",
    "entity_id": null,
    "status": "PENDING",
    "progress": 10.12,
    "current_step": 0,
    "total_steps": 0,
    "eta_seconds": null,
    "trigger_word": "string",
    "training_folder": "string",
    "rank": 0,
    "save_every": 0,
    "max_step_saves_to_keep": 0,
    "batch_size": 0,
    "steps": 0,
    "learning_rate": 10.12,
    "gradient_accumulation": 0,
    "optimizer": "string",
    "bypass_guidance_embedding": true,
    "base_model_path": "string",
    "local_model_path": null,
    "sample_every": 0,
    "sample_steps": 0,
    "sample_prompts": [
        "string"
    ],
    "started_at": null,
    "completed_at": null,
    "logs": "string",
    "error_message": null,
    "webhook_url": "string",
    "celery_training_task_id": null,
    "celery_preprocessing_task_id": null,
    "celery_chain_task_id": null,
    "preprocessing_stage": null,
    "processed_files_count": null,
    "total_files_count": null,
    "preprocessing_started_at": null,
    "preprocessing_completed_at": null,
    "source_images": [
        "string"
    ],
    "processed_dataset_path": null,
    "preprocessing_transforms": null,
    "preprocessing_captioning_strategy": "string",
    "preprocessing_captioning_prompt": null,
    "priority": 0,
    "priority_changed_at": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
        },
        "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
        },
        "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
        },
        "origin_instance": {
            "type": "string",
            "title": "Origin Instance",
            "description": "Identifier for the instance that created this task (e.g., 'production', 'staging')",
            "default": "unknown"
        },
        "origin_zone": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Zone",
            "description": "Environment identifier (e.g., 'eu', 'us')"
        },
        "origin_version": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Version",
            "description": "Version of the backend that created this task"
        },
        "origin_tenant_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Origin Tenant Id",
            "description": "Optional tenant/organization identifier for multi-tenant setups"
        },
        "training_type": {
            "$ref": "#/components/schemas/TrainingType",
            "default": "LORA"
        },
        "entity_type": {
            "$ref": "#/components/schemas/EntityType",
            "default": "PRODUCT"
        },
        "entity_id": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "uuid"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Entity Id"
        },
        "status": {
            "$ref": "#/components/schemas/TrainingStatus",
            "default": "PENDING"
        },
        "progress": {
            "type": "number",
            "title": "Progress",
            "default": 0.0
        },
        "current_step": {
            "type": "integer",
            "title": "Current Step",
            "default": 0
        },
        "total_steps": {
            "type": "integer",
            "title": "Total Steps",
            "default": 1000
        },
        "eta_seconds": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Eta Seconds"
        },
        "trigger_word": {
            "type": "string",
            "title": "Trigger Word"
        },
        "training_folder": {
            "type": "string",
            "title": "Training Folder",
            "default": ""
        },
        "rank": {
            "type": "integer",
            "title": "Rank",
            "default": 16
        },
        "save_every": {
            "type": "integer",
            "title": "Save Every",
            "default": 2000
        },
        "max_step_saves_to_keep": {
            "type": "integer",
            "title": "Max Step Saves To Keep",
            "default": 4
        },
        "batch_size": {
            "type": "integer",
            "title": "Batch Size",
            "default": 1
        },
        "steps": {
            "type": "integer",
            "title": "Steps",
            "default": 1000
        },
        "learning_rate": {
            "type": "number",
            "title": "Learning Rate",
            "default": 0.0001
        },
        "gradient_accumulation": {
            "type": "integer",
            "title": "Gradient Accumulation",
            "default": 1
        },
        "optimizer": {
            "type": "string",
            "title": "Optimizer",
            "default": "adamw8bit"
        },
        "bypass_guidance_embedding": {
            "type": "boolean",
            "title": "Bypass Guidance Embedding",
            "default": false
        },
        "base_model_path": {
            "type": "string",
            "title": "Base Model Path",
            "default": "black-forest-labs/FLUX.1-dev"
        },
        "local_model_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Local Model Path"
        },
        "sample_every": {
            "type": "integer",
            "title": "Sample Every",
            "default": 250
        },
        "sample_steps": {
            "type": "integer",
            "title": "Sample Steps",
            "default": 25
        },
        "sample_prompts": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Sample Prompts"
        },
        "started_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Started At"
        },
        "completed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Completed At"
        },
        "logs": {
            "type": "string",
            "title": "Logs",
            "default": ""
        },
        "error_message": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Error Message"
        },
        "webhook_url": {
            "type": "string",
            "title": "Webhook Url",
            "default": ""
        },
        "celery_training_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Training Task Id"
        },
        "celery_preprocessing_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Preprocessing Task Id"
        },
        "celery_chain_task_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Celery Chain Task Id"
        },
        "preprocessing_stage": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Stage",
            "description": "Current preprocessing stage (downloading, validating, etc.)"
        },
        "processed_files_count": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Processed Files Count",
            "description": "Number of files processed during preprocessing"
        },
        "total_files_count": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Total Files Count",
            "description": "Total number of files to process"
        },
        "preprocessing_started_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Started At",
            "description": "When preprocessing phase started"
        },
        "preprocessing_completed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Completed At",
            "description": "When preprocessing phase completed"
        },
        "source_images": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Source Images",
            "description": "Original image paths from source system"
        },
        "processed_dataset_path": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Processed Dataset Path",
            "description": "Path to the processed dataset on compute server"
        },
        "preprocessing_transforms": {
            "anyOf": [
                {
                    "items": {
                        "additionalProperties": true,
                        "type": "object"
                    },
                    "type": "array"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Transforms",
            "description": "List of image transformations to apply"
        },
        "preprocessing_captioning_strategy": {
            "type": "string",
            "title": "Preprocessing Captioning Strategy",
            "description": "Strategy for image captioning",
            "default": "trigger_only"
        },
        "preprocessing_captioning_prompt": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Preprocessing Captioning Prompt",
            "description": "Custom prompt for captioning"
        },
        "priority": {
            "$ref": "#/components/schemas/TaskPriority",
            "description": "Task priority affecting queue position",
            "default": 1
        },
        "priority_changed_at": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Priority Changed At",
            "description": "Timestamp of last priority change"
        }
    },
    "type": "object",
    "required": [
        "trigger_word"
    ],
    "title": "TrainingTask"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

CaptioningStrategy

Type: string

EntityType

Type: string

HTTPValidationError

Name Type Description
detail Array<ValidationError>

TaskPriority

Type: integer

TrainingStatus

Type: string

TrainingTask

Name Type Description
base_model_path string
batch_size integer
bypass_guidance_embedding boolean
celery_chain_task_id
celery_preprocessing_task_id
celery_training_task_id
completed_at
created_at string(date-time)
current_step integer
entity_id
entity_type EntityType
error_message
eta_seconds
gradient_accumulation integer
id string(uuid)
learning_rate number
local_model_path
logs string
max_step_saves_to_keep integer
optimizer string
origin_instance string Identifier for the instance that created this task (e.g., 'production', 'staging')
origin_tenant_id Optional tenant/organization identifier for multi-tenant setups
origin_version Version of the backend that created this task
origin_zone Environment identifier (e.g., 'eu', 'us')
preprocessing_captioning_prompt Custom prompt for captioning
preprocessing_captioning_strategy string Strategy for image captioning
preprocessing_completed_at When preprocessing phase completed
preprocessing_stage Current preprocessing stage (downloading, validating, etc.)
preprocessing_started_at When preprocessing phase started
preprocessing_transforms List of image transformations to apply
priority TaskPriority Task priority affecting queue position
priority_changed_at Timestamp of last priority change
processed_dataset_path Path to the processed dataset on compute server
processed_files_count Number of files processed during preprocessing
progress number
rank integer
sample_every integer
sample_prompts Array<string>
sample_steps integer
save_every integer
source_images Array<string> Original image paths from source system
started_at
status TrainingStatus
steps integer
total_files_count Total number of files to process
total_steps integer
training_folder string
training_type TrainingType
trigger_word string
updated_at string(date-time)
webhook_url string

TrainingTaskCreate

Name Type Description
base_model_path
bypass_guidance_embedding
entity_id
entity_type EntityType
learning_rate
origin_instance Identifier for the instance that created this task (e.g., 'production', 'staging')
origin_tenant_id Optional tenant/organization identifier for multi-tenant setups
origin_version Version of the backend that created this task
origin_zone Environment identifier (e.g., 'eu', 'us')
preprocessing_captioning_prompt Custom prompt for captioning
preprocessing_captioning_strategy Strategy for image captioning
preprocessing_transforms List of image transformations to apply
rank
sample_prompts
source_images
steps
training_type TrainingType
trigger_word string
webhook_url

TrainingType

Type: string

ValidationError

Name Type Description
loc Array<>
msg string
type string

Security schemes

Name Type Scheme Description
HTTPBearer http bearer