Developer reference · Adapter v0 · Agent Cost Evidence v0.1

OpenInference OTLP → Agent Cost Evidence Adapter v0

A bounded integration contract for observability engineers reviewing how traced model calls become task-level cost evidence. Verification snapshot: October 5, 2026.

Open Team API Cost Report to import the two reference files and replay them locally.

Scope and verified path

OpenInference provides semantic conventions and instrumentation. Phoenix is an observability platform. This adapter accepts OTLP JSON carrying OpenInference attributes; its contract does not define a universal OpenInference JSON export.

Verified path: non-streaming OpenAI Chat Completions → OpenInference instrumentation → OpenTelemetry SDK → OTLP/HTTP JSON → explicit AICostBudget sidecar → adapter → Agent Cost Evidence v0.1 → Draft-07 → runtime parser → current-price replay.

The model endpoint was a local OpenAI-compatible mock. The instrumentation, SDK serialization and exporter HTTP request were real. No paid model API or real API key was used.

Tested against

ComponentPinned baseline
OpenInference commit19363a0a6d978b8200ed5f73a00609f3f6cdf772
openinference-instrumentation-openai0.1.63
openinference-instrumentation0.1.70
openinference-semantic-conventions0.1.41
openai2.8.0
opentelemetry-api/sdk1.45.0
opentelemetry-exporter-otlp-json-http0.66b0
OTLP1.11.0
protobuf specification referencev1.11.1

The JSON HTTP exporter is an official beta release. OTLP/protobuf numbers identify specification references, not SDK package versions; the verified transport is JSON.

Official references: pinned OpenInference LLM conventions, OTLP specification, instrumentor 0.1.63 and JSON HTTP exporter 0.66b0.

OTLP and sidecar contract

Envelope: resourceSpans[] → scopeSpans[] → spans[]. Attributes are KeyValue arrays with typed AnyValue fields such as stringValue and intValue. Trace IDs are 32 hex characters; span and parent IDs are 16. Timestamps are positive Unix nanosecond values.

One complete joined trace is required, with one root, all parents present and every LLM call mapped exactly once. Dropped telemetry, unsupported schema transformations, duplicate IDs, cyclic hierarchy and nested LLM billing boundaries reject conversion.

Required call evidence includes LLM span kind, llm.system, effective model, input/output token counts and a resolved provider. Inclusive prompt usage already contains cache subsets; unknown cache semantics are rejected.

The explicit AICostBudget sidecar supplies task grouping, attempt grouping, boolean success, acceptance_rule, fallback evidence when a flag is supplied, and provider evidence when the raw provider is absent. It declares adapter_version=0, the pinned conventions commit, complete_trace=true and inclusive cache semantics. A completeness declaration cannot prove that uninstrumented work was captured.

OpenInference execution traces do not automatically establish task acceptance, retry boundaries or fallback semantics. Span status OK ≠ task success; multiple LLM calls ≠ retry; model switch ≠ fallback.

Attempts are explicitly numbered consecutively from 1; numbers after 1 represent retries. Several ordinary model calls may belong to one attempt. Fallback attribution requires an explicit flag and evidence. An absent flag remains unknown in diagnostics; replay counts only explicit flags.

Provider resolution

llm.system identifies the API ecosystem; llm.provider identifies hosting provider evidence. The OpenAI API ecosystem can be hosted elsewhere, including Azure.

Raw providerSidecar providerResultSource / error
PresentAbsentUse raw providerRAW
AbsentPresentUse explicit mappingSIDECAR
PresentSame normalized valueUse raw, confirmedRAW_CONFIRMED_BY_SIDECAR
PresentConflicting valueRejectPROVIDER CONFLICT
AbsentAbsentRejectMISSING PROVIDER EVIDENCE

Comparison normalizes case only. Whitespace and malformed identifiers reject; no alias table merges azure, azure-openai and openai. The adapter never guesses provider from llm.system, model name, URL or hostname.

Resolved provider and source are adapter diagnostics. Only the resolved provider enters the unchanged v0.1 output; provider source does not alter its schema.

