# 下载批量任务结果

> 通用

以文件流形式下载结果文件（JSONL）。`file_id` 传入查询任务接口返回的
`output_file_id`（成功结果）或 `error_file_id`（错误明细）。
结果文件中每行对应输入文件的一条请求，通过 `custom_id` 关联。

## 请求地址

`GET https://api.modelverse.cn/v1/files/{file_id}/content`

## 请求参数

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| file_id | path | string | Yes | 结果文件 ID，即 `output_file_id` 或 `error_file_id`。 |

## 响应

- **200** — 结果文件流。每行是一个 JSON 对象，`custom_id` 与输入请求一一对应，
`response.body` 为对应请求的返回结果。

- **404** — 文件不存在或无权限访问。
- **default** — 错误响应。

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "批量任务-下载任务结果接口文档",
    "version": "1.0.0",
    "description": "这是 ModelVerse 上 **OpenAI 兼容批量（Batch）异步任务**的第 5 步：下载任务结果。\n任务完成后，使用 `output_file_id`（成功结果）或 `error_file_id`（错误明细）\n下载对应的 JSONL 文件。接口路径为 `GET /v1/files/{file_id}/content`。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API endpoint."
    }
  ],
  "tags": [
    {
      "name": "批量异步任务",
      "description": "OpenAI 兼容的批量异步任务接口。"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/files/{file_id}/content": {
      "get": {
        "tags": [
          "批量异步任务"
        ],
        "operationId": "downloadBatchOutput",
        "summary": "下载批量任务结果",
        "description": "以文件流形式下载结果文件（JSONL）。`file_id` 传入查询任务接口返回的\n`output_file_id`（成功结果）或 `error_file_id`（错误明细）。\n结果文件中每行对应输入文件的一条请求，通过 `custom_id` 关联。\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "description": "结果文件 ID，即 `output_file_id` 或 `error_file_id`。",
            "schema": {
              "type": "string"
            },
            "example": "file-out456"
          }
        ],
        "responses": {
          "200": {
            "description": "结果文件流。每行是一个 JSON 对象，`custom_id` 与输入请求一一对应，\n`response.body` 为对应请求的返回结果。\n",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "description": "JSONL 结果文件的原始字节流。"
                }
              },
              "application/jsonl": {
                "schema": {
                  "type": "string",
                  "description": "JSONL 文本，每行一个结果对象。示例（单行）：\n`{\"id\":\"batch_req_1\",\"custom_id\":\"request-1\",\"response\":{\"status_code\":200,\"request_id\":\"req_aaa\",\"body\":{\"id\":\"chatcmpl-1\",\"object\":\"chat.completion\",\"model\":\"gpt-5-batch\",\"choices\":[{\"index\":0,\"finish_reason\":\"stop\",\"message\":{\"role\":\"assistant\",\"content\":\"杭州是浙江省省会。\"}}],\"usage\":{\"prompt_tokens\":30,\"completion_tokens\":8,\"total_tokens\":38}}},\"error\":null}`\n"
                },
                "examples": {
                  "success": {
                    "summary": "结果文件（示意为两行）",
                    "value": "{\"id\":\"batch_req_1\",\"custom_id\":\"request-1\",\"response\":{\"status_code\":200,\"request_id\":\"req_aaa\",\"body\":{\"id\":\"chatcmpl-1\",\"object\":\"chat.completion\",\"model\":\"gpt-5-batch\",\"choices\":[{\"index\":0,\"finish_reason\":\"stop\",\"message\":{\"role\":\"assistant\",\"content\":\"杭州是浙江省省会，以西湖美景和数字经济闻名。\"}}],\"usage\":{\"prompt_tokens\":30,\"completion_tokens\":18,\"total_tokens\":48}}},\"error\":null}\n{\"id\":\"batch_req_2\",\"custom_id\":\"request-2\",\"response\":{\"status_code\":200,\"request_id\":\"req_bbb\",\"body\":{\"id\":\"chatcmpl-2\",\"object\":\"chat.completion\",\"model\":\"gpt-5-batch\",\"choices\":[{\"index\":0,\"finish_reason\":\"stop\",\"message\":{\"role\":\"assistant\",\"content\":\"1 加 1 等于 2。\"}}],\"usage\":{\"prompt_tokens\":12,\"completion_tokens\":6,\"total_tokens\":18}}},\"error\":null}\n"
                  }
                }
              }
            }
          },
          "404": {
            "description": "文件不存在或无权限访问。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/BatchError"
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/BatchError"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "通过 HTTP 头 `Authorization` 携带 API Key，格式为 `Bearer <your_api_key>`。\n"
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "错误说明。"
          },
          "type": {
            "type": "string",
            "description": "错误类型。",
            "examples": [
              "invalid_request_error"
            ]
          },
          "code": {
            "type": "string",
            "description": "机器可读的错误码。"
          },
          "param": {
            "type": "string",
            "description": "出错的参数名或请求 ID。"
          }
        }
      }
    },
    "examples": {
      "BatchError": {
        "summary": "标准 JSON 错误响应",
        "value": {
          "error": {
            "message": "file not found",
            "type": "invalid_request_error",
            "code": "not_found",
            "param": "file_id"
          }
        }
      }
    }
  }
}
```
