Accounting
Production-grade cost and performance tracking for every workflow step. Per-token pricing, multi-currency conversion, file and network I/O, step timing - all attached to every result automatically.
Every component execution in the engine produces a complete cost record - AI token spend broken down by input, output, thinking, and cache tokens; general I/O measured in bytes and files; all costs in your currency, calculated from daily exchange rates. No instrumentation required. It just works.
Two cost records, every time
Every component result carries two cost structures: a general cost record covering I/O, network usage, and timing, and an inference cost record covering AI token usage and spend. CostGeneral is populated for every component. CostInference is populated for every inference and inference:estimate call. Both are also available in the per-step metric record streamed by the tracer in real time.
Money: nano precision
All monetary values in the engine use a nano-precision money type based on the Google Money proto. This avoids floating-point rounding errors on the sub-cent amounts that make up most per-token costs.
| Field | Description |
|---|---|
currency_code | Three-letter ISO 4217 currency code (e.g. USD, EUR, GBP) |
units | Whole units of the currency. For USD: 1 unit = $1.00 |
nanos | Fractional units in billionths (10⁻⁹). Range: −999,999,999 to +999,999,999 |
rate | Exchange rate used for conversion. Base currency is always 1 |
Signs must be consistent: if units is positive, nanos must be positive or zero; if units is negative, nanos must be negative or zero.
For example, a per-token price of $0.0000015 is represented as units: 0, nanos: 1500 - nine decimal places of precision with no rounding loss. For a cost of €1.50, it would be units: 1, nanos: 500000000.
The rate field records the exchange rate at the moment the cost was calculated, so historical records remain accurate even as rates change over time.
General cost: I/O and timing
The general cost record measures the operational footprint of a step - how much data it read, wrote, deleted, and how long it took.
| Field | Description |
|---|---|
bytes_read | Bytes read from storage |
bytes_written | Bytes written to storage |
bytes_deleted | Bytes deleted from storage |
files_read | Number of files read |
files_written | Number of files written |
files_deleted | Number of files deleted |
network_bytes_read | Bytes received over the network |
network_bytes_written | Bytes sent over the network |
took_ms | Step execution time in milliseconds |
cost_provider | Cost in the provider's base currency (Money) |
cost_client | Cost converted to your configured currency (Money) |
Use these numbers to track storage growth, monitor network-heavy workflows, and attribute infrastructure costs back to specific steps or runs.
Inference cost: full token breakdown
The inference cost record gives you a complete picture of every model call - actual token usage split by phase, pre-call estimates, and cost in two currencies.
Token phases
| Phase | Tokens | Cost (provider) | Cost (client) | Timing |
|---|---|---|---|---|
| Estimate | estimate_input_tokens | estimate_input_cost_provider | estimate_input_cost_client | estimate_took_ms |
| Input | input_tokens | input_cost_provider | input_cost_client | input_took_ms |
| Output | output_tokens | output_cost_provider | output_cost_client | output_took_ms |
| Thinking | thinking_tokens | thinking_cost_provider | thinking_cost_client | thinking_took_ms |
Input, output, and thinking tokens are priced at different rates - the engine applies the correct per-token price for each phase automatically.
The estimate phase is populated by inference:estimate calls. When a full inference call follows, the actual input, output, and thinking phases are populated separately, so you can compare the estimate against reality.
Provider vs. client cost
Every cost appears twice:
cost_provider- cost in the model's base currency (typically USD). This is what the AI provider charges. Theratefield on this Money record is always1.cost_client- cost converted to your configured currency using that day's exchange rate. Theratefield records the exact exchange rate used, so you can audit or reconstruct any conversion later.
For example: 1,240 input tokens on Claude Opus at $1.50/MTok costs $0.00186. Converted to EUR at a rate of 0.919, cost_client is €0.00171 with rate: 919 (stored as a scaled integer).
Multi-currency support
The engine fetches exchange rates daily. Configure your currency once; every cost across every step is converted automatically.
- name: analyse
component: inference
vars:
provider: anthropic
model: claude-opus-4-20250514
currency: EUR
prompt: "{{ document }}"Or set a default currency at the engine level so you never have to specify it per-step.
Supported currencies include USD, EUR, GBP, JPY, AUD, CAD, CHF, and every other major ISO 4217 currency. The currency template modifier formats any Money value for display:
message: "This run cost {{ result.cost_client | currency 'EUR' }}"
# → "This run cost €0.014"Exchange rates are fetched once per day. The rate field on every Money record captures the exact rate used at calculation time - so historical cost records remain accurate and auditable even as rates change.
Step-level metrics
Every step emits a metric record that is available in real time via the tracer and in aggregate after the run completes. Each record identifies the step precisely:
| Field | Description |
|---|---|
id | Unique record ID |
step_id | Hierarchical position in the workflow tree (e.g. "1", "1.1", "2.iter.0.1") |
run_id | UUID for this specific step execution |
action | Action name from the workflow config |
component | Component identifier |
iteration | -1 for non-loop steps; 0, 1, 2… for loop iterations |
retries | Number of retries before the step succeeded or gave up |
took_ms | Total wall-clock time for this step |
cost_general | General cost record (I/O, network, timing) |
cost_inference | Inference cost record (tokens, spend) - present only for inference steps |
How is this guide?
AI Inference Templates
Define reusable, multi-message prompt files with variable declarations, system and user message blocks, and inline tool definitions. Reference them from any inference step with a single path.
Metrics
Aggregate reporting, dashboards, and observability for Awee Engine runs - coming soon.