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

# 访问生成素材

> 返回生成图片文件。任务查询响应中的 `result.images[].url` 已经是完整地址，通常可以直接使用该 URL，无需手工拼接。

```http 200 theme={null}
HTTP/1.1 200 OK
Content-Type: image/png
Cache-Control: public, max-age=259200, immutable

<binary image data>
```

```json 404 theme={null}
{
  "error": {
    "code": 404,
    "type": "not_found_error",
    "message": "素材不存在、已过期或已被自动清理",
    "details": {
      "upstream_code": "ASSET_NOT_FOUND"
    }
  },
  "request_id": "req_xxx"
}
```

```json 500 theme={null}
{
  "error": {
    "code": 500,
    "type": "internal_error",
    "message": "素材存储读取失败",
    "details": {
      "upstream_code": "STORAGE_READ_FAILED"
    },
    "retryable": true
  },
  "request_id": "req_xxx"
}
```

```json 503 theme={null}
{
  "error": {
    "code": 503,
    "type": "service_unavailable_error",
    "message": "当前环境未配置素材存储",
    "details": {
      "upstream_code": "STORAGE_NOT_CONFIGURED"
    },
    "retryable": true
  },
  "request_id": "req_xxx"
}
```


## OpenAPI

````yaml openapi/openapi.yaml GET /v1/open/assets/{asset_id}
openapi: 3.1.0
info:
  title: 灵感开放平台 API
  version: 1.0.0
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
  description: >
    灵感开放平台面向外部 AI 工具和业务系统提供商品分析、A+ 策划、图片生成、图片上传、任务查询和素材下载能力。


    所有业务接口均使用 HTTPS。除公开素材地址外，请在 `Authorization` 请求头中传入成员级 Public API Key。


    所有 JSON 响应都会同步返回。成功响应统一为 `{code, data, request_id}`；错误响应统一为 `{error: {code,
    type, message, ...}, request_id}`。生图提交只返回任务编号，图片在后台继续生成，需要通过任务查询接口获取最终结果。
servers:
  - url: https://api.ch88.cn
    description: 正式环境
security:
  - PublicApiKey: []
tags:
  - name: 图片上传
    description: 上传商品图或参考图，取得可供后续接口使用的临时 URL。
  - name: AI 分析与策划
    description: 同步返回商品分析、商品图片批次策划和 A+ 页面策划结果。
  - name: 生图任务
    description: 提交异步原生图片、商品图或 A+ 图片生成任务。
  - name: 任务查询
    description: 查询异步任务状态和生成结果。
  - name: 素材下载
    description: 访问生成结果。素材地址最长保留 3 天。
paths:
  /v1/open/assets/{asset_id}:
    get:
      tags:
        - 素材下载
      summary: 访问生成素材
      description: >
        返回生成图片文件。任务查询响应中的 `result.images[].url` 已经是完整地址，通常可以直接使用该 URL，无需手工拼接。


        生成素材最长保留 3 天，可以在有效期内直接通过浏览器或 `<img>` 标签访问。到期后对象会被清理并返回
        404，因此需要长期保存时请及时下载到自己的存储。
      operationId: downloadAsset
      parameters:
        - name: asset_id
          in: path
          required: true
          description: 任务查询结果中的 `asset_id`。如果自行拼接 URL，必须进行 URL 编码。
          schema:
            type: string
          example: generated/open-result/task_01K4Y8R6Z1J2X3M4N5P6Q7R8S9-0.png
      responses:
        '200':
          description: 图片二进制文件。
          headers:
            Content-Type:
              description: 实际图片 MIME 类型。
              schema:
                type: string
                example: image/png
            Cache-Control:
              description: 浏览器和 CDN 缓存策略。
              schema:
                type: string
                example: public, max-age=259200, immutable
          content:
            image/png:
              schema:
                type: string
                format: binary
            image/jpeg:
              schema:
                type: string
                format: binary
            image/webp:
              schema:
                type: string
                format: binary
        '404':
          description: 素材不存在、已过期或已被自动清理。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: 404
                  type: not_found_error
                  message: 素材不存在、已过期或已被自动清理
                  details:
                    upstream_code: ASSET_NOT_FOUND
                request_id: req_xxx
        '500':
          description: 素材存储读取失败。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: 500
                  type: internal_error
                  message: 素材存储读取失败
                  details:
                    upstream_code: STORAGE_READ_FAILED
                  retryable: true
                request_id: req_xxx
        '503':
          description: 当前环境未配置素材存储。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: 503
                  type: service_unavailable_error
                  message: 当前环境未配置素材存储
                  details:
                    upstream_code: STORAGE_NOT_CONFIGURED
                  retryable: true
                request_id: req_xxx
      security: []
components:
  schemas:
    ApiError:
      type: object
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          required:
            - code
            - type
            - message
          properties:
            code:
              type: integer
              description: HTTP 状态码，例如 400、401、429、503。
            type:
              type: string
              description: 稳定错误类别，例如 `invalid_request_error`、`authentication_error`。
            message:
              type: string
              description: 中文错误说明。
            param:
              type: string
              description: 出错的请求字段。
            details:
              type: object
              additionalProperties: true
              description: 具体原因、收到的值或允许值。
            retryable:
              type: boolean
              description: 是否建议在等待后自动重试。
        request_id:
          $ref: '#/components/schemas/RequestId'
    RequestId:
      type: string
      description: 本次请求的诊断编号。联系平台排查问题时请提供，不要记录 Public API Key。
      example: req_550e8400-e29b-41d4-a716-446655440000
  securitySchemes:
    PublicApiKey:
      type: http
      scheme: bearer
      bearerFormat: Linggan Public API Key
      description: >
        成员级 Public API Key。请填写完整密钥，Mintlify Playground 会自动以 `Authorization:
        Bearer <PUBLIC_API_KEY>` 发送。完整明文只在管理后台创建成功时显示一次。

````

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