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

# Prepare a fine-tuned model for FP4 inference

> Merges a fine-tuned adapter into its base model and prepares the result for FP4 inference. The adapter is resolved when the request is made, so a request naming a model that does not exist in the project, is not an adapter, was not produced by fine-tuning, has no base model to merge into, or uses an unsupported base model is rejected with 400 rather than accepted and failed later. The run is priced before it is created, and a project that cannot cover it is answered 402.




## OpenAPI

````yaml openapi.yaml POST /shaping/prepare-for-fp4-inference
openapi: 3.1.0
info:
  title: Together APIs
  description: The Together REST API. See https://docs.together.ai for more details.
  version: 2.0.0
  termsOfService: https://www.together.ai/terms-of-service
  contact:
    name: Together Support
    url: https://www.together.ai/contact
  license:
    name: MIT
    url: https://github.com/togethercomputer/openapi/blob/main/LICENSE
servers:
  - url: https://api.together.ai/v1
    description: Default environment for APIs
  - url: https://api-inference.together.ai/v2
    description: Optimized environment for inference
security:
  - bearerAuth: []
paths:
  /shaping/prepare-for-fp4-inference:
    post:
      tags:
        - Shaping
      summary: Prepare a fine-tuned model for FP4 inference
      description: >
        Merges a fine-tuned adapter into its base model and prepares the result
        for FP4 inference. The adapter is resolved when the request is made, so
        a request naming a model that does not exist in the project, is not an
        adapter, was not produced by fine-tuning, has no base model to merge
        into, or uses an unsupported base model is rejected with 400 rather than
        accepted and failed later. The run is priced before it is created, and a
        project that cannot cover it is answered 402.
      operationId: createQuantizationJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuantizationRequest'
      responses:
        '200':
          description: Quantization job created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuantizationJob'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
        '402':
          description: The project cannot cover the estimated price of the run.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
        '403':
          description: The project is blocked and cannot start a run.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
        '503':
          description: Preparing models for FP4 inference is not available.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
