Skip to main content
PDD calculates the estimated cost of every LLM call and can write a detailed CSV log for auditing and budgeting.

Enabling cost tracking

Pass --output-cost with any command to write a CSV file of usage details:
pdd --output-cost costs/run.csv sync factorial_calculator
pdd --output-cost costs/run.csv change https://github.com/myorg/myrepo/issues/123
Or set the path once with an environment variable:
export PDD_OUTPUT_COST_PATH=costs/pdd_usage.csv
When PDD_OUTPUT_COST_PATH is set, all commands write to that path by default. The --output-cost flag overrides it for individual runs.

CSV output format

Each row in the CSV corresponds to one command execution:
ColumnDescription
timestampDate and time of the command execution
modelLiteLLM model identifier used for the operation
commandPDD command that was executed (e.g., generate, fix)
costEstimated cost in USD (e.g., 0.05 for 5 cents). Zero for local models or operations with no LLM call.
input_filesComma-separated list of input files involved
output_filesComma-separated list of files generated or modified
Example rows:
timestamp,model,command,cost,input_files,output_files
2026-03-30T14:22:01,anthropic/claude-3-5-sonnet,generate,0.031,prompts/calculator_python.prompt,src/calculator.py
2026-03-30T14:22:45,anthropic/claude-3-5-sonnet,test,0.018,prompts/calculator_python.prompt;src/calculator.py,tests/test_calculator.py
2026-03-30T14:23:10,anthropic/claude-3-5-sonnet,fix,0.044,prompts/calculator_python.prompt;src/calculator.py;tests/test_calculator.py,src/calculator.py

Cost calculation factors

PDD calculates costs using LiteLLM’s provider pricing tables, updated regularly. Three factors drive cost:
  1. Model strength (--strength) — Higher strength selects more capable (and more expensive) models by ELO rating
  2. Input size — Longer prompts, larger code files, and more dependencies increase token usage
  3. Operation complexity — Commands with iterative loops (fix, sync, crash) may invoke the LLM multiple times per run

Controlling cost with --strength

--strength is a 0.0–1.0 dial that selects the model tier for any command:
ValueModel tier
0.0Cheapest available model
0.5Default base model (balanced cost and quality)
1.0Most powerful model (highest ELO, highest cost)
# Fast, cheap iteration pass
pdd --strength 0.0 --force sync my_module

# Full-power generation for a critical module
pdd --strength 1.0 --force sync payments_service
Set a project-wide default in .pddrc:
contexts:
  default:
    defaults:
      strength: 0.818
Or via environment variable:
export PDD_STRENGTH_DEFAULT=0.5

Budget limits

Commands that run iterative loops accept a --budget flag to cap total spend:
# Cap the entire sync at $10
pdd --force sync --budget 10.0 data_processor

# Cap a fix run at $5
pdd fix --budget 5.0 https://github.com/myorg/myrepo/issues/42

# Cap a crash loop at $3
pdd crash --loop --budget 3.0 prompts/calc_python.prompt src/calc.py examples/run_calc.py errors.log
When the budget is exhausted, PDD stops the loop and reports how far it got. The default budgets are:
CommandDefault budget
sync$20.00
fix (loop)$5.00
crash (loop)$5.00
verify$5.00
change (manual)$5.00
You can also set a default budget in .pddrc per context:
contexts:
  backend:
    defaults:
      budget: 15.0

Core dump for debugging

If a command produces unexpected results, capture a debug bundle that can be replayed and reported:
pdd --core-dump sync factorial_calculator
pdd --core-dump crash prompts/calc_python.prompt src/calc.py examples/run_calc.py crash_errors.log
When --core-dump is set, PDD:
  • Records the full CLI command and arguments
  • Captures relevant logs and internal trace information
  • Bundles prompts, generated code, and metadata needed to replay the issue
At the end of the run, PDD prints the path to the bundle (e.g., .pdd/core_dumps/pdd-core-....json).

Reporting a bug with report-core

Attach the bundle to a GitHub issue automatically:
# Use the most recent core dump
pdd report-core

# Specify a specific bundle
pdd report-core .pdd/core_dumps/pdd-core-20260330.json

# Create the issue via GitHub API (attaches files as a private Gist)
pdd report-core --api --description "sync fails on factorial_calculator"

# Target a different repository
pdd report-core --api --repo myorg/myrepo
When using --api, PDD collects all relevant files, creates a private GitHub Gist, and links it in the issue body. Authentication uses the GitHub CLI (gh auth token), GITHUB_TOKEN, or GH_TOKEN in that order.

Build docs developers (and LLMs) love