> ## 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.

# 商品图片 AI 策划

> 根据商品图、参考图、排版图和计划生成的图片类型，同步返回一批商品图片的内容分工与视觉方案。该接口只生成策划，不会提交生图任务。

```json 200 theme={null}
{
  "code": 200,
  "data": {
    "product_boundary": {
      "immutable_product": "滴管瓶、瓶盖、真实标签及包装结构",
      "replaceable_contents": [
        "背景",
        "展示台",
        "装饰物"
      ],
      "bundled_components": [
        "滴管"
      ],
      "boundary_reason": "商品主体和随售部件可从输入图片确认。"
    },
    "assignments": [
      {
        "task_key": "main:1",
        "primary_focus": "商品主体与核心视觉识别",
        "visual_direction": "产品居中，使用清透水感背景和柔和自然光。",
        "supporting_details": "保留瓶身、滴管和真实标签细节。",
        "load_state": "full",
        "content_set": [
          "滴管瓶",
          "水感背景",
          "简洁展示台"
        ],
        "source_content_action": "移除原图无关背景，完整保留商品本体。"
      },
      {
        "task_key": "detail-selling:1",
        "primary_focus": "滴管与瓶口结构细节",
        "visual_direction": "使用局部特写展示滴管和瓶口工艺。",
        "supporting_details": "控制景深，确保结构清晰可辨。",
        "load_state": "detail-only",
        "content_set": [
          "滴管",
          "瓶口",
          "玻璃材质细节"
        ],
        "source_content_action": "仅保留与商品细节相关的可见内容。"
      }
    ]
  },
  "request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
```

```json 400 theme={null}
{
  "error": {
    "code": 400,
    "type": "invalid_request_error",
    "message": "请至少提供 1 张产品图"
  },
  "request_id": "req_xxx"
}
```

```json 401 theme={null}
{
  "error": {
    "code": 401,
    "type": "authentication_error",
    "message": "缺少 Public API Key"
  },
  "request_id": "req_xxx"
}
```

```json 403 theme={null}
{
  "error": {
    "code": 403,
    "type": "permission_error",
    "message": "成员或组织已停用"
  },
  "request_id": "req_xxx"
}
```

```json 409 theme={null}
{
  "error": {
    "code": 409,
    "type": "conflict_error",
    "message": "成员未分配有效上游密钥"
  },
  "request_id": "req_xxx"
}
```

```json 429 theme={null}
{
  "error": {
    "code": 429,
    "type": "rate_limit_error",
    "message": "请求过于频繁，请稍后重试",
    "retryable": true
  },
  "request_id": "req_xxx"
}
```

```json 502 theme={null}
{
  "error": {
    "code": 502,
    "type": "upstream_error",
    "message": "上游服务暂时不可用，请稍后重试",
    "retryable": true
  },
  "request_id": "req_xxx"
}
```

```json 503 theme={null}
{
  "error": {
    "code": 503,
    "type": "service_unavailable_error",
    "message": "服务暂时不可用，请稍后重试",
    "retryable": true
  },
  "request_id": "req_550e8400-e29b-41d4-a716-446655440000"
}
```


## OpenAPI

