> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nx1cloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a fine-tune training job

> Render the GPU training DAG from an approved dataset job and persist it.



## OpenAPI

````yaml post /api/finetune/jobs
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/finetune/jobs:
    post:
      tags:
        - AutoLLM
      summary: Create a fine-tune training job
      description: Render the GPU training DAG from an approved dataset job and persist it.
      operationId: create_training_job_api_finetune_jobs_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FineTuneJobRequest'
      responses:
        '201':
          description: Job created with rendered DAG.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FineTuneJobResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '409':
          description: Dataset job is not COMPLETE.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: Trainer image not configured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    FineTuneJobRequest:
      properties:
        dataset_job_id:
          type: string
          format: uuid
          title: Dataset Job Id
          description: A COMPLETE fine-tune dataset job supplying the JSONL + base model.
        name:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: Name
          description: Human-friendly job name. Defaults to '<domain>-<base_model>'.
        adapter_type:
          $ref: '#/components/schemas/AdapterTypeEnum'
          default: qlora
        hyperparameters:
          additionalProperties: true
          type: object
          title: Hyperparameters
          description: >-
            Trainer hyperparameters (epochs, learning_rate, lora_r, lora_alpha,
            lora_dropout, max_seq_len, ...). Trainer-side defaults fill any
            gaps.
        gpu_count:
          anyOf:
            - type: integer
              maximum: 64
              minimum: 1
            - type: 'null'
          title: Gpu Count
          description: Override GPU count; clamped to the configured min/max.
        trigger_now:
          type: boolean
          title: Trigger Now
          description: Trigger the Airflow DAG immediately after creation.
          default: true
      type: object
      required:
        - dataset_job_id
      title: FineTuneJobRequest
      description: Start a fine-tune training run from an approved dataset job.
    FineTuneJobResponse:
      properties:
        job_id:
          type: string
          format: uuid
          title: Job Id
        dataset_job_id:
          type: string
          format: uuid
          title: Dataset Job Id
        name:
          type: string
          title: Name
        domain:
          type: string
          title: Domain
        base_model:
          type: string
          title: Base Model
        owner:
          type: string
          title: Owner
        adapter_type:
          $ref: '#/components/schemas/AdapterTypeEnum'
        hyperparameters:
          additionalProperties: true
          type: object
          title: Hyperparameters
        gpu_resources:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Gpu Resources
        status:
          $ref: '#/components/schemas/FineTuneJobStatusEnum'
        rendered_dag:
          anyOf:
            - type: string
            - type: 'null'
          title: Rendered Dag
        airflow_dag_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Airflow Dag Id
        airflow_dag_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Airflow Dag Url
        mlflow_run_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Mlflow Run Id
        registered_model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Registered Model Name
        model_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Version
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - job_id
        - dataset_job_id
        - name
        - domain
        - base_model
        - owner
        - adapter_type
        - status
        - created_at
        - updated_at
      title: FineTuneJobResponse
      description: Full state of a fine-tune training job.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AdapterTypeEnum:
      type: string
      enum:
        - lora
        - qlora
      title: AdapterTypeEnum
      description: Parameter-efficient fine-tuning method.
    FineTuneJobStatusEnum:
      type: string
      enum:
        - ready
        - queued
        - running
        - complete
        - failed
      title: FineTuneJobStatusEnum
      description: Lifecycle of a fine-tune training job (mirrors the DB enum).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````