# `vllm_mlx.utils.download`

Resumable model download with retry/timeout support.

[View the complete module source at #L1-L144](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/utils/download.py#L1-L144).

## API details

Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.

::: vllm_mlx.utils.download
    options:
      members:
        - logger
        - LLM_ALLOW_PATTERNS
        - MLLM_ALLOW_PATTERNS
        - DownloadConfig
        - ensure_model_downloaded
      filters: []
      show_if_no_docstring: true

## Complete contract reference

Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.

<details class="api-contract" id="contract-vllm_mlx.utils.download.DownloadConfig" markdown="1">
<summary><code>vllm_mlx.utils.download.DownloadConfig</code> · class</summary>

```python
vllm_mlx.utils.download.DownloadConfig(download_timeout: int = 300, max_retries: int = 3, retry_backoff_base: float = 2.0, offline: bool = False)
```

Configuration for model download behavior.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `download_timeout` | `int` | `no` | `300` | Optional constructor field; defaults to `300`. |
| `max_retries` | `int` | `no` | `3` | Optional constructor field; defaults to `3`. |
| `retry_backoff_base` | `float` | `no` | `2.0` | Optional constructor field; defaults to `2.0`. |
| `offline` | `bool` | `no` | `False` | Optional constructor field; defaults to `False`. |

**Returns**

- Constructs: `vllm_mlx.utils.download.DownloadConfig`

**Exceptions and behavior**

Class `DownloadConfig` declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L45-L51](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/utils/download.py#L45-L51).

</details>

<details class="api-contract" id="contract-vllm_mlx.utils.download.ensure_model_downloaded" markdown="1">
<summary><code>vllm_mlx.utils.download.ensure_model_downloaded</code> · function</summary>

```python
vllm_mlx.utils.download.ensure_model_downloaded(model_name: str, config: DownloadConfig | None = None, is_mllm: bool = False) -> Path
```

Ensure a model is available locally, downloading with retry if needed.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `model_name` | `str` | `yes` | `none` | HuggingFace model name or local path. |
| `config` | `DownloadConfig \| None` | `no` | `None` | Download configuration. Uses defaults if None. |
| `is_mllm` | `bool` | `no` | `False` | If True, use MLLM download patterns (broader file set). |

**Returns**

- Type: `Path`
- Direct return expressions: `model_path`; `result`

**Exceptions and behavior**

Function `ensure_model_downloaded` calls `DownloadConfig`, `Path`, `model_path.exists`, `logger.info`; can raise `RuntimeError`; has 2 explicit return paths.
Directly raised exceptions: `RuntimeError`.

[View source #L54-L144](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/utils/download.py#L54-L144).

</details>

## Complete symbol map

This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.

| Symbol | Kind | Signature and inputs | What it does | Source |
| --- | --- | --- | --- | --- |
| [`DownloadConfig`](#contract-vllm_mlx.utils.download.DownloadConfig) | class | `DownloadConfig(download_timeout: int = 300, max_retries: int = 3, retry_backoff_base: float = 2.0, offline: bool = False)` | Configuration for model download behavior. | [#L45-L51](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/utils/download.py#L45-L51) |
| [`ensure_model_downloaded`](#contract-vllm_mlx.utils.download.ensure_model_downloaded) | function | `ensure_model_downloaded(model_name: str, config: DownloadConfig \| None = None, is_mllm: bool = False) -> Path` | Ensure a model is available locally, downloading with retry if needed. | [#L54-L144](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/utils/download.py#L54-L144) |
