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

# 获取任务状态

> 查询任务状态和结果

<Info>
  所有异步端点（audios、upload、stems、download、download-video）都会返回一个 `taskId`。使用此端点轮询，直到任务达到终态（`completed`、`failed` 或 `timeout`）。
</Info>

## 任务状态值

| 状态           | 描述                       |
| ------------ | ------------------------ |
| `pending`    | 任务排队中                    |
| `ready`      | 任务准备就绪，等待处理              |
| `assigned`   | 任务已分配给工作节点               |
| `processing` | 任务处理中                    |
| `completed`  | 任务完成 — 查看 `result` 获取数据  |
| `failed`     | 任务失败 — 查看 `errorMessage` |
| `cancelled`  | 任务已取消                    |
| `timeout`    | 任务超时                     |

<Tip>
  建议使用 3-5 秒的轮询间隔。音乐生成通常需要 30-120 秒，具体取决于曲目时长。
</Tip>


## OpenAPI

````yaml GET /producer/tasks
openapi: 3.0.0
info:
  title: Producer - AI Music Generation
  description: >-
    Generate music with Google DeepMind's Lyria 3 Pro model. Supports
    text-to-music, lyrics-to-music, and image-guided generation with stem
    separation and multi-format export.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.mountsea.ai
    description: API Gateway
security: []
tags:
  - name: producer
    description: >-
      Music generation, audio upload, stem separation, and export endpoints
      powered by Lyria 3 Pro
paths:
  /producer/tasks:
    get:
      tags:
        - producer
      summary: 查询任务状态
      description: 根据 taskId 查询任务执行状态和结果，支持轮询
      operationId: ApiPublicController_getTaskResult
      parameters:
        - name: taskId
          required: true
          in: query
          description: 任务ID
          schema:
            type: string
      responses:
        '200':
          description: 任务状态
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskResultDto'
      security:
        - bearerAuth: []
components:
  schemas:
    TaskResultDto:
      type: object
      properties:
        taskId:
          type: string
          description: 任务 ID
        status:
          enum:
            - pending
            - ready
            - assigned
            - processing
            - completed
            - failed
            - cancelled
            - timeout
          type: string
          description: 任务状态
        result:
          type: object
          description: 任务结果（直接透传协议层返回，类型根据任务类型不同而变化）
          nullable: true
        errorMessage:
          type: string
          description: 错误信息
        errorCode:
          type: number
          description: 错误代码
        finishedAt:
          format: date-time
          type: string
          description: 完成时间
        createdAt:
          format: date-time
          type: string
          description: 创建时间
        traceId:
          type: string
          description: 追踪 ID
      required:
        - taskId
        - status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````