Skip to main content

估算 Smart Batch 费用

为 SmartBatch 上剩余的所有非终态行计算运行前积分费用估算。响应会按该批次关联的 BatchConfiguration 中每个已启用步骤拆解定价,并将预计费用与你客户账户的可用积分余额进行对比。

调用此接口不会执行目录查询,也不会消耗任何积分。

接口​

GET https://api.verifik.co/v2/smart-batches/{id}/estimate

此接口也可通过 Smart-Agent 代理 https://ai.verifik.co/v2/smart-batches/{id}/estimate 访问,需使用你自己的客户专属 Authorization: Bearer <VERIFIK_JWT>。共享 x402 执行会被拒绝并返回 403 Forbidden。

请求头​

名称值描述
Content-Typeapplication/json请求载荷格式。
AuthorizationBearer <VERIFIK_JWT>客户作用域的 JWT(authUser.clientId)。

参数​

名称类型必填描述
idstring是要估算费用的 SmartBatch ObjectId。

请求示例​

import axios from "axios";

const run = async () => {
const batchId = "6801a2b3c4d5e6f7a8b9c0d3";

const { data } = await axios.get(`https://api.verifik.co/v2/smart-batches/${batchId}/estimate`, {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
});

console.log(data);
};

run();

响应示例​

{
"data": {
"itemCount": 25,
"creditsPerItem": 0.12,
"totalCredits": 3,
"breakdown": [
{
"sequence": 1,
"featureCode": "co-cedula",
"price": 0.04,
"total": 1
},
{
"sequence": 2,
"featureCode": "co-procuraduria",
"price": 0.08,
"total": 2
}
],
"pendingRows": 25,
"totalRows": 25,
"availableCredits": 10.5,
"sufficientCredits": true,
"shortfall": 0
}
}

注意事项​

  • itemCount 和 pendingRows 仅统计尚未进入终态(completed、failed 或 partial)的行。
  • availableCredits 合并计算了你客户账户的 credits 与 extraCredits;当 sufficientCredits 为 false 时,shortfall 会指出还缺少的积分数额。
  • 单步定价在适用情况下会使用你客户账户的 ClientFeature 快照定价。

相关文档​