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

# GET /api/models/{slug}/download — 下载 Aria 模型包

> 下载量化的 Aria 模型包。返回指向短时效 S3 预签名 URL 的 302 重定向、ZIP 流，或按请求返回的 JSON 载荷。

下载 Aria 模型包。默认情况下服务器返回一个指向短时效 S3 预签名 URL 的 `302` 重定向。对于以目录为键的模型包，它会流式返回 ZIP 文件。发送 `Accept: application/json` 或附加 `?format=json` 可改为以 JSON 接收 URL。

**方法：** `GET` **路径：** `/api/models/{slug}/download` **认证：** 会话 Bearer、`?token=` 查询 JWT，或 Bearer API 密钥（`bfvk-...`）

## 路径参数

<ParamField path="slug" type="string" required>
  模型 slug（例如 `gemma-4-e2b-it`）。
</ParamField>

## 查询参数

<ParamField query="quant" type="string" required>
  量化等级：`int4`、`int8` 或 `int326`。
</ParamField>

<ParamField query="sdk" type="string" required>
  SDK 版本（例如 `v1.0`）。
</ParamField>

<ParamField query="format" type="string">
  设为 `json` 以接收 JSON 信封，而非重定向或 ZIP 流。
</ParamField>

<ParamField query="token" type="string">
  用于浏览器发起下载的会话 JWT。等价于 `Authorization: Bearer`。
</ParamField>

## 响应

默认响应是指向短时效 S3 预签名 URL 的 `302 Found` 重定向（单文件），或以 `200 OK` 返回的 ZIP 流（以目录为键的模型包，带 `Content-Disposition: attachment; filename=...`）。

使用 `Accept: application/json` 或 `?format=json` 时：

<ResponseField name="mode" type="string">
  `redirect`（单文件）或 `zip`（目录）。
</ResponseField>

<ResponseField name="url" type="string">
  预签名 URL 或下载 URL。
</ResponseField>

<ResponseField name="filename" type="string">
  建议的输出文件名。
</ResponseField>

## 示例

<CodeGroup>
  ```bash 跟随重定向 theme={null}
  curl -L -H "Authorization: Bearer bfvk-XXXXXXXXXXXXXXXX" \
    "https://ariacompute.cn/api/models/gemma-4-e2b-it/download?quant=int4&sdk=v1.0" \
    -o gemma-4-e2b-it_q4.zip
  ```

  ```bash JSON 信封 theme={null}
  curl -H "Authorization: Bearer bfvk-XXXXXXXXXXXXXXXX" \
    -H "Accept: application/json" \
    "https://ariacompute.cn/api/models/gemma-4-e2b-it/download?quant=int4&sdk=v1.0"
  ```

  ```json 响应 theme={null}
  {
    "mode": "redirect",
    "url": "https://s3.amazonaws.com/aria-bundles/...?X-Amz-Expires=300",
    "filename": "gemma-4-e2b-it_q4.zip"
  }
  ```
</CodeGroup>

<Warning>
  预签名 URL 很快过期。不要缓存它们：每次下载都请求一个新的。
</Warning>

## 错误

| 状态    | 含义                   |
| ----- | -------------------- |
| `401` | 缺失或无效的凭证。            |
| `404` | 未知的 slug、量化或 SDK 组合。 |
| `429` | 超出限流。                |
