Request-level logs
Why request-level logs matter for AI API billing
Request-level logs turn API usage into a ledger. Instead of seeing only a monthly total, teams can inspect every completed deduction and connect it to a key, model, token count, and request id.
What a useful log row includes
A useful AI API log row should include request id, time, API key, model, input tokens, output tokens, cached tokens, unit prices, status, and final billed amount.
Why logs reduce support work
When a customer asks why balance changed, support can inspect the exact request rather than guessing from aggregate usage.
- Find expensive prompts or output-heavy requests
- Separate successful calls from upstream failures
- Export CSV data for finance reconciliation
Logs and privacy
For most teams, billing logs should focus on metadata and usage meters. Full prompt storage is not required for basic billing auditability.
FAQ
Are logs the same as analytics?
No. Analytics summarizes trends. Request-level logs are the source ledger behind those summaries.
What should happen to duplicate request ids?
A request id should be billable at most once to avoid retry amplification.