spantruth
Does your LLM telemetry tell the truth? spantruth replays provider responses through LLM instrumentation libraries and checks the values they report against what the provider actually sent: tokens, cache tokens, models, finish reasons, errors, and whether the span ends at all.
Your cost dashboard reads those numbers. Find out what your versions get wrong, with no API key and no setup. Run this in your project:
uvx spantruth doctor
Without uv, run it in a container.
The start of the output, as text
OpenLLMetry (anthropic 2.4.0, openai 3.42.1, opentelemetry-instrumentation-anthropic 0.62.4, ...)
ST01 Ghost span: 5 of 45 scenarios
The app made the call, and no finished span ever reaches a backend.
Cost figure for one call: -100%, at list price
For example, anthropic/stream-early-exit: never ended: anthropic.chat
Tracked at https://github.com/traceloop/openllmetry/issues/4536
Tracked at https://github.com/traceloop/openllmetry/issues/4643
ST02 Double span: 14 of 45 scenarios
One call reports its token usage on two spans.
Cost figure for one call: +100% in a backend that sums across spans, at list price
Today: Let one side report the call: set ANTHROPIC_OPEN_TELEMETRY=false, or pass open_telemetry=False to the client.
...
Read the report: every library, every scenario, every finding with the rule it applies. It is rebuilt every night, at pinned versions and at the latest releases.
What it found
Pinned versions, 2026-11-03: openai 3.42.1 and anthropic 2.4.0 under every library. Each finding is reported upstream, by the people credited below, and the nightly run against the latest releases shows when a fix lands.
| Library | Finding | Upstream |
|---|---|---|
| OpenLLMetry | Anthropic streams overcount output tokens. message_delta carries the cumulative count, and the wrapper adds it to the count in message_start (1 in the scenarios). |
#4377, by @arthi-arumugam-git |
| OpenLLMetry | A sync Anthropic stream that fails mid-way (a dropped connection, an overloaded_error event) never ends its span. The async stream ends it with status ERROR, but without error.type. |
#4643, by @chrikrah |
| OpenLLMetry | An OpenAI stream that fails mid-way ends its span with status OK, sync and async. |
#4535, by @feiiiiii5 |
| OpenLLMetry | An Anthropic stream the app closes early never ends its span. | #4536, by @armanunix |
| OpenInference | 44 of 45 scenarios pass. An async OpenAI stream read through with_streaming_response ends its span without the response model, the finish reason and the token counts. The early-exit spans that never ended are fixed in openinference-instrumentation-openai 0.1.66 and openinference-instrumentation-anthropic 3.1.0. |
#1134, by @SiyuanQi; #3790, by @feiiiiii5; #3930, by @armanunix |
| OpenTelemetry GenAI instrumentation | Every scenario passes. | |
| Anthropic SDK, built-in tracing | The SDK's own spans get the tokens, the cache counts and the errors right, but record the stop reason as anthropic.message.stop_reason, so gen_ai.response.finish_reasons is missing. |
#2055, by @chrikrah |
| A library on top of anthropic 1.14.0 or later | The SDK creates its own span for every call when a global tracer provider is registered, so a library on top reports each call on two spans, and a backend that sums token counts counts them twice. otel-official-sdk-on shows it: 14 of 19 cells. OpenLLMetry 0.62.4 does the same. OpenInference handles it since openinference-instrumentation-anthropic 3.1.1. spantruth turns the SDK's spans off for the other library subjects (ANTHROPIC_OPEN_TELEMETRY=false). |
opentelemetry-python-genai#971, by @lmolkova; langfuse#18978, by @rvndbalaji; fixed in openinference#4121, by @PabloPardoGarcia |
Every finding belongs to one of ten named bug classes,
such as a ghost span (the span never ends, so the call disappears), a double span (usage on two spans), or
phantom tokens. Where a count is wrong, the report also shows what that does to a cost figure at list
price. The run behind the table is committed as
results/2026-11-03-pinned.json.
Where to go next
- You use an instrumentation library in an application.
For application engineers: run
doctor, what each bug class costs, and how to fix it. - You maintain an instrumentation library. For maintainers: test a
checkout or a pull request with
--with, gate CI with--expectand the GitHub Action, get a comment on each pull request, and show a badge. - You wrote your own wrapper around the OpenAI or Anthropic SDK. Test your wrapper in five minutes, or grade it in your own test suite with the pytest plugin.
- You cannot run anything right now. Paste your lock file into the checker. It reads the file in your browser and sends nothing.
- You want a coding agent to check it. In Claude Code, run
/plugin marketplace add Plexito-de/spantruth, then/plugin install spantruth@spantruth. The skill runsdoctorand reads its result.
How it works explains the fake provider, the checks, the two controls that prove the suite, and the verdicts. Remedies say what an OpenTelemetry Collector can fix for each bug class, and the receipts show each bug as the wrong number it puts in a real backend. It needs no API key. The first run downloads each library once, and after that it needs no network.
Coverage
OpenAI Chat Completions, Anthropic Messages, Google Gemini and Azure OpenAI, sync and async, and a first OpenAI Responses API scenario: 81 scenarios in all, such as streams the app leaves early, dropped connections, 429s, prompt-cache hits, agent loops, concurrent calls, content capture and token metrics. How it works lists them.
The subjects are the OpenTelemetry GenAI instrumentation, OpenLLMetry, OpenInference, OpenLIT, Pydantic Logfire, Langfuse, the Sentry SDK, Datadog ddtrace, MLflow Tracing, the built-in tracing of the Anthropic SDK, and the frameworks LiteLLM, Pydantic AI, the OpenAI Agents SDK and LangChain (with OpenInference and with OpenLLMetry), plus the two controls.
Next, from the plan: the rest of the OpenAI Responses API, the SDK helpers such as
messages.stream(), AWS Bedrock, and the JavaScript libraries. Help is welcome.
Related work
- open-telemetry/semantic-conventions-conformance is the official project. It checks which attributes each instrumentation emits, against the semantic conventions, with Weaver. spantruth is complementary: it checks the values, and the failure paths. A finding that belongs upstream goes upstream.
- spanproof, by 4ktLuffy, applies the same method to Sentry's SDK integrations. spantruth takes its idea of validating every fixture with the provider SDK's own types from it.
- wrong-numbers, by arthi-arumugam-git, is a field guide to the same defect class across LLM eval, tracing and cost libraries: a number comes out wrong and nothing raises.
- wiretruth, by kartsan03, checks what the provider SDK returns to the caller, from verbatim recorded responses. spantruth checks what the instrumentation writes on the span. This project was called wiretruth until 2026-10-12 and took its current name so the two stay easy to tell apart.
Contributing
Contributions are welcome, and so are disputes. If you maintain one of these libraries and a cell is unfair, tell us: we decide every dispute on whether the cited rule says what the check claims. To add a library, a provider or a scenario, read CONTRIBUTING.md. First-time contributors sign the Plexito CLA with one comment on their pull request.
License
Apache-2.0. Maintained by Plexito.
Metadata
Release files for spantruth 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spantruth-0.6.0.tar.gz | 10.3 MB | With provenance | Details for spantruth-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spantruth-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for spantruth-0.6.0-py3-none-any.whl |
Total release size: 10.5 MB
Release files / spantruth-0.6.0.tar.gz
| Download URL | spantruth-0.6.0.tar.gz |
|---|---|
| Size | 10.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2fbbdfa684dcdc4ec2664d1d914f38cd3655691fc694effc2ad5d51593d1dad
|
|
BLAKE2b-256 checksum How to use checksums |
73986448b7bdca5cf03e59b7d92caad3135d20e593ff9342a25010a5c55ae5ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / spantruth-0.6.0-py3-none-any.whl
| Download URL | spantruth-0.6.0-py3-none-any.whl |
|---|---|
| Size | 208.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4db3c7065fff50e97295c044583be1f65b642bda8dce982e32675206cde759da
|
|
BLAKE2b-256 checksum How to use checksums |
78354b68dde55a67ee140f387eba4bbe6a534bc00a979308bcae9739544cf937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for spantruth 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for spantruth-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.