Commercial language model APIs return only text, allowing a provider to cut costs by quietly routing a fraction of user requests to a cheaper substitute model while billing for the advertised one. Detecting such partial substitution is challenging because honest providers also alter the output distribution through undocumented decoding and serving choices, such as temperature scaling, sampling truncation, repetition and presence penalties, and default system prompts, forcing an audit to test against a composite null of legitimate configurations rather than a single reference. Our key insight is that these legitimate variations primarily shift response typicality across the entire batch, whereas partial substitution injects individual responses that remain anomalous under the claimed model. Building on this, we introduce API-TAIL, a typicality audit that first absorbs batch-level shifts by aligning a single effective temperature to center standardized surprisal scores across the audited batch, and then flags the endpoint if the number of remaining tail responses exceeds a threshold calibrated across legitimate configurations. Evaluated on real-world API responses and constructed substitution mixtures, API-TAIL controls false alarms across diverse honest providers and detects low-rate partial substitution with a small query budget. Under a common composite calibration, it outperforms the adapted rank- and MMD-based audit baselines.
Figures & tables
Figure 1: API-TAIL audits an API from returned text. Each response is scored under the claimed model M ; one effective temperature is aligned to the audited batch to absorb batch-level shifts from honest decoding and serving choices; the number of responses that remain atypical is compared with a threshold calibrated by running the same procedure on locally generated responses of M across legitimate deployment configurations.
Qwen P30
Qwen P-user
Gemma P30
Gemma P-user
Audit
Power ↑
FAR ↓
Power ↑
FAR ↓
Power ↑
FAR ↓
Power ↑
FAR ↓
API-TAIL (ours)
0.33
0.035
0.69
0.002
0.89
0.003
1.00
0.069
NLL count
0.00
0.000
0.00
0.000
0.08
0.000
0.13
0.000
Log-rank count
0.00
0.000
0.00
0.000
0.03
0.000
0.10
0.000
Entropy count
0.01
0.022
0.00
0.065
0.02
0.029
0.00
0.001
RUT [ 37 ]
0.00
0.003
n/a
0.00
0.000
n/a
Table 1: Audits with API budget N=200 , common source banks, pool C and calibration rule, and method-specific sampling. FAR ( ↓ ): largest false-alarm rate over the plain endpoints of the panel (17 for Qwen, 9 for Gemma); all values are below the 0.10 validity limit and the validity verdicts hold in 20 of 20 re-drawn calibrations. Power ( ↑ ): 10% substitution by the panel’s main substitute (Qwen3.6-27B served by provider A for Qwen; Gemma-4-26B-A4B for Gemma). RUT and matched-budget MET are evaluated on the P30 panels: RUT uses one API response and 100 local references per prompt; MET uses two responses per side.
Power ↑ ( N=200 )
Power ↑ ( N=400 )
Panel
Substitute
ρ=0.05
ρ=0.10
ρ=0.25
ρ=0.10
Qwen P30
Qwen3.6-27B (provider A)
0.09
0.33
0.73
0.62
Qwen3.6-27B (developer platform)
0.11
0.42
0.78
0.71
Qwen3.6-35B-A3B
0.23
0.73
0.98
0.96
Qwen3.8-Flash
0.29
0.83
1.00
0.98
DeepSeek-V4.1-Flash
0.76
1.00
1.00
1.00
Table 2: Sensitivity analysis of API-TAIL’s detection power ( ↑ ) across different substitute types (cross-family models, same-family MoE or smaller siblings, and previous same-size releases), substitution rates ρ , and query budgets N (calibrated on pool C ; at N=200 , false-alarm rates are those in Table 1 ). “Provider A” and “developer platform” denote two deployments of the same previous-release substitute.
Figure 2: Power of API-TAIL as the audit budget grows, for the main substitute of each panel (Qwen3.6-27B from provider A on the Qwen panels, Gemma-4-26B-A4B on the Gemma panels) at three substitution rates. Every substitute is listed in Table 2 and Appendix B .
Variant of API-TAIL
Qwen P30
Qwen P-user
Gemma P30
Gemma P-user
MLE temperature
+0.22 [+0.07, +0.27]
+0.63 [+0.37, +0.67]
+0.09 [+0.06, +0.13]
0.00 [0.00, 0.00]
Fixed T=1 , no alignment
+0.33 [+0.22, +0.42]
+0.69 [+0.47, +0.78]
−0.04 [-0.07, +0.05]
+1.00 [+1.00, +1.00]
Top-20 window
−0.01 [-0.04, +0.02]
+0.62 [+0.41, +0.68]
0.00 [0.00, 0.00]
0.00 [0.00, 0.00]
Nucleus ( p=0.95 )
+0.30 [+0.20, +0.40]
+0.69 [+0.47, +0.78]
+0.83 [+0.78, +0.88]
0.00 [0.00, +0.01]
Threshold τ (API-TAIL / MLE)
7 / 9
5 / 10
8 / 9
5 / 5
Max. FAR without penalties
0.269 †
0.074
0.003
0.069
Table 3: Design ablations ( N=200 , main substitute, ρ=0.10 ). Top: power of API-TAIL minus the power of the variant, with paired-bootstrap 95% intervals ( B=2,000 ); positive values favour API-TAIL. Middle: integer composite-null thresholds τ of API-TAIL and of the MLE variant. Bottom: largest plain-endpoint false-alarm rate of API-TAIL with the five penalty configurations removed from C ( † : above the 0.10 limit).
Large language model auditing tests models and deployed systems for bias, safety, privacy, reliability, and provenance using behavioral and internal evidence.
Commercial LLM APIs advertise a specific foundation model, but the served backbone may be silently substituted, quantized, or wrapped, for example to save deployment costs. All existing audits decide backbone identity from the text-output channel, which is structurally fragile for agentic APIs because modern serving stacks (OpenAI, Anthropic, Gemini, Cloudflare Workers AI, LangGraph) discard text and expose only structured actions when the model calls a tool, and provider-injected system prompts can distort text distributions enough that text-channel tests falsely accuse honest providers of substituting the claimed model. We observe that recent agentic post-training internalizes tool-use directly into the weights, opening a new audit channel that the serving stack still exposes and that is largely invariant to deployment context. We introduce Agentic Provenance (AgentProv), the first action-based identity audit for agentic LLM APIs: AgentProv fingerprints a deployed model through its categorical tool-call distribution and decides identity via an MMD permutation test. AgentProv catches every substituted model (100% on 630 evaluated checkpoint pairs), while holding the false-positive rate under system-prompt injection at 7% (vs. 67% for MET and 53% for RUT). On third-party API endpoints, AgentProv's disagreements with MET are consistent with an independent token-count side-channel that detects provider-injected system prompts.
As large language models become increasingly widespread, third-party providers that deploy open-weight models have become an important part of the ecosystem. Auditing the quality of their inference APIs is therefore an open problem. We formalize hosted model routing as a stochastic process and propose \mbox{Ventor-QTest}, a composite black-box audit that requires no probability information from the target API. Its repeated-request component sends each frozen constrained context to the target multiple times, reconstructs a categorical output distribution from the returned text counts, and reports average fidelity loss (AFL) as a null-bias-corrected, within-window mean coarsened-KL statistic. Its long-sequence component uses independent runs to report extreme fidelity loss (EFL) through the empirical upper tail of a run-level reference-centered-surprisal statistic. Across three logprob-capable route conditions, AFL shows strong linear descriptive agreement with a logprob-derived coarsened-KL comparator. Across seven route snapshots, 20-run sequence probes reveal route-specific EFL variation. AFL and EFL have little detectable route-level association with GPQA-Diamond accuracy. In contrast, pronounced EFL coincides with a decline in Terminal-Bench pass rate as task exposure increases. This pattern may arise because correctness in long-horizon tasks is more sensitive to extreme fidelity loss. These results motivate reporting AFL and EFL jointly, particularly when auditing long-horizon agentic tasks. The open-source implementation is available at https://github.com/Tencent/AI-Infra-Guard/tree/main/services/api_checker/ventor_qtest.
Relay and reseller APIs mediate access to large language models (LLMs), but users cannot directly verify which model serves them. We introduce \name, a black-box auditing protocol based on stable factual recall near the knowledge boundary, including repeatable wrong answers. KBF generates benign, renewable probes and calibrates audit decisions against reference self-variation. Across 16 production endpoints, KBF detects all 155 economically relevant substitutions without rejecting any of the 16 same-reference controls. KBF remains robust to deployment variation and reaches 95% TPR at a substitution rate as low as 15% in mixed-routing simulations. Field audits flag 7 of 28 endpoints across six platforms as statistically inconsistent with their references. After reference enrollment, even GPT-6 Astra costs only approximately $0.67 per online audit at the recorded API prices.
Yijia Fang, Yiqing Feng, Bingyu Li +1
Beihang University China · Xidian University China · HKUST Hong Kong SAR, China