````yaml openapi/openapi.yaml POST /v1/open/product-images/plans
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/product-images/plans:
    post:
      tags:
        - AI 分析与策划
      summary: 商品图片 AI 策划
      description: >
        根据商品图、参考图、排版图和计划生成的图片类型，同步返回一批商品图片的内容分工与视觉方案。该接口只生成策划，不会提交生图任务。


        调用方可以检查或编辑返回的策划，再将对应方案整理为 `prompt` 调用商品图片生成接口。接口可能需要数十秒，客户端超时时间建议设置为至少
        120 秒。
      operationId: createProductImagePlan
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductImagePlanRequest'
            examples:
              ecommerceSet:
                summary: 策划一组商品主图与详情图
                value:
                  product_info:
                    name: 保湿精华液
                    sellingPoints: 清爽肤感，适合日常保湿
                    platform: Amazon
                  product_image_urls:
                    - >-
                      https://api.ch88.cn/v1/linggan/media/assets/generated%2Fopen-upload%2Fexample-front.png
                  reference_image_urls: []
                  layout_image_urls: []
                  global_prompt: 清透、克制、明亮，保留真实包装细节。
                  output_language: zh-cn
                  tasks:
                    - task_key: main:1
                      type_key: main
                      type_index: 1
                      type_total: 1
                    - task_key: detail-selling:1
                      type_key: detail-selling
                      type_index: 1
                      type_total: 1
      responses:
        '200':
          description: 批次策划完成。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductImagePlanResponseEnvelope'
              example:
                code: 200
                data:
                  product_boundary:
                    immutable_product: 滴管瓶、瓶盖、真实标签及包装结构
                    replaceable_contents:
                      - 背景
                      - 展示台
                      - 装饰物
                    bundled_components:
                      - 滴管
                    boundary_reason: 商品主体和随售部件可从输入图片确认。
                  assignments:
                    - task_key: main:1
                      primary_focus: 商品主体与核心视觉识别
                      visual_direction: 产品居中，使用清透水感背景和柔和自然光。
                      supporting_details: 保留瓶身、滴管和真实标签细节。
                      load_state: full
                      content_set:
                        - 滴管瓶
                        - 水感背景
                        - 简洁展示台
                      source_content_action: 移除原图无关背景，完整保留商品本体。
                    - task_key: detail-selling:1
                      primary_focus: 滴管与瓶口结构细节
                      visual_direction: 使用局部特写展示滴管和瓶口工艺。
                      supporting_details: 控制景深，确保结构清晰可辨。
                      load_state: detail-only
                      content_set:
                        - 滴管
                        - 瓶口
                        - 玻璃材质细节
                      source_content_action: 仅保留与商品细节相关的可见内容。
                request_id: req_550e8400-e29b-41d4-a716-446655440000
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/CredentialUnavailable'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          $ref: '#/components/responses/UpstreamFailed'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    ProductImagePlanRequest:
      type: object
      additionalProperties: false
      required:
        - product_image_urls
        - tasks
      properties:
        product_info:
          $ref: '#/components/schemas/ProductInfo'
        product_image_urls:
          type: array
          minItems: 1
          maxItems: 15
          description: 商品主体图片 URL，至少 1 张。商品图、参考图和排版图合计最多 15 张。
          items:
            type: string
            format: uri
        reference_image_urls:
          type: array
          maxItems: 14
          default: []
          description: 视觉风格或构图参考图片 URL。与其他图片合计不得超过 15 张。
          items:
            type: string
            format: uri
        layout_image_urls:
          type: array
          maxItems: 14
          default: []
          description: 排版参考图 URL。任务通过 `layout_image_index` 按从 1 开始的序号引用；与其他图片合计不得超过 15 张。
          items:
            type: string
            format: uri
        global_prompt:
          type: string
          maxLength: 3000
          description: 整批图片统一遵守的视觉风格、商品事实或禁止项。
        output_language:
          type: string
          default: zh-cn
          description: 图片策划中的目标文案语言；枚举含义与商品图片生成接口一致。
          enum:
            - no-text
            - thai
            - indonesian
            - vietnamese
            - malay
            - zh-cn
            - english
            - japanese
            - korean
            - filipino
            - zh-tw
            - french
            - spanish
            - german
            - italian
            - portuguese
            - russian
            - arabic
        tasks:
          type: array
          minItems: 2
          maxItems: 160
          description: 需要策划的图片任务。`task_key` 在本次请求内必须唯一。
          items:
            $ref: '#/components/schemas/ProductImagePlanTask'
    ProductImagePlanResponseEnvelope:
      type: object
      required:
        - code
        - data
        - request_id
      properties:
        code:
          type: integer
          description: HTTP 状态码。成功时为 200。
        data:
          $ref: '#/components/schemas/ProductImagePlanResult'
        request_id:
          $ref: '#/components/schemas/RequestId'
    ProductInfo:
      type: object
      additionalProperties: false
      description: 已知的结构化商品信息。所有数据应来自客户资料或可确认事实。
      properties:
        name:
          type: string
          description: 商品名称。
        sellingPoints:
          type: string
          description: 可确认的核心卖点。
        usage:
          type: string
          description: 使用方式或适用场景。
        salesRegion:
          type: string
          description: 销售国家或地区。
        platform:
          type: string
          description: 销售平台。
        visualStyle:
          type: string
          description: 期望的视觉风格。
        dimensions:
          $ref: '#/components/schemas/ProductDimensions'
        extra:
          type: string
          description: 其他需要在生图中考虑的事实或约束。
    ProductImagePlanTask:
      type: object
      additionalProperties: false
      required:
        - task_key
        - type_key
        - type_index
        - type_total
      properties:
        task_key:
          type: string
          maxLength: 120
          description: 调用方生成的唯一任务标识，用于把策划结果对应回原任务，例如 `main:1`。
        type_key:
          $ref: '#/components/schemas/ProductImageTypeKey'
        type_index:
          type: integer
          minimum: 1
          maximum: 100
          description: 当前任务在同一图片类型中的序号，从 1 开始。
        type_total:
          type: integer
          minimum: 1
          maximum: 100
          description: 本次请求中该图片类型的任务总数。
        user_prompt:
          type: string
          maxLength: 3000
          description: 当前任务的额外要求。
        festival:
          type: string
          maxLength: 80
          description: 节日或促销主题，例如 `圣诞节`；没有时省略。
        scene:
          type: string
          maxLength: 100
          description: 场景分类与名称，格式为 `分类:场景`；没有时省略。
        layout_name:
          type: string
          maxLength: 120
          description: 当前任务采用的排版名称。
        has_layout_image:
          type: boolean
          default: false
          description: 当前任务是否使用排版参考图。
        layout_image_index:
          type: integer
          minimum: 1
          maximum: 14
          description: 对应 `layout_image_urls` 中从 1 开始的图片序号；未使用排版图时省略。
    ProductImagePlanResult:
      type: object
      required:
        - product_boundary
        - assignments
      properties:
        product_boundary:
          $ref: '#/components/schemas/ProductImageProductBoundary'
        assignments:
          type: array
          description: 与请求任务按 `task_key` 一一对应的策划方案。
          items:
            $ref: '#/components/schemas/ProductImagePlanAssignment'
    RequestId:
      type: string
      description: 本次请求的诊断编号。联系平台排查问题时请提供，不要记录 Public API Key。
      example: req_550e8400-e29b-41d4-a716-446655440000
    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'
    ProductDimensions:
      type: object
      required:
        - unit
      properties:
        length:
          type: string
          description: 商品长度，仅填写数值。
        width:
          type: string
          description: 商品宽度，仅填写数值。
        height:
          type: string
          description: 商品高度，仅填写数值。
        unit:
          type: string
          enum:
            - cm
            - in
          description: 尺寸单位，`cm` 为厘米，`in` 为英寸。
    ProductImageTypeKey:
      type: string
      description: |
        主页商品图片类型。枚举值与用途对应关系：

        - `white-main`：白底主图
        - `main`：电商主图
        - `function-scene`：功能信息图
        - `dimension`：尺寸图
        - `detail-selling`：细节卖点图
        - `lifestyle`：使用场景图
        - `comparison`：对比图
        - `bundle`：包装与收货内容图
        - `graphic-design`：平面设计图
      enum:
        - white-main
        - main
        - function-scene
        - dimension
        - detail-selling
        - lifestyle
        - comparison
        - bundle
        - graphic-design
    ProductImageProductBoundary:
      type: object
      required:
        - immutable_product
        - replaceable_contents
        - bundled_components
        - boundary_reason
      properties:
        immutable_product:
          type: string
          description: 生图时不可改变的商品主体、结构和真实标识。
        replaceable_contents:
          type: array
          description: 可以替换或移除的背景、道具和展示内容。
          items:
            type: string
        bundled_components:
          type: array
          description: 输入材料能够确认的随售部件。
          items:
            type: string
        boundary_reason:
          type: string
          description: 商品边界判断依据。
    ProductImagePlanAssignment:
      type: object
      required:
        - task_key
        - primary_focus
        - visual_direction
        - supporting_details
        - load_state
        - content_set
        - source_content_action
      properties:
        task_key:
          type: string
          description: 请求中的任务唯一标识。
        primary_focus:
          type: string
          description: 当前图片唯一且明确的主要内容重点。
        visual_direction:
          type: string
          description: 构图、场景、光线和画面组织建议。
        supporting_details:
          type: string
          description: 辅助元素和细节表现建议。
        load_state:
          type: string
          enum:
            - empty
            - sparse
            - half-filled
            - full
            - installation
            - detail-only
            - comparison
            - not-applicable
          description: 商品或内容的装载/展示状态。
        content_set:
          type: array
          description: 建议出现在当前画面中的内容集合。
          items:
            type: string
        source_content_action:
          type: string
          description: 对输入图片原有背景、道具、包装或内容的处理要求。
  responses:
    ValidationFailed:
      description: >-
        请求体格式错误、缺少必填字段或字段值不受支持。`error.code` 为 HTTP 状态码，具体字段信息放在 `param` 和
        `details`。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              code: 400
              type: invalid_request_error
              message: 请至少提供 1 张产品图
            request_id: req_xxx
    Unauthorized:
      description: Public API Key 缺失、错误、过期或已删除。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            missing:
              value:
                error:
                  code: 401
                  type: authentication_error
                  message: 缺少 Public API Key
                request_id: req_xxx
            invalid:
              value:
                error:
                  code: 401
                  type: authentication_error
                  message: Public API Key 无效、已过期或已删除
                request_id: req_xxx
    Forbidden:
      description: Public API Key 所属成员或组织已停用。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              code: 403
              type: permission_error
              message: 成员或组织已停用
            request_id: req_xxx
    CredentialUnavailable:
      description: 当前成员未分配有效的上游密钥，或上游密钥暂时无法解密。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              code: 409
              type: conflict_error
              message: 成员未分配有效上游密钥
            request_id: req_xxx
    RateLimited:
      description: 请求触发平台或上游动态限流。平台当前未对外承诺固定 QPS 或并发数。
      headers:
        Retry-After:
          description: 如果响应包含该请求头，请至少等待指定秒数后重试。
          schema:
            type: integer
            minimum: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              code: 429
              type: rate_limit_error
              message: 请求过于频繁，请稍后重试
              retryable: true
            request_id: req_xxx
    UpstreamFailed:
      description: 上游服务不可用、返回格式异常或生成失败。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              code: 502
              type: upstream_error
              message: 上游服务暂时不可用，请稍后重试
              retryable: true
            request_id: req_xxx
    ServiceUnavailable:
      description: 灵感开放平台服务或所需存储、认证能力暂时不可用。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              code: 503
              type: service_unavailable_error
              message: 服务暂时不可用，请稍后重试
              retryable: true
            request_id: 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.