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

# Download

> Download commands for bundle requests and LEAP models in the LEAP Bundle CLI

The `download` command supports two modes of operation:

<Tabs>
  <Tab title="LEAP Model Download">
    Download GGUF files for a model from the [LEAP Model Library](https://leap.liquid.ai/models). **Does not require authentication.**

    ```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
    leap-bundle download <model-name> [--quantization <quantization>] [--output-path <path>] [--overwrite]
    ```

    **Arguments**

    * `model-name` (required): Name of the model to download from the LEAP Model Library

    **Options**

    * `--quantization <quantization>`: Quantization level to download for the model. You can find available quantization levels for each model in the [LEAP Model Library](https://leap.liquid.ai/models). Defaults to `Q5_K_M` if not specified.
    * `--output-path <path>`: Directory to save the downloaded files. If not specified, auto-generates a directory name based on the manifest URL.
    * `--overwrite`: By default, if the JSON file already exists in the output path, the command will throw an error. With this flag, the existing file will be overwritten.

    **Behavior**

    * Create an output directory based on the URL or according to `--output-path` if specified.
    * Download the JSON manifest file.
    * Download all model files referenced in `load_time_parameters` in the manifest
    * Update the local manifest to use relative paths to the downloaded files.

    **Examples**

    ```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # Download from manifest URL (auto-generates directory name)
    leap-bundle download LFM2-1.2B --quantization Q5_K_M

    # Example output
    ℹ Verifying URL returns JSON content...
    ℹ No output path specified, using: <default_path>
    ℹ Downloading manifest from https://huggingface.co/LiquidAI/LeapBundles/resolve/main/LFM2-1.2B-GGUF/Q5_K_M.json...
    ⠙ Downloading manifest completed!
    ✓ Manifest downloaded to <default_path>/Q5_K_M.json
    ℹ Found 2 parameters in load_time_parameters
    ℹ Downloading model: LFM2-1.2B-Q5_K_M.gguf...
    ⠼ Downloading LFM2-1.2B-Q5_K_M.gguf completed!
    ✓ Downloaded LFM2-1.2B-Q5_K_M.gguf
    ✓ Manifest updated with relative paths: <default_path>/Q5_K_M.json
    ✓ All files downloaded successfully to: <default_path>
    ```

    **Manifest Format**

    The JSON manifest should contain a `load_time_parameters` section with URLs to model files:

    ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      "load_time_parameters": {
        "model_path": "https://example.com/model.gguf",
        "vocab_path": "https://example.com/vocab.gguf"
      }
    }
    ```

    After download, the manifest is updated to use relative paths:

    ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      "load_time_parameters": {
        "model_path": "./model.gguf",
        "vocab_path": "./vocab.gguf"
      }
    }
    ```

    **Error Cases**

    * Invalid URL: Shows URL validation error
    * Manifest not found: Shows HTTP 404 error
    * Invalid JSON: Shows JSON parsing error
    * Model file download failure: Shows download error
    * Output directory creation failure: Shows file system error
    * Network issues: Shows connection error
  </Tab>

  <Tab title="Bundle Request Download">
    Download the model files for a completed bundle request. **Requires authentication** via `leap-bundle login`.

    ```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
    leap-bundle download <request-id> [--output-path <path>]
    ```

    **Arguments**

    * `request-id` (required): ID of the bundle request to download

    **Options**

    * `--output-path <path>`: Directory to save the downloaded files (default: current directory)

    **Behavior**

    * Requests signed download URLs from the LEAP platform
    * Downloads the model files using the signed URLs
    * Saves files with default names or to the specified output path
    * GGUF requests may produce multiple `.gguf` files; ExecuTorch requests produce a single `.bundle` file

    **Examples**

    ```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # Download GGUF bundle request to current directory
    leap-bundle download 18734

    # Example output
    ℹ Requesting download for bundle request 18734...
    ✓ Download URL obtained for request 18734
    Downloading bundle output... ✓
    ✓ Download completed successfully! File saved to: model-Q4_K_M.gguf

    # Download to specific directory
    leap-bundle download 18734 --output-path ./downloads/

    # Example output
    ℹ Requesting download for bundle request 18734...
    ✓ Download URL obtained for request 18734
    Downloading bundle output... ✓
    ✓ Download completed successfully! File saved to: downloads/model-Q4_K_M.gguf
    ```

    **Error Cases**

    * Request not found: Shows request not found error
    * Request not completed: Shows status error (request must be in "completed" status)
    * Request already archived: Shows archived error
    * Output directory doesn't exist: Shows directory not found error
    * Output path is not a directory: Shows invalid path error
    * Download failure: Shows network or file system error
    * Not authenticated: Prompts to login first

    <Info>
      Only requests with "completed" status can be downloaded. Check the request status using `leap-bundle list <request-id>` before attempting to download.
    </Info>

    <Warning>
      A completed request will be automatically archived 5 days after completion. You will not be able to download it afterwards.
    </Warning>
  </Tab>
</Tabs>
