Report tokens and cost
Report tokens per step with the model that produced them, so AMC prices each run correctly for ROI and budgets.
AMC reads GET /runs/{id}/tokens and GET /runs/{id}/status on every poll, so report running totals while the run is live: department budget spend counts in-flight runs.
{
"orchestratorRunId": "run_5f2c0e8a41b94c55",
"agentTokens": 4810,
"hostTokens": 0,
"totalTokens": 4810,
"inputTokens": 4200,
"outputTokens": 610,
"costUsd": 0
}| Field | Meaning |
|---|---|
agentTokens | Tokens your agent's steps used. |
hostTokens | Tokens a separate host-side model call used, if you have one. Otherwise 0. |
totalTokens | agentTokens + hostTokens. |
inputTokens, outputTokens | The run's prompt and completion split. |
costUsd | The run's cost in US dollars if you price it yourself, else 0. |
Per-step fields
| Step field | Meaning |
|---|---|
inputTokens | Prompt tokens, including cached ones. |
cachedInputTokens | The cached part of inputTokens, priced at the cheaper cached rate. |
outputTokens | Completion tokens. |
model | The model id that produced the step. AMC looks it up in its rate table, ignoring case. |
modelUsage | When one step used several models: [{ "model", "inputTokens", "outputTokens", "cachedInputTokens" }]. |
How AMC prices a run
- If
/tokensreportscostUsdgreater than zero, that is the run's cost. - Otherwise AMC prices each step: by
modelUsagewhen present (each model at its own rate, summed), else bymodeland the step's tokens. A missing or unknown model uses AMC's default rate. - If that comes to zero (no split reported), ROI estimates cost from
totalTokensat a flat per-token rate.
uncached = inputTokens - cachedInputTokens
cost = uncached / 1,000,000 x input rate
+ cachedInputTokens / 1,000,000 x cached input rate
+ outputTokens / 1,000,000 x output rateReport costUsd when your provider gives you an exact figure (for example, the Claude Agent SDK's total cost). It wins over any recompute. Keep reporting tokens and model anyway: they drive the per-step and per-model breakdown people see.
Failed and cancelled runs
Spend before a failure is real. Keep the tokens on the step that failed and in /tokens, or the failed run prices at zero. On cancel, AMC reads /tokens one last time, so report what the run spent up to the cancel.
{
"stepId": "research",
"name": "Research",
"status": "completed",
"tokenCount": 51200,
"inputTokens": 48000,
"outputTokens": 3200,
"cachedInputTokens": 30000,
"model": "<orchestrator-model-id>",
"modelUsage": [
{ "model": "<orchestrator-model-id>", "inputTokens": 40000, "outputTokens": 2500, "cachedInputTokens": 28000 },
{ "model": "<subagent-model-id>", "inputTokens": 8000, "outputTokens": 700, "cachedInputTokens": 2000 }
]
}Related
Last updated 2026-10-21