{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-genai-usage-input-tokens-disagrees-with-the-provider-s-billed-prompt-token-c",
  "title": "In what scenarios must an instance reject OpenTelemetry GenAI spans whose `genai.usage.input_tokens` disagrees with the provider's billed prompt-token count, and how does the accounting divergence compound across agent tool-call chains",
  "date_of_record": "2026 December 2",
  "scope": "Applies to any agent runtime that emits OpenTelemetry GenAI semantic-convention spans (attributes `genai.operation.name`, `genai.usage.input_tokens`, `genai.usage.output_tokens`, `genai.response.finish_reasons`, and tool-call child spans) and reconciles them against a provider billing or usage endpoint. Does not apply to runtimes that treat GenAI spans as purely observational and never bind them to cost, quota, or context-budget decisions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-genai-usage-input-tokens-disagrees-with-the-provider-s-billed-prompt-token-c.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-genai-usage-input-tokens-disagrees-with-the-provider-s-billed-prompt-token-c.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-spans-whose-genai-usage-input-tokens-disagrees-with-the-provider-s-billed-prompt-token-c.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2030,
    "python_slice_tokens": 295,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define `genai.usage.input_tokens` and `genai.usage.output_tokens` as *reported usage* — the number the model provider returned in its response payload. They do not define these as *billed tokens*, and they do not define a reconciliation rule when the two diverge. This is the boundary that breaks agent runtimes: a span attribute...",
    "what_was_observed": "A three-tool agent loop (search → fetch → summarize) executed against a provider that returns `usage.prompt_tokens` per call. The span tree emitted: - root span `genai.operation.name=chat`, call 1: `genai.usage.input_tokens=1840` - child tool span `execute_tool search`, then call 2: `genai.usage.input_tokens=2610` - child tool span `execute_tool fetch`, then call 3: `genai.usage.input_tokens=4120` - child tool span `...",
    "condition_of_validity": "The invariant that must hold for a span-derived token total to be reconcilable against a billing ledger is: > For every call i in a trace, `genai.usage.input_tokens[i]` must be computed under the same accounting regime R, and the consumer must know R. R has at minimum three axes that the semantic conventions do not pin: (a) whether cached prefix tokens are i...",
    "decision_boundary": "An instance must reject (raise, not clamp) a GenAI span from a cost or quota accounting pipeline when any of the following hold, and must accept it into the observability pipeline regardless: 1. **Regime discontinuity.** Two spans in the same trace carry `input_tokens` values that cannot be explained by a monotonic prefix growth model — i.e., `input_tokens[i...",
    "operational_effect": "The practical consequence is that token accounting cannot be a pure function of the span tree. It requires a trace-level reducer that (a) reads a regime marker, (b) selects `sum` or `max` by declared budget semantics, and (c) emits a first-class `accounting_divergence` event when the reducer's output disagrees with the provider aggregate beyond tolerance, ca..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "44a4a6312e64678c5ab13c92ca0ca42d2b7a7a26a4d456376b5f04937b87f789",
    "verified_classes": [
      "AccountingRegime",
      "TokenAccountingError",
      "GenAISpan"
    ],
    "verified_functions": [
      "reduce_trace_tokens"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "TokenAccountingError"
    ],
    "sample_fail_closed_invariants": [
      "empty trace: nothing to reduce"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
