How to Verify LLM API Authenticity: From Trust to Cryptographic Proof
This article explains why LLM API users cannot reliably tell whether a flagship model, a cheaper model, or a degraded configuration handled their requests, and outlines a three-layer verifiable inference approach. It covers common failure modes such as model substitution, silent quality degradation, and distillation-based impersonation; why existing checks like asking the model its identity, fingerprinting output style, or inspecting response fields fall short; and how verifiable response envelopes, trusted execution environments with remote attestation, and sampled replay can provide identity verification, execution trust, and result auditing. It also describes how API consumers can adopt verification in tiers and how platform operators can integrate evidence issuance, verification, auditing, and routing.
Have you ever noticed that the same flagship chat model, served through different platforms, sometimes returns clear and well-reasoned answers and sometimes responds as if an intern were handling the task?
The problem is usually not your prompt. It is who actually processed the request. Over the past year or so, discussions about “model quality degradation” and “quietly swapping in a cheaper model” have persisted across developer communities. Some model providers have published usage policies disclosing behaviors such as high-frequency calls from mass-registered accounts and suspected distillation of model capabilities, with the scale of the disputed activity reportedly reaching hundreds of millions of calls. Both sides in these disputes present their own version of events, leaving API consumers in an awkward position: you say the model was swapped, the provider says it was not; you say answer quality has dropped, the provider says the model naturally fluctuates.
The root cause is that large model services are “invisibly opaque.” Behind a single API call, model weights, inference clusters, sampling parameters, and system prompts are all hidden from the caller. The only way to judge whether an answer is genuine is to rely on trust. If “trust” can be turned into something verifiable, model substitution, silent degradation, and distillation-based impersonation all become detectable.
1. Three Types of Distortion: How Paid Capability Gets Diluted
Before discussing the technical side, it helps to separate the common types of distortion. They occur at different stages and cause different levels of harm.
Model substitution: routing requests to a cheaper model
This is the most direct form. The caller requests an expensive flagship model, but an intermediary or aggregation layer forwards the request to a lightweight model and returns the answer unchanged. For the user, the API fields look completely normal, and response latency may even be shorter. The only change is that answer quality quietly declines.
Silent degradation: still nominally the same model, but with weakened inference
This type is harder to detect. Common tactics include:
- Deploying a lower-precision quantized version;
- Sharply limiting the reasoning budget or maximum output length;
- Truncating long context so the model “forgets” earlier content;
- Quietly injecting system prompts to alter answer style and behavioral boundaries.
From the caller’s perspective, the model identifier and API format remain unchanged; only the actual behavior differs. This kind of degradation is not necessarily intentional. Temporary fallback strategies during traffic peaks and configuration drift in canary releases can produce similar effects.
Distillation-based impersonation: passing off a “student model” as the “teacher model”
Distillation means training a smaller model on a large model’s outputs so that it performs similarly on target tasks. The technique itself is a well-established, widely studied approach in model compression. The problem arises when the distilled model is offered under the original model’s name. In that case, the caller pays for capabilities that were never actually invoked.
A model provider publicly noted that some organizations made high-frequency calls to the model using large numbers of accounts to harvest training data, with the cumulative volume of such conversations reportedly reaching the hundreds of millions. Behind this dispute is a very practical economic reality: inference costs for flagship models can be several times, or even tens of times, higher than for lightweight models. As long as the distilled model “looks close enough” on benchmarks and in everyday conversation, there is a strong incentive to misrepresent it.
All three types share a common trait: they can appear as normal API responses. That means self-checks by the caller are not enough. Verification must be built into the service’s runtime.
2. Why Existing Detection Methods Fall Short: From Self-Declaration to Proof of Identity
Given these risks, a number of detection methods circulate in the community. Let’s look at what each can and cannot prove.
Asking the model “Who are you?”
This is the simplest and least reliable approach. System prompts usually carry high priority in a conversation, so a provider can simply add a line saying “You are [model name],” and any model will answer accordingly. Identity information supplied by the party being verified does not, by itself, constitute evidence.
Comparing answer style, knowledge boundaries, and reasoning ability
Inferring the underlying model’s “fingerprint” from a large set of carefully designed test prompts is more reliable than asking directly, but it still has two weaknesses:
- Models are constantly being updated, and lightweight models are improving rapidly, so style boundaries keep shifting;
- Any change in sampling parameters, system prompts, or context length affects output, which can easily lead to false conclusions.
Inspecting response fields and reasoning-content checks
Some services return fields such as the model name or reasoning process in the response, and some platforms validate the completeness of these fields to judge whether the request actually reached an upstream service. This can answer “Did the request go through a particular model provider?” but it cannot answer “Did it go through the flagship model or a lightweight one?”
Asking the model provider to “prove its innocence”
When users collectively report degradation, the provider can usually only state that it has not changed the model, without presenting convincing evidence. Providers have neither the incentive nor a ready-made mechanism to prove to every caller which model version and configuration generated a given response.
The core problems can be summarized as two points:
- Identity is self-declared with no cryptographic backing, so anyone can claim to be a flagship model;
- There is no binding. Even if the upstream service provides some kind of identifier, there is no way to prove it corresponds one-to-one with the answer in front of you.
Solving this requires introducing “verifiable inference” into the service architecture, so that each response carries a verifiable identity credential.
3. The Overall Approach: A Three-Layer Verification System for Verifiable Inference
The core idea of verifiable inference can be stated in one sentence: make every inference execution leave behind evidence that cannot be forged and can be independently verified by third parties. The evidence does not need to cover every detail. What matters is that it answers three progressively deeper questions.
- Layer 1 — Identity: Who is the service, and was the response signed by the claimed provider?
- Layer 2 — Configuration: Which model, version, and parameters were used for this inference?
- Layer 3 — Computation: Did the claimed model actually perform inference on this input?
The first two layers can be implemented at relatively low cost using cryptographic methods. The third layer involves more advanced technologies such as trusted execution and probabilistic verification, and can be introduced as needed. The three layers can be deployed independently or layered incrementally.
Layer 1: Verifiable response envelopes
Attach structured metadata and a digital signature to each response, pinning down “who, with which model, processed which input, and produced which output.” This forms a verifiable response envelope.
The field design is as follows:
| Field | Meaning | Purpose |
|---|---|---|
| nonce | Single-use random number | Prevents replay |
| timestamp | Server-side timestamp | Limits the verification time window |
| model_id / model_version | Logical model identifier and specific version | Answers “which model, which version” |
| request_hash | Hash of the canonicalized request (messages, parameters, tool definitions, etc.) | Binds the input |
| params_hash | Hash of sampling parameters | Exposes configuration such as temperature and max output length |
| output_hash | Hash of the answer body (and reasoning content) | Binds the output |
| seq | Monotonically increasing sequence number | Prevents replay, aids auditing |
| signature | Digital signature over the above fields | Prevents tampering and forgery |
(A sample JSON structure)
{"nonce": "b7f2c9a1","timestamp": 1770000000,"model_id": "flagship-chat","model_version": "2026-02-11","request_hash": "sha256:9f1c...","params_hash": "sha256:31ab...","output_hash": "sha256:7d02...","seq": 184203,"signature": "ed25519:3c9a..."}
Sample verification code:
import hashlibimport hmacimport jsonimport time# Fields that do not affect model output, such as trace IDs and timeout settings, are excluded from fingerprintingIGNORED_KEYS = {"request_id", "timeout", "stream", "trace_id"}def canonical(obj):"""Canonical serialization: sorted keys, no extra whitespace, ensuring both sides compute the same result"""return json.dumps(obj, sort_keys=True, separators=(",", ":"),ensure_ascii=False).encode("utf-8")def fingerprint(payload):body = {k: v for k, v in payload.items() if k not in IGNORED_KEYS}return hashlib.sha256(canonical(body)).hexdigest()def verify_envelope(envelope, public_key, payload, max_skew=300, seen=None):# 1. Verify signature: confirm the envelope was signed by the provider's private keysigned = canonical({k: v for k, v in envelope.items() if k != "signature"})if not verify_signature(public_key, signed, envelope["signature"]):raise ValueError("Invalid signature: the envelope may have been tampered with or forged")# 2. Time-window check: limit the window for replay attacksif abs(time.time() - envelope["timestamp"]) > max_skew:raise ValueError("Timestamp outside the allowed window")# 3. Replay protection: nonce plus monotonically increasing sequence numberkey = (envelope["nonce"], envelope["seq"])if seen is not None:if key in seen or (envelope["seq"] <= seen.get("last_seq", 0)):raise ValueError("Possible replayed request")seen.add(key)seen["last_seq"] = envelope["seq"]# 4. Request binding: prove the response corresponds to the current requestif not hmac.compare_digest(fingerprint(payload), envelope["request_hash"]):raise ValueError("Request fingerprint mismatch: the response may not belong to this request")
A few points about this design are worth noting:
- The private key should be held only on the model provider side, ideally managed by a dedicated signing service or key management service. Callers cannot forge it, and the provider cannot later deny responsibility.
- The signature covers not the raw message but the canonical serialization of the fields. Both sides must agree on the same rules, or even a single space difference will cause verification to fail.
- Only declarative evidence is locked down. This does not cryptographically force the model to behave as claimed; true computational authenticity is covered by Layers 2 and 3.
Layer 2: Trusted execution and remote attestation
For scenarios with higher security requirements, model inference can be placed in a hardware-level trusted execution environment (TEE), and a remote attestation report can be generated for each inference. Using the measurements in the attestation report, the caller can confirm that the expected version of the service code and model was running, then combine that with the signed response to achieve dual verification of “identity” and “computation.”
TEEs can effectively prevent the service operator from tampering with the running model and code, but they rely on trusting the hardware vendor and introduce additional performance overhead and platform adaptation costs. They are better suited to highly sensitive, high-value scenarios such as finance and healthcare, rather than all calls.
Layer 3: Sampled replay verification
To address “model substitution” and “silent degradation” that the first two layers cannot fully rule out, sampled replay can be introduced: periodically select a portion of completed requests, re-run inference on the same inputs and with the same parameters using an official model directly contracted by the caller, then compare the outputs or log-probability distributions. If the difference exceeds the expected range, an alert is triggered and manual review begins.
Two prerequisites apply here:
- The official model must provide reproducible inference results, for example by fixing the random seed and using deterministic decoding;
- A baseline must be established, because quantization, batch scheduling, and hardware differences can all introduce subtle deviations.
The sampling ratio can be adjusted dynamically based on call volume: high-risk workloads get full verification, ordinary workloads get spot checks at a set ratio, and the result ultimately reflects overall trustworthiness over a period of time.
4. How Callers Can Integrate: A Tiered Verification Strategy
Verifiable inference is not an all-or-nothing switch. Different types of callers can choose an appropriate verification strength based on risk and cost.
Lightweight integration: verify only signature and request binding
Suitable for most business scenarios, with the lowest integration cost. The caller only needs to:
- Obtain the model provider’s public key from a trusted channel;
- Verify the envelope signature, timestamp, nonce, and request fingerprint;
- Record the verification result in call logs.
At minimum, this guarantees that the response was signed by the claimed provider and is strictly tied to the current request.
Standard integration: add configuration consistency checks
Parse the model version and parameter information in the envelope and compare it against the configuration expected on the business side. Alerting immediately on version drift, changed parameters, or unknown model identifiers can effectively catch silent degradation and configuration errors.
High-value integration: sampled replay plus regular audits
Add sampled replay to critical business paths and regularly audit the distribution of envelope authenticity. Verification results can be fed into a logging service for structured storage, and monitoring and alerting capabilities can set thresholds — for example signature failure rate, version mismatch rate, and replay deviation rate — to notify responsible teams when anomalies occur.
5. How Platforms Can Build It: One Call, Three Perspectives
If you are building an enterprise LLM gateway or a model service platform, this capability can be broken into four interconnected pipelines.
Credential issuance pipeline: generate evidence within the inference process
After inference completes, a signing module running in the same controlled environment as the model (such as a TEE) reads the request and output, computes the hashes, and generates the envelope. The signing private key should not be persisted in the business process, avoiding private-key exposure if the model process is compromised.
Credential verification pipeline: unified verification at the gateway
After a self-built or third-party gateway receives an upstream response, it verifies the envelope before deciding whether to forward it to the end user. If verification fails, it can handle it according to policy: reject outright, retry automatically, fall back to a backup model, or simply log an alert.
Audit pipeline: evidence retention and traceability
All envelopes, verification results, and sampled replay records are archived together, usable for post-hoc traceability and as mutually accepted evidence in the event of a dispute.
Routing pipeline: billing based on the actual model
For multi-model aggregation services, the routing layer can differentiate billing based on the model_id and model_version in the envelope. Routing policy adjustments, canary releases, and capacity-based downgrades should all be explicit configurations, with every change recorded. This eliminates, at the mechanism level, the ambiguity of “the user bought flagship but actually used lightweight.”
As a reference, on cloud platforms such as Baidu AI Cloud, this approach can be implemented using general cloud product capabilities such as key management, logging, monitoring and alerting, and container platforms:
- Signing private keys and public-key distribution rely on key management capabilities;
- Envelopes and verification results are archived and searchable via logging services;
- Anomaly metrics are pushed in real time through monitoring and alerting capabilities;
- Signing and verification services are deployed in containers with elastic scaling.
6. Limitations That Must Be Acknowledged
Replacing “trust” with “proof” is the right direction, but it is important to recognize that it is not a cure-all.
Identity can be proven; content is hard to prove
Digital signatures can prove who produced a response and which request it corresponds to, but they cannot cryptographically guarantee that the model actually performed the expected computation. There is still a gap between “a provider claims it used the flagship model” and “confirming the flagship model was used,” which is bridged by the third layer of trusted execution and sampled replay.
It depends on the model provider’s cooperation
If an upstream provider does not sign responses, or an intermediary “signs on its behalf,” the credential loses its meaning. This capability is better built into providers’ official APIs than fabricated afterward by intermediate layers.
Cost and performance overhead
Signing and verification add millisecond-level latency, sampled replay consumes additional model compute, and trusted execution environments bring performance losses. Verification strength needs to be designed reasonably in light of business value.
It cannot replace contracts and governance
Technical measures solve the problem of “what can be proven,” but “what should be done” still relies on service agreements, compliance constraints, and industry norms. Technically, impersonation can be made traceable, but ultimately institutional constraints are still required.
7. From “Believing” to “Verifying”
The disputes surrounding large model services ultimately come down to information asymmetry: callers pay the price of a flagship model but cannot confirm what they actually received. Traditional software at least has version numbers, checksums, and digital signatures to check against, while large model services have long remained in a state of “it is what the provider says it is.”
Verifiable response envelopes, trusted execution with remote attestation, and sampled replay correspond to three levels: identity that can be verified, execution that can be trusted, and results that can be audited. They do not require overturning existing service architectures. Instead, they embed evidence into every call, turning model substitution, silent degradation, and distillation-based impersonation from “undetectable” into “traceable.”
For callers, this is a degree of control you can hold yourself; for platform operators, it is a way to build service credibility; and for the industry as a whole, it is a necessary path from “black-box trust” to “verifiable collaboration.” The next time a debate arises over whether a model has been quietly swapped, rather than guessing at each other, let every response carry its own proof.
