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

# 取消任务

> 取消尚未完成的异步任务。

停止仍处于 `pending` 或 `processing` 的任务。已经进入终态的任务无法取消。

<Info>
  通过 [`POST /v2/videos`](/zh/api-reference/video/create) 创建的视频，用
  `DELETE /v2/videos/{id}` 取消。
</Info>

<ParamField path="task_id" type="string" required>
  任务创建时返回的任务 ID。
</ParamField>

<RequestExample>
  ```bash cURL theme={"dark"}
  curl -X POST https://api.pipellm.ai/v1/tasks/gen-1732891234-abc123xyz/cancel \
    -H "Authorization: Bearer $PIPELLM_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={"dark"}
  {
    "id": "gen-1732891234-abc123xyz",
    "status": "cancelled",
    "type": "video_generation",
    "model": "seedance-2-0-mini",
    "created_at": "2026-09-17T08:14:02Z"
  }
  ```
</ResponseExample>

响应就是 [`GET /v1/tasks/{task_id}`](/zh/api-reference/tasks/get) 返回的同一个任务对象，
`status` 变为 `cancelled`。

## 计费

取消不退还上游已经完成的那部分算力。视频的报价在任务创建时就锁定了，见
[查询模型定价](/zh/api-reference/model-pricing)。

## 错误

错误信封与 [错误与排查](/zh/api-reference/errors) 一致。

<AccordionGroup>
  <Accordion title="404 not_found">
    任务 ID 不存在，或属于其他账户。
  </Accordion>

  <Accordion title="409 invalid_request_error">
    任务已进入 `completed`、`failed` 或 `cancelled`。
  </Accordion>
</AccordionGroup>


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