# 查询异步任务用量

> 全部文档的索引见 [llms.txt](https://ark.volcengine.com/llms.txt)；在任一文档页面地址后追加 `.md` 可获取该页的 Markdown 版本。

`POST https://ark.cn-beijing.volcengineapi.com/?Action=GetInferenceTaskUsage&Version=2024-01-01`

根据 `TaskID` 查询当前账号下指定异步任务的用量。

## 鉴权

本接口支持鉴权方式如下，详情请参见 [Base URL 及鉴权](/docs/base-url-and-authentication)。

* Access Key 鉴权，请在 [Access Key 管理](https://console.volcengine.com/iam/keymanage) 页面，获取 Access Key。本接口仅支持 Access Key 鉴权。

---

<span id="request-parameters"></span>
## 请求参数

### Body 参数

**TaskID** `string` `必选` | 任务 ID

待查询的异步任务 ID，不能为空或全空白。

## 响应参数

**AccountantEndTime** `integer` | 账期结束时间

账期结束时间，Unix 时间戳，单位为秒，不包含该时间点。仅当 `BillingStatus` 严格等于 `normal` 时返回。

**AccountantStartTime** `integer` | 账期开始时间

账期开始时间，Unix 时间戳，单位为秒，包含该时间点。仅当 `BillingStatus` 严格等于 `normal` 时返回。

**AccountID** `integer` | 账号 ID

记录所属的账号 ID。有记录时返回。

**APIKeyID** `string` | API Key 标识

任务使用的 API Key 标识，不是 API Key 密钥内容。有记录时返回。

**BillingStatus** `string` | 计费状态

计费状态。有记录时返回。

**DeploymentType** `string` | 部署类型

部署类型。非空时返回。

**ErrorCode** `string` | 错误码

任务错误码。非空时返回。

**HasInputVideo** `boolean` | 是否包含输入视频

是否包含输入视频。有记录时返回，可能返回 `false`。

**ManagedAgentID** `string` | 托管 Agent ID

托管 Agent ID。非空时返回。

**ModelEndpoint** `string` | 推理接入点 ID

推理接入点 ID。有记录时返回。

**ModelName** `string` | 模型名称

模型名称。有记录时返回。

**ModelUnitID** `string` | 模型单元 ID

模型单元 ID。非空时返回。

**ModelVersion** `string` | 模型版本

模型版本。有记录时返回。

**OutputTokens** `integer` | 输出 Token 数

任务输出 Token 数。有记录时返回，可能返回 `0`。

**PlanChargedAFP** `string` | Plan 计费 AFP

Plan 计费值，以十进制字符串保留精度。属于 Plan、未透支且计费值存在时返回。

**PlanEdition** `string` | Plan 版本

Plan 版本。属于 Plan 且未透支时返回。

**PlanIsOverdraft** `boolean` | 是否透支

是否透支。当前仅在未透支的 Plan 记录中返回，值为 `false`。

**PlanLastestSubscribeMilestone** `string` | Plan 订阅里程碑

Plan 订阅里程碑。属于 Plan 且未透支时返回。

**PlanPack** `string` | Plan 套餐包标识

Plan 套餐包标识。属于 Plan 且未透支时返回。

**PlanScene** `string` | Plan 场景

Plan 场景。属于 Plan 且未透支时返回。

**PlanSeatID** `string` | Plan 席位 ID

Plan 席位 ID。属于 Plan 且未透支时返回。

**PlanSharedPackageID** `string` | 共享包 ID

共享包 ID。属于 Plan 且未透支时返回。

**PlanUsedSharedPackageQuota** `boolean` | 是否使用共享包额度

是否使用共享包额度。属于 Plan 且未透支时返回。

**Resolution** `string` | 输出分辨率

任务输出分辨率，例如 `480p`、`720p`。有记录时返回。

**SessionID** `string` | 会话 ID

会话 ID。非空时返回。

**TaskID** `string` | 任务 ID

异步任务 ID。有记录时返回。

**UserID** `integer` | 调用身份 ID

调用身份 ID。有记录时返回。


## 代码示例

## 默认

### cURL

#### Request

```bash
curl 'https://ark.cn-beijing.volcengineapi.com/?Action=GetInferenceTaskUsage&Version=2024-01-01' \
  -H 'Content-Type: application/json' \
  -H 'X-Date: <X-Date>' \
  -H 'X-Content-Sha256: <X-Content-Sha256>' \
  -H 'Authorization: HMAC-SHA256 Credential=<AK>/<X-Date>/cn-beijing/ark/request, SignedHeaders=content-type;host;x-content-sha256;x-date, Signature=<Signature>' \
  -d '{
    "TaskID": "cgt-example"
}
'
```

#### Response

```
{
    "ResponseMetadata": {
        "RequestId": "query-task-request-id-example",
        "Action": "GetInferenceTaskUsage",
        "Version": "2024-01-01",
        "Service": "ark",
        "Region": "cn-beijing"
    },
    "Result": {
        "AccountID": 1000000001,
        "UserID": 10001,
        "TaskID": "cgt-example",
        "APIKeyID": "apikey-example",
        "AccountantStartTime": 1788228120,
        "AccountantEndTime": 1788228150,
        "ModelName": "model-example",
        "ModelVersion": "version-example",
        "ModelEndpoint": "ep-example",
        "DeploymentType": "standard",
        "Resolution": "480p",
        "HasInputVideo": false,
        "BillingStatus": "normal",
        "OutputTokens": 50638
    }
}
```
