Source: https://01router.com/zh/docs/models/flux-2-pro/cancel Base URL: https://01router.com/api/v1 # FLUX.2 Pro · 取消任务 POST /generations/:id/cancel 会请求供应商停止进行中的任务。供应商确认后,任务以 failed 结束(error 为 "Canceled by user"),积分全额退还。目前支持 fal(仅排队中的任务)和 Replicate;其他供应商或已结束的任务返回 409 not_cancelable。 `POST /api/v1/generations/{id}/cancel` 需要 Bearer API Key ## 输入参数 | Field | Type | Required | Description | Constraints | | --- | --- | --- | --- | --- | | id | string · path | yes | 创建任务返回的生成 ID。 | | ## 输出字段 | Field | Type | Required | Description | Constraints | | --- | --- | --- | --- | --- | | id | string | — | 创建任务返回的生成 ID。 | | | object | "generation" | — | generation | | | model | string | — | 模型目录中的 slug;项目密钥也可使用项目自定义的模型 slug。 | | | type | video \| image \| audio \| chat | — | | | | provider | string | — | 可选供应商 slug。不传时自动路由;项目配置可能固定供应商。 | | | status | string | — | queued(排队)/ processing(处理中)/ succeeded(成功)/ failed(失败)。成功或失败后停止轮询。 | | | input | object | — | 模型专属的输入对象。必填字段、默认值和限制见对应模型文档。 | | | outputs | string[] | — | 结果文件 URL 列表;结果未就绪时为空。链接可能过期,请及时下载。 | | | error | string \| null | — | 失败时的错误信息,否则为 null。 | | | credits | number | — | 该任务扣除的积分,退款后为 0。 | | | price_usd | number | — | 该任务的美元价格,退款后为 0。 | | | created_at | string | — | ISO 8601 格式的创建时间。 | | | completed_at | string \| null | — | ISO 8601 格式的完成时间,进行中为 null。 | | ## cURL ```bash curl -X POST 'https://01router.com/api/v1/generations/gen_example/cancel' \ -H "Authorization: Bearer $API_KEY" ``` ## 200 · application/json ```json { "id": "gen_example", "object": "generation", "model": "flux-2-pro", "type": "image", "provider": "fal", "status": "failed", "input": { "prompt": "A cinematic landscape at sunrise.", "aspect_ratio": "1:1", "resolution": "1K" }, "outputs": [], "error": "Canceled by user", "credits": 0, "price_usd": 0, "created_at": "2026-10-25T08:00:00.000Z", "completed_at": "2026-10-25T08:01:00.000Z" } ```