Scan Your Codebase
Find untracked cost points in your agent code in 30 seconds.
What it does
dexcost scan analyzes your source code and identifies every API call, LLM invocation, and service integration that generates costs. It tells you which ones are auto-instrumented by dexcost and which ones need manual record_cost() calls.
No API key needed. Runs entirely offline.
Today the scanner ships with the Python SDK. TypeScript, Go, and Rust scanners are on the roadmap — follow the SDKs section for status.
Run the scan
pip install dexcost
dexcost scan .Example output
Scanned 47 file(s)
AUTO-INSTRUMENTED
[auto] src/agents/support.py:23 OpenAI chat completion
[auto] src/agents/report.py:45 Anthropic message
NEED record_cost()
[manual] src/agents/support.py:31 HTTP POST (requests) (requests)
[manual] src/agents/support.py:42 Pinecone query (pinecone)
[manual] src/services/email.py:15 SendGrid email (sendgrid)
[manual] src/services/maps.py:8 Google Maps geocode (googlemaps)
SUMMARY
2 auto-instrumented
4 need record_cost()Understanding results
| Tag | Meaning | Action |
|---|---|---|
[auto] | dexcost auto-instruments this call. Costs are captured without any code changes. | Install the SDK and enable auto-instrumentation. |
[manual] | This is a paid API call that dexcost does not auto-instrument. | Add record_cost() or use the rate registry to track the cost. |
Generate fix stubs
Use --generate-stubs to get ready-to-paste code:
dexcost scan . --generate-stubsGENERATED STUBS:
# src/agents/support.py:31 -- HTTP POST (requests)
dexcost.record_cost(service="requests", operation="HTTP POST (requests)", cost=0.00) # TODO: set actual cost
# src/agents/support.py:42 -- Pinecone query
dexcost.record_cost(service="pinecone", operation="Pinecone query", cost=0.00) # TODO: set actual costNext steps
- Quickstart -- install the SDK and start tracking
- Python SDK -- use
record_cost()and auto-instrumentation to track all costs