Implementation Guide

How to Reconcile LLM Logs with Model Provider Logs

Assign every outbound model call a unique internal correlation ID at the gateway, record each attempt separately along with any provider request identifier returned, and match internal records to provider usage records by identifier first. Use a fallback of time window, model, credential, and token counts within defined tolerances. Classify every unmatched or divergent record into a fixed discrepancy category, and retain the results as audit evidence.

Treat reconciliation as an audit-integrity problem

Reconciliation produces defensible evidence only when every outbound model call can be traced from the internal gateway record to the provider usage record. That traceability starts at the gateway, where each call receives a unique internal correlation ID and each attempt is recorded separately.

The sections below cover the fields to capture, the matching logic, the discrepancy categories to define up front, and how results are retained as audit evidence.

Reconciliation flow

The process moves through five stages, from capture at the gateway to retention of the results.

StageDescription
1. CaptureGateway writes one record per attempt with a correlation ID.
2. IngestProvider usage and billing records are loaded on a schedule.
3. MatchIdentifier match first, then tolerance-based fallback.
4. ClassifyEach discrepancy receives a defined category and owner.
5. RetainResults are stored as evidence with a defined retention period.

Minimum fields for every internal record

Each internal record should carry enough information to support both identifier-based matching and the tolerance-based fallback.

  • A unique internal correlation ID, assigned at the gateway to every outbound model call.
  • A separate record for each attempt, rather than one record per logical request.
  • Any provider request identifier returned for the attempt.
  • The time of the call, to support time-window matching.
  • The model and the credential used.
  • Token counts, for comparison within defined tolerances.

Matching logic and tolerance thresholds

Matching runs in two passes, in a fixed order.

  1. Identifier match. Match internal records to provider usage records by the provider request identifier first.
  2. Tolerance-based fallback. For records without an identifier match, compare time window, model, credential, and token counts within defined tolerances.

Define the tolerances before the first run so that results are consistent and can be defended later.

Discrepancy categories to define up front

Every unmatched or divergent record is classified into a fixed discrepancy category, and each discrepancy receives a defined category and owner. Agreeing on the category list before reconciliation begins keeps classification consistent from one run to the next.

Investigation, evidence, and retention

Provider usage and billing records are loaded on a schedule, matched, and classified, and each discrepancy is routed to its owner for investigation. The results are retained as audit evidence and stored with a defined retention period.

Where a runtime governance layer fits

Reconciliation depends on the quality of the internal record. A runtime governance layer helps generate consistent, auditable records for LLM calls and tool use, so that the gateway side of the comparison is complete before provider records are matched against it.

Review your internal LLM record before you reconcile it

Talk to an expert about generating consistent, auditable records for LLM calls and tool use through runtime governance.

Talk to an Expert