openapi: 3.0.0
info:
  title: Flux Training API
  version: 1.0.0
paths:
  /api/flux/train/:
    post:
      summary: Train a model with the provided dataset and parameters
      description: This endpoint triggers model training using a dataset, parameters, and configuration.
      operationId: trainModel
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                trigger_word:
                  type: string
                  description: The trigger word used for training.
                  example: "dogo"
                dataset_file:
                  type: string
                  format: binary
                  description: The dataset file to upload (ZIP file).
                org:
                  type: string
                  description: Organization ID.
                  example: "155db1fc-73ba-46e4-9de6-308f2521c349"
                request_id:
                  type: string
                  description: Unique identifier for the request.
                  example: "2aaf1563-dd6b-480f-8228-f0e1ad8bb644"
                rank:
                  type: integer
                  description: Rank/priority for the task.
                  example: 32
                steps:
                  type: integer
                  description: Number of steps for training.
                  example: 1000
                lr:
                  type: number
                  format: float
                  description: Learning rate for training.
                  example: 0.004
                token:
                  type: string
                  description: Token for authentication or access.
                  example: "abcsdg"
                optimizers:
                  type: string
                  description: Optimizer to use for training.
                  example: "adamw8bit"
      responses:
        '200':
          description: Training initiated successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    job_id:
                      type: string
                      description: Unique job identifier for the training process.
                      example: "77c426d1-0f3a-4e12-8759-cff7a9bc4995-u1"
                    status:
                      type: string
                      description: The status of the training job.
                      enum:
                        - "COMPLETED"
                        - "IN_PROGRESS"
                        - "FAILED"
                      example: "COMPLETED"
                    runDuration:
                      type: integer
                      description: The duration of the training run in milliseconds.
                      example: 2987764
                    lora_id:
                      type: string
                      description: LoRA ID associated with the training job (if applicable).
                      example: "<LoRA ID>"
        '400':
          description: Bad Request (e.g., missing required parameters or invalid file)
        '401':
          description: Unauthorized (if authentication fails)
        '500':
          description: Internal server error