components:
  schemas:
    QuantizationRequest:
      type: object
      description: Request body for preparing an adapter for FP4 inference.
      required:
        - inputs
      properties:
        inputs:
          $ref: '#/components/schemas/QuantizationPipelineInputs'
          description: Adapter inputs to prepare.
    QuantizationJob:
      description: Quantization job that prepares an adapter for FP4 inference.
      allOf:
        - $ref: '#/components/schemas/BaseShapingJob'
        - type: object
          description: Quantization job that prepares an adapter for FP4 inference.
          required:
            - params
            - events
          properties:
            params:
              $ref: '#/components/schemas/QuantizationPipelineSpec'
              description: Job specification.
            results:
              $ref: '#/components/schemas/QuantizationResults'
              description: Model artifacts produced by the job.
            events:
              type: array
              description: Events emitted by the job.
              items:
                $ref: '#/components/schemas/QuantizationEvent'
    ErrorData:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              nullable: false
            type:
              type: string
              nullable: false
            param:
              type: string
              nullable: true
              default: null
            code:
              type: string
              nullable: true
              default: null
          required:
            - type
            - message
    QuantizationPipelineInputs:
      type: object
      description: Adapter identifiers to prepare.
      required:
        - adapter_object_id
      properties:
        adapter_object_id:
          type: string
          pattern: ^ml_.+
          description: Model object ID of the adapter to prepare.
        adapter_revision_id:
          type: string
          pattern: ^rv_.+
          description: >-
            Adapter revision ID to prepare. Omit to use the adapter's current
            revision.
        calibration_file_id:
          type: string
          pattern: ^file-.+
          description: >
            Conversation dataset file ID to use for calibration. Upload it first
            with `POST /v1/files` using purpose `calibration` and file type
            `jsonl`. Each JSONL row must contain a `messages` array and may
            contain a `tools` array.

            When provided, the job draws half of the calibration corpus from
            this file and half from a general-text corpus. When omitted, the job
            calibrates on the general-text corpus only.

            The request is rejected unless the file exists in the request
            project, has finished uploading, has passed files API validation as
            a conversation dataset, is not empty, and is at most 64 MiB. A
            `fine-tune` purpose file is also accepted so a training file can be
            reused.
          example: file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35
      example:
        adapter_object_id: ml_CeG3fF6pyEViU8dE8pk7R
        adapter_revision_id: rv_CeG3faPBj2ABwbAaHPTmx
        calibration_file_id: file-5f1b0c7a-2d19-4a3e-9c60-8ab41c2f7d35
    BaseShapingJob:
      type: object
      description: Public fields common to shaping jobs.
      required:
        - id
        - job_type
        - status
        - created_at
        - updated_at
        - user_id
      properties:
        id:
          type: string
          pattern: ^shp-quant-[a-f0-9-]+$
          description: Unique shaping job ID.
        job_type:
          $ref: '#/components/schemas/ShapingJobType'
          description: Type of shaping job.
        status:
          $ref: '#/components/schemas/ShapingJobStatus'
          description: Current job status.
        created_at:
          type: string
          format: date-time
          description: Time when the job was created.
        updated_at:
          type: string
          format: date-time
          description: Time when the job was last updated.
        user_id:
          type: string
          description: User that created the job.
    QuantizationPipelineSpec:
      type: object
      description: >-
        Stored job specification containing the request and resolved
        configuration.
      required:
        - inputs
        - configuration
      properties:
        inputs:
          $ref: '#/components/schemas/QuantizationPipelineInputs'
          description: Adapter inputs requested by the caller.
        configuration:
          $ref: '#/components/schemas/QuantizationPipelineConfiguration'
          description: Server-resolved configuration for the run.
    QuantizationResults:
      type: object
      description: Model artifact produced by a completed quantization job.
      properties:
        model_object_id:
          type: string
          description: Model object ID registered by the job.
        model_revision_id:
          type: string
          description: Model revision ID registered by the job.
    QuantizationEvent:
      description: Event emitted by a quantization job.
      allOf:
        - $ref: '#/components/schemas/BaseShapingEvent'
        - type: object
          description: Event emitted by a quantization job.
          properties:
            type:
              type: string
              description: Quantization event type.
              enum:
                - SHAPING_ERROR
                - SHAPING_USER_ERROR
                - QUANTIZATION_JOB_START
                - QUANTIZATION_MODEL_DOWNLOAD_COMPLETE
                - QUANTIZATION_MERGE_COMPLETE
                - QUANTIZATION_QUANTIZE_PROCESS_START
                - QUANTIZATION_QUANTIZE_PROCESS_COMPLETE
                - QUANTIZATION_MODEL_UPLOAD_COMPLETE
                - QUANTIZATION_JOB_COMPLETE
            result:
              $ref: '#/components/schemas/QuantizationResults'
              description: Result attached to completion events.
    ShapingJobType:
      type: string
      description: Kind of shaping job.
      enum:
        - quantization
    ShapingJobStatus:
      type: string
      description: Lifecycle status of a shaping job.
      enum:
        - pending
        - queued
        - running
        - completed
        - cancelled
        - cancel_requested
        - error
        - user_error
    QuantizationPipelineConfiguration:
      type: object
      description: Server-resolved configuration for a quantization job.
      readOnly: true
      required:
        - user_id
        - adapter_project_id
        - adapter_revision_id
        - adapter_model_name
        - base_object_id
        - base_revision_id
        - base_model_name
      properties:
        user_id:
          type: string
          description: User whose scope is used to fetch the adapter weights.
          example: user_CKfewYkQBpaEmN7wuQS3W
        adapter_project_id:
          type: string
          description: Project that owns the adapter.
          example: proj_CczF9KYFantA84sNYDTJd
        adapter_revision_id:
          type: string
          description: Adapter revision selected for preparation.
          example: rv_CeERyXMBQCJTRC1yqGTpk
        adapter_model_name:
          type: string
          description: Qualified adapter model name.
          example: ft-qa-artifacts/glm-5.3-e2e-test-adapter
        base_object_id:
          type: string
          description: Model object ID of the adapter's base model.
          example: ml_CbJ9yCnij7A47b1xkpioB
        base_revision_id:
          type: string
          description: Revision ID of the adapter's base model.
          example: rv_CbJ9yNrws93VQrZum1fTE
        base_model_name:
          type: string
          description: Qualified name of the base model.
          example: zai-org/GLM-5.3-NVFP4
    BaseShapingEvent:
      type: object
      description: Public fields common to shaping events.
      required:
        - object
        - created_at
        - level
        - message
        - type
      properties:
        object:
          type: string
          const: shaping
          description: Object type, always `shaping`.
        created_at:
          type: string
          format: date-time
          description: Time when the event was created.
        level:
          $ref: '#/components/schemas/EventLevel'
          description: Event severity level.
        message:
          type: string
          description: Human-readable event message.
        type:
          type: string
          description: Event type identifier.
        hash:
          type: string
          description: Event hash used for deduplication.
    EventLevel:
      type: string
      description: Severity level for a shaping event.
      enum:
        - Info
        - Warning
        - Error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-bearer-format: bearer
      x-default: default

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.