↖ Agent Delivery LabOpen batch checker →
A worked example · Updated 19 September 2026

What does a usable
API result actually cost?

Divide the cost of all recorded attempts, including failures and retries, by the number of outputs that meet your declared rules. Keep each provider and currency separate. When no output passes, the cost per accepted output is undefined, not zero.

A low per-call price can hide repeated unusable responses. Agent Delivery Lab checks a batch of captured results against the same contract and shows the entered cost beside acceptance. It is a local calculation over your records, not a benchmark of live providers.

Try the fictional example →

A cheaper call can cost more per usable output

The example below is fictional. Both providers attempt two invoice tasks. One of Example A's responses has the wrong currency; its retry times out. Example B returns two responses that meet the rules.

Fictional providerAttemptsAccepted outputsEntered costCost / accepted output
Example A31USD 0.03USD 0.03
Example B22USD 0.04USD 0.02

This arithmetic does not establish which provider is better. Real comparisons need the same tasks, input difficulty, contract, time window and cost scope. Even equal task labels do not prove equal inputs. A returned result can meet every rule and still be factually wrong.

Prepare the attempt records

Use a JSON array with one object per attempt. Every retry gets its own unique id; attempts for the same task share task. Record all relevant attempts, not only the ones that succeeded. For timeouts or request errors, provide error instead of response.

[
  {
    "id": "run-001",
    "provider": "My API",
    "task": "invoice-01",
    "cost": "0.01",
    "currency": "USD",
    "response": {"invoice": {"id": "INV-001", "currency": "USD", "total": 125.5}}
  },
  {
    "id": "run-002",
    "provider": "My API",
    "task": "invoice-02",
    "cost": "0.01",
    "currency": "USD",
    "error": "Request timed out"
  }
]

Download example attempts ↓ · Download example contract ↓

Define acceptance before comparing providers

The guided rule editor can add required paths, types, exact values and number bounds. For invoice extraction, require an ID string, the expected currency and a total within the task's known bounds. A rule like “total is nonnegative” only checks plausibility; it cannot show the extracted total matches the source invoice.

All attempts in a batch use the same contract. Split batches when different tasks need different contracts. Empty contracts and unsupported conditions are rejected. You can export the contract for future runs.

How the cost calculation works

Repeat the check in your own CI

Download runner.mjs and engine.mjs to the same folder. Keep a sanitized batch and acceptance contract in your own project. Use Node.js 22 or later.

node runner.mjs batch attempts.json contract.json > report.json

Exit 0 means every recorded response met the contract. Exit 1 means one or more attempts failed, even when other attempts passed. Exit 2 means the input or contract was invalid. Use the same runner for individual responses and payment snapshots; see the full guide.

Limits and privacy

The beta accepts 1–100 attempts per batch, up to 128 KiB of decoded JSON and 50 acceptance rules. Inputs, file imports and calculations stay in this tab. Switching tools retains inputs in memory; reloading clears them. Nothing is sent unless you explicitly submit anonymous feedback, which does not include inputs or reports.

Exported reports may contain your attempt IDs, task labels, provider labels, cost figures and error messages. Review them before sharing. Do not paste secrets into error messages. This is a deterministic diagnostic tool, not a security audit, provider reputation score, novel consensus algorithm or guarantee of financial value.

中文说明:关注合格结果成本

批量工具把所有已录入的调用成本(包括失败和重试)除以通过声明规则的输出数量。没有合格输出时显示“无法计算”,不显示零成本。相同任务多次成功会分别统计“合格输出数”和“合格任务数”;币种不混算。

最多可检查 100 次调用。导入 JSON 文件后,在右侧用规则编辑器增加字段、类型、期望值或数值范围,点击 “Check batch & cost”。可导出报告与规则,配合本地脚本复用。所有示例都是虚构数据,页面不会给服务商排榜,也不会执行支付。持续监控仍是未上线的收费假设。

Check a batch →