Safety rules

  1. Span status is not task success.
  2. Multiple LLM spans are not automatically retries.
  3. Model change is not automatically fallback.
  4. llm.system is not hosting provider evidence.
  5. Use llm.provider as the preferred provider evidence when present.
  6. Missing raw provider requires explicit sidecar provider.
  7. Provider conflict must be rejected.
  8. Parent aggregate usage must never be silently double counted.
  9. Unsupported billing semantics must be rejected or explicitly unpriced.
  10. Prompt/completion content does not enter Agent Cost Evidence output.

AGENT/CHAIN usage can be excluded as an aggregate only with an explicit declaration, complete descendants and exact usage reconciliation. Otherwise conversion rejects. Upstream reported cost stays in diagnostics and does not override repricing or become external_cost_usd.

REAL-1 exporter evidence

Original raw capture: 3042 bytes. SHA-256:

08e6cc71146041d52801f29606dd3fa2e7aa482e829b25467cdfd28f38432293

ZERO RAW OTLP MODIFICATION. The raw capture is retained privately. Only the sanitized fixture is public; it preserves IDs, hierarchy, span kinds, system, model, token counts, timestamps and the attribute envelope. In particular, llm.provider remains ABSENT.

After the raw body passed, sanitization removed exactly four ignored content attributes: input.value, output.value, llm.input_messages.0.message.content and llm.output_messages.0.message.content. Raw and sanitized adapter output, diagnostics, replay metrics and provenance are identical.

The sidecar retains provider=openai as an explicit repricing assumption for local mock capture. It does not attest that OpenAI hosted the request.

Recorded REAL-1 resultValue
Task / attempt / call1 / 1 / 1
Provider / sourceopenai / SIDECAR
Modelgpt-5.4-mini
Input / output1000 / 500 tokens
Outcomesuccess=true from explicit sidecar
Retry / fallback0 / 0; fallback flag absent
Total / CPS$0.003 / $0.003

REPRICED USING CURRENT PRICES. These are recorded verification results using Standard text input $0.75/M and output $4.50/M. Replaying later uses the current catalog and can produce different estimates; this is not a historical invoice.

PriceRecord: price:openai/gpt-5.4-mini:standard:short:current; verified at 2026-09-22T04:23:19Z; replay source: OpenAI pricing. Pricing artifact snapshot: 2026-10-05T02:47:26Z; Website source commit: 476609c359c94ac3a5e3b4ce1a7ddf5f826c34e7.

Reproduce the import and replay

  1. Download sanitized OTLP fixture.
  2. Download explicit sidecar.
  3. Inspect the mapping, including explicit provider, outcome and the single attempt.
  4. Open Team API Cost Report.
  5. Select “OpenInference / OTLP JSON adapter v0”, choose the OTLP JSON file and task outcomes JSON file, then select “Convert and replay”.

Files are processed locally in the browser. The generated Agent Cost Evidence contains cost metadata and your explicit mapping; prompt/completion content is stripped. Review your identifiers and acceptance rules for sensitive content.

SYNTHETIC golden

Separate manually constructed edge-case evidence: 3 tasks, 5 attempts, 5 calls; Total=$0.0176625; CPS=$0.00883125; Retry tax=$0.006; Fallback overhead=$0.006; Failed work=$0.006. Categories overlap. This fixture covers edge cases and is not a real workload benchmark.

Known limitations

  • Pinned versions only; evidence does not establish support for other releases.
  • Non-streaming OpenAI Chat Completions only; no streaming validation.
  • REAL CACHE EXPORT NOT YET VERIFIED.
  • No universal Phoenix export support; no Phoenix dataframe JSON or Phoenix SDK JSON input.
  • No protobuf binary input; no JSONL input.
  • No automatic task success inference.
  • No automatic retry inference.
  • No automatic fallback inference.
  • No historical-price reconstruction.
  • Reasoning/audio/image billing may be unsupported.
  • Positive cache-write usage may remain unpriced.
  • Unsupported billing semantics are rejected; unsupported repricing blocks complete totals.

Public assets and license scope

Apache-2.0 applies only to the public technical/specification assets explicitly listed in the public asset license scope declaration: the Agent Cost Evidence schema, its synthetic example, this sanitized OTLP fixture and its explicit sidecar. See the unchanged Apache License 2.0 text.

It does not license the rest of the AICostBudget website, application source code, pricing engine, datasets or other content. The fixtures are generated from our local mock through SDK/exporter runtime and contain no third-party trace or raw auth headers.

Related specification assets: Draft-07 schema and SYNTHETIC Agent Cost Evidence example.