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

# 画布编辑

> 在目标画布中设置来源图片的位置与尺寸。 所有字段均通过JSON传入；不支持callback。成功提交返回原始任务id，使用GET /v1/tob/job/{jobId}轮询结果。

完整流程、参数组合与轮询示例见 [Midjourney 图片生成与编辑示例](/api-reference/examples/images/midjourney)。


## OpenAPI

````yaml api-reference/youchuan-openapi.json POST /v1/tob/edit
openapi: 3.1.0
info:
  title: TokenOPS 悠船 MJ 图片 API
  version: 1.0.0
  description: >-
    Midjourney 图片生成、任务查询与编辑接口。使用 Bearer 鉴权；直接生成请求指定
    model，二次编辑使用来源任务的模型；通过轮询获取结果。
servers:
  - url: https://model-api.skyengine.com.cn
    description: 平台API地址；模型须已开通。
security:
  - bearerAuth: []
tags:
  - name: 悠船 MJ 图片
paths:
  /v1/tob/edit:
    post:
      tags:
        - 悠船 MJ 图片
      summary: 画布编辑
      description: >-
        在目标画布中设置来源图片的位置与尺寸。 所有字段均通过JSON传入；不支持callback。成功提交返回原始任务id，使用GET
        /v1/tob/job/{jobId}轮询结果。
      operationId: youchuanEdit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YouchuanEditRequest'
            example:
              jobId: <source_job_id>
              imageNo: 0
              canvas:
                width: 1024
                height: 1024
              imgPos:
                width: 512
                height: 512
                x: 256
                'y': 256
              remixPrompt: A mug on a larger white table
      responses:
        '200':
          description: 任务已受理；也可能直接返回终态。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanJob'
              example:
                id: <job_id>
                status: 1
                urls: []
                comment: 执行中
        '400':
          description: 参数、来源任务或接口不符合要求。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanError'
              example:
                error:
                  code: 2004
                  message: unsupported field "callback"
        '401':
          description: 认证失败。
        '403':
          description: 无访问权限。
        '424':
          description: 下游调用不可用；拿到任务id后应继续查询原任务。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanError'
              example:
                error:
                  code: 2002
                  message: Youchuan submit failed
        '429':
          description: 请求或任务并发达到限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouchuanError'
              example:
                error:
                  code: 2007
                  message: too many active image jobs
        '500':
          description: 请求未成功完成；如已获得id，应查询原任务而不是重复提交。
components:
  schemas:
    YouchuanEditRequest:
      type: object
      additionalProperties: false
      required:
        - jobId
        - imageNo
        - canvas
        - imgPos
        - remixPrompt
      properties:
        jobId:
          type: string
          minLength: 1
          description: 来源任务 id；使用与提交来源任务相同的平台 API Key。
          example: <source_job_id>
        imageNo:
          type: integer
          minimum: 0
          maximum: 3
          description: 来源 urls 的图片下标，当前允许0～3。
          example: 0
        canvas:
          $ref: '#/components/schemas/YouchuanCanvas'
        imgPos:
          $ref: '#/components/schemas/YouchuanImagePosition'
        remixPrompt:
          type: string
          minLength: 1
          description: 新的提示词。
          example: A blue ceramic mug on a white table
        mask:
          $ref: '#/components/schemas/YouchuanMask'
    YouchuanJob:
      type: object
      required:
        - id
        - status
        - urls
        - comment
      properties:
        id:
          type: string
          description: 原始任务ID。后续编辑作为jobId，查询作为路径参数。
        text:
          type: string
        status:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          description: 0等待；1执行中；2成功；3失败。
        urls:
          type:
            - array
            - 'null'
          items:
            type: string
            format: uri
          description: 成功后的图片地址；等待中通常为空。
        comment:
          type: string
          description: 状态说明或任务失败原因。
        cost:
          type:
            - object
            - 'null'
          properties:
            jobId:
              type: string
            feeCost:
              type:
                - integer
                - 'null'
            fastCost:
              type: number
            relaxCost:
              type: number
            costAt:
              type: string
          description: 上游任务消耗信息；完成前可能变化，不等同于平台钱包流水或最终实付账单。
        audits:
          type: array
          items:
            type: string
        seed:
          type: integer
    YouchuanError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: integer
                  message:
                    type: string
            trace_id:
              type: string
    YouchuanCanvas:
      type: object
      required:
        - width
        - height
      properties:
        width:
          type: integer
          minimum: 1
        height:
          type: integer
          minimum: 1
      description: 目标画布尺寸。
    YouchuanImagePosition:
      type: object
      required:
        - width
        - height
        - x
        - 'y'
      properties:
        width:
          type: integer
          minimum: 1
        height:
          type: integer
          minimum: 1
        x:
          type: integer
        'y':
          type: integer
      description: 图片在目标画布中的尺寸与水平/垂直位移。
    YouchuanMask:
      type: object
      properties:
        areas:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/YouchuanMaskArea'
          description: 多边形坐标区域。
        url:
          type: string
          format: uri
          description: 上游可访问的蒙版图片地址。
      anyOf:
        - required:
            - areas
        - required:
            - url
      description: 使用坐标区域 areas 或蒙版 URL。
    YouchuanMaskArea:
      type: object
      required:
        - width
        - height
        - points
      properties:
        width:
          type: integer
          minimum: 1
          description: 坐标参考图的宽度。
        height:
          type: integer
          minimum: 1
          description: 坐标参考图的高度。
        points:
          type: array
          minItems: 6
          items:
            type: integer
          description: 交替排列的多边形坐标：[x1,y1,x2,y2,...]。
      example:
        width: 1024
        height: 1024
        points:
          - 300
          - 300
          - 300
          - 700
          - 700
          - 700
          - 700
          - 300
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 在 Authorization 请求头中传入 Bearer <API-KEY>。

````

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