Skip to main content
The --metrics flag displays token usage and cost information after agent execution.

Quick Start

Metrics Shows Token Usage

Usage

Basic Metrics

Expected Output:

Combine with Other Features

Metrics Displayed

Use Cases

Cost Monitoring

Track costs across different prompts:

Model Comparison

Compare token usage across models:

Planning Mode Metrics

See total tokens across all planning steps:
Expected Output:

Cost Estimation

Cost estimates are approximate and based on publicly available pricing. Actual costs may vary based on your API plan.

Typical Costs by Model

Best Practices

Use --metrics during development to optimize prompts and reduce costs before production deployment.

Optimize Prompts

Monitor token counts to identify verbose prompts that can be shortened

Choose Right Model

Use metrics to compare cost/quality tradeoffs between models

Budget Tracking

Track cumulative costs across multiple runs for budget planning

Debug Issues

High token counts may indicate prompt issues or infinite loops
For cross-session aggregate reporting — rolling up token and cost totals by day, model, or project — see Usage.