Import an agent trace with task outcomes to get cost per successful task, retry tax, fallback overhead, and failed-work cost at current prices, locally.
Quick answer
This report calculates current-price agent trace cost and returns total cost, cost per successful task, retry tax, fallback overhead, and failed-work cost. Import Agent Cost Evidence JSON v0.1, or strict OpenInference / OTLP JSON plus task outcomes; processing stays in your browser with no upload, and the result is a current verified Standard-price replay, not a historical invoice.
How it is calculated:CPS = total model cost (including failed and fallback calls) ÷ successful tasks
Import Agent Trace
Replay task outcomes and model usage with current verified Standard pricing. Your trace stays in your browser: this import has no upload request. Prompt and completion text are not required. Remove sensitive metadata before importing.
This is a replay estimate, not a historical invoice. Task success is the outcome supplied by you or your benchmark; AICostBudget does not judge task quality.
Schema family: v0 · Current profile version: 0.1 · JSON only · Processed locally
Agent Cost Evidence v0.1 format reference
The Apache License 2.0 applies only to the AICostBudget Agent Cost Evidence public specification assets explicitly identified under /schemas/. It does not license the rest of the AICostBudget website, application source code, pricing engine, datasets, or other content. Covered assets are explicitly enumerated in the public asset license scope declaration: the schema, synthetic example, sanitized OpenInference OTLP fixture and its sidecar. Future assets require an explicit public-specification declaration.
Schema family: v0. Current profile version: 0.1 (trace_version). The stable machine reference is https://aicostbudget.com/schemas/agent-cost-evidence-v0.json. This URL pins profile 0.1; breaking profile changes require a new schema URL. The linked schema and synthetic example are public specification assets licensed under Apache-2.0. License annotations describe reuse terms and do not change validation.
Structure: trace → tasks → attempts → model_calls. Required fields: trace_version = "0.1", trace_id; tasks need task_id, boolean success and nonempty attempts; attempts need attempt_id, positive integer attempt_number and nonempty model_calls; calls need span_id, provider, model, input_tokens and output_tokens.
Observed facts are imported usage, identifiers, explicit fallback flags, external USD charges and supplied task outcomes. USD repricing, CPS and attribution are derived. Success is your acceptance result, not HTTP status; optional acceptance_rule and outcome_label describe it.
Optional call fields: timestamp, cached_input_tokens, cache_write_tokens, boolean is_fallback, external_cost_usd and non_token_components (each needs nonnegative quantity, unit and price_component). Input includes cache reads and writes as disjoint subsets. Normalize vendor-exclusive input before importing.
Validate with a Draft-07 JSON Schema validator such as Ajv, enabling full date-time format validation. Unknown properties at every level are rejected; prompts/completions are not included. Tokens and attempt numbers must be safe integers (at most 9007199254740991). Identifiers cannot be blank. Timestamps use a valid calendar date, uppercase T/Z, full seconds and either Z or a colon-separated timezone offset; leap seconds are unsupported.
Runtime additionally requires unique task IDs, unique attempt IDs/numbers within each task, globally unique span IDs, attempt numbers consecutive from 1, and combined cached tokens no greater than total input. These cross-record rules are not expressible in this Draft-07 schema. Models must match the website catalog or its existing canonical IDs; provider matching ignores capitalization.
Total includes all calls, including failed work. CPS = total ÷ successful tasks; zero successes means unavailable. Retry tax covers calls in attempts numbered after 1; ordinary calls within one attempt are not retries. Fallback overhead is gross spend on flagged calls. Failed-work cost covers finally failed tasks. These metrics may overlap and should not be summed as total waste. Independent benchmark trials are separate task instances.
Replay uses current verified Standard text input/output pricing and supported cache reads. Reports provide PriceRecord ID, official source, verification date and snapshot evidence. REPRICED USING CURRENT PRICES: estimate, not historical invoice reconstruction. Timestamps do not select past prices.
Unmatched models, positive cache writes and unsupported non-token components show explicit unpriced states; all complete totals become unavailable. Missing quantities and unknown pricing-mode fields fail validation. Nothing unsupported is silently priced at $0. External USD amounts are user supplied, not verified billing facts.
This profile is informed by GenAI tracing concepts. The default import accepts normalized profile JSON. The local OpenInference / OTLP JSON adapter v0 accepts only its pinned, strict input contract with explicit outcome/attempt mapping; Phoenix exports, Langfuse exports and other formats are not accepted. The downloadable example is synthetic, not benchmark evidence. Remove sensitive identifiers before importing; processing stays local with no trace upload.
Not available yet: save a trace replay and re-run it when verified prices change, or compare two model routes on the same trace. Today this page prices one imported agent trace locally.
Trace replays are currently in preview. Saved replays and route comparisons may require a paid plan when available.
A provider invoice tells you what you spent, not what each finished task cost. When an agent retries, falls back to another model, or abandons a task, those calls are still billed. Cost per successful task puts that waste back into the unit cost, so you can compare routes on the work that actually got done.
What the replay measures, and what it doesn't
The replay prices every model call in one imported trace at current verified Standard prices and returns total cost, cost per successful task, retry tax, fallback overhead, and failed-work cost.
It is not a historical invoice, a team spend dashboard, or a spending-limit tool. For organization-level usage reporting and spend controls, use your provider's console or a dedicated governance tool.
Run a replay before you switch models, after you change retry or fallback rules, and when verified prices change. Use the retry and fallback cost guide to interpret extra attempts, then compare routes by cost per successful task.
Frequently asked questions
How do I calculate cost per successful task for an AI agent?
Import a supported trace with task outcomes. The report replays every model call at current verified Standard prices, includes failed and fallback calls in total cost, and divides that total by successful tasks. If there are no successful tasks, cost per successful task is unavailable.
Can I import OpenTelemetry / OpenInference traces to estimate agent cost?
Yes. Use one complete OpenInference / OTLP JSON trace plus the required task-outcomes file. The strict local adapter needs explicit task, attempt, fallback, and success mappings; generic Phoenix dataframe exports and other formats are not accepted.
Is my trace uploaded?
No. The trace is processed locally in your browser with no upload request. Prompt and completion text are not required, and you should remove sensitive metadata before importing.
Is this a historical invoice?
No. It is a replay estimate using current verified Standard text input and output pricing, not a historical invoice reconstruction. Trace timestamps do not select past prices.
What is retry tax?
Retry tax is the cost of model calls in attempts numbered after the first attempt. Ordinary calls within a single attempt are not retries, and retry tax can overlap with fallback overhead or failed-work cost, so those categories should not be added together.
Related guide
Related guide: How to Reduce LLM Token Costs
Learn practical ways to lower AI API spend with prompt trimming, model routing, caching, batch processing, retry control, and monthly budget planning.