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

# 删除或取消任务 · Ark

> 取消尚未开始执行的任务，或从列表移除已结束的任务。

`DELETE /v1/contents/generations/tasks/{task_id}` 成功时返回 204。尚未开始执行的任务会取消并退还预扣额度；已结束的任务从列表中移除。

取消仅适用于尚未开始执行的任务。执行中的任务无法取消；删除返回 `task_not_deletable` 时，继续查询原任务，不要把删除失败当成取消成功。


## OpenAPI

````yaml openapi/relay.json DELETE /v1/contents/generations/tasks/{task_id}
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub 公开 API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: 获取模型列表
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: 图片生成
  - name: OpenAI 图像
  - name: 视频生成
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: 文本补全
  - name: OpenAI 音频
  - name: Realtime API
paths:
  /v1/contents/generations/tasks/{task_id}:
    delete:
      tags:
        - 视频生成
      summary: 删除视频任务
      description: |
        删除任务。排队中的任务会被取消并退还预扣额度；已结束的任务从列表中移除。
      operationId: deleteSeedanceVideoTask
      parameters:
        - name: task_id
          in: path
          required: true
          example: task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ
          schema:
            type: string
          description: 创建任务时返回的 `id`
      responses:
        '204':
          description: 已删除，无响应体
          headers: {}
        '400':
          description: 任务正在运行，或已被删除。`code` 为 `task_not_deletable`。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
          headers: {}
        '404':
          description: 任务不存在。`code` 为 `task_not_exist`。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    SeedanceTaskError:
      type: object
      description: 视频任务接口的错误响应。
      properties:
        code:
          type: string
          description: 错误码
          example: invalid_duration
        message:
          type: string
          description: 错误信息
          example: duration must be between 4 and 30 seconds for this model
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````

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