pylva validate and Data import APIs help teams find, approve, and price sources before they affect margin or billing.
To see which stacks are automatic, callback-based, or manual, see Supported Integrations.
What is a cost source?
A cost source is any provider, tool, or internal service that creates AI-agent cost. Examples include LLM models, search APIs, speech APIs, vector databases, browser runs, workflow runners, enrichment APIs, and paid internal tools.Coverage paths
| Cost type | Recommended path | Key |
|---|---|---|
| Supported LLM provider call | SDK instrumentation or framework callback | Agent SDK key |
| Non-LLM runtime usage | reportUsage or report_usage | Agent SDK key |
| Cost-source declaration from CLI/import jobs | Data import API | Data import key |
| Pricing and admin mutations | Dashboard or Admin API | Admin API key |
Discovery workflow
- Start with SDK telemetry for supported LLM provider calls.
- Inventory non-LLM services such as search, vector databases, speech, browser runs, workflow runners, enrichment APIs, and internal paid tools.
- Add
reportUsageorreport_usagewherever your app performs non-LLM work that creates cost. - Run
pylva validateto scan the repository for likely cost sources. - Use
pylva validate --approveto declare manual non-LLM sources through the guided CLI flow. - Use
pylva validate --cito fail CI when a new unapproved source appears. - Use
pylva validate --jsonwhen an agent or CI job needs machine-readable output. - Review unknown pricing before relying on margin reports, draft invoices, or customer billing.
- Monitor source health and alert delivery for silent, missing, or broken instrumentation.
Data import
The Data import API is for trusted CLI or backend jobs that declare cost sources throughPOST /api/v1/cost-sources.
It is not a historical event upload endpoint and it is not a full customer database import API. Use SDK telemetry for runtime events, and use Data import when you need to approve or declare the source and pricing metadata behind those events.
See Data import: Cost sources for the current endpoint.
Unknown pricing
Pylva can accept usage before pricing is configured. That keeps telemetry flowing, but it also means margin and billing are incomplete until the pricing gap is resolved. Review unknown pricing before:- Treating margin reports as final.
- Generating or finalizing customer invoices.
- Activating controls that depend on accurate spend.
Avoid double counting
Choose one reporting path per source.- Do not manually report the same model call that SDK instrumentation already captures.
- Do not send the same non-LLM usage through both
reportUsageand a custom event path. - Keep metric names and units stable after pricing them.
- Use opaque
customer_idvalues and stablestepnames so cost coverage maps to customer and workflow reports.