arXiv:2610.36801cs.LGOct 2026

Manuscript Offprint

arXiv:2610.36801

API-TAIL: Detecting Model Substitution in LLM APIs through Temperature-Aligned Likelihood Tails

Haocheng Mei, Yuchuan Tian, Ye Yuan, Chao Xu, Allen Chen, Kai Han, Yunhe Wang

Abstract

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 commercial APIs, API-TAIL reliably controls false alarms across diverse honest providers while detecting even low-rate partial substitution with a small query budget, substantially outperforming existing rank- and MMD-based audits that lose detection power under the same composite calibration.

Project Page: https://github.com/TokenRhythm/API-TAIL

1. Introduction

Commercial language model APIs allow users to select and pay for a specific model by name while returning only generated text. A provider can therefore cut cost by answering a fraction ρ\rho of the requests with a cheaper substitute, such as an older release, a smaller or mixture-of-experts sibling, or a model of another family, while billing for the advertised model. Such partial substitution is invisible in any single response, and auditing APIs for it has become an active problem [13, 5, 37, 6, 33, 35, 21].

The central obstacle is that honest providers do not serve a model in one canonical way. They choose decoding temperatures and truncation thresholds, apply repetition or presence penalties, and add default system prompts, usually without documenting these choices. Each choice shifts the distribution of the returned text, so an honest endpoint is not a sample from one reference distribution but from one of many legitimate deployments: the audit has to test a composite null hypothesis. Audits built around a single reference face a dilemma under this null. They either raise false alarms on honest providers or, once calibrated to accept all legitimate deployments, lose their power. In our experiments, a published rank-based audit [37] and an MMD-based

Figure

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.

audit [13], calibrated on the same legitimate configurations as our method, have zero power against 10% substitution with 200 requests, even on the controlled short-response panels where their repeated sampling per prompt is feasible.

Our approach starts from how the two kinds of change act on the text when every returned response is scored under the claimed model. Legitimate decoding and serving choices—whether temperature scaling, truncation, repetition and presence penalties, or default system prompts—shift how surprising the honest responses are for the claimed model, and they shift the whole batch together. A substitute model instead writes individual responses that stay atypical for the claimed model across temperatures. This suggests absorbing the batch-level shift first and testing what remains against a threshold that accounts for residual configuration differences.

API-TAIL implements this idea in three steps (Figure 1). It scores each response by its standardized excess surprisal: how much more surprising the response is under the claimed model at temperature T than a typical sample, in units of its standard deviation. It aligns one effective temperature to the audited batch by choosing the T at which these scores are centered, thereby absorbing batch-level shifts from undocumented decoding and serving choices. It then counts the responses whose score stays above 3 and compares the count with a threshold calibrated on locally generated responses of the claimed model across a pool of legitimate configurations, including the penalty configurations that providers use. Scores are computed exactly over the full vocabulary, so an audit is deterministic and reproducible.

We evaluate API-TAIL on real APIs: 26 plain honest endpoints serving Qwen3.8-27B or Gemma-4-31B-it through OpenRouter, two request protocols, and six substitute models served by seven endpoints, 143,955 responses in total. Our contributions are:

• Formulation. We cast text-only auditing of language model APIs as a test against a composite null of legitimate deployment configurations, with validity evaluated directly on real honest providers (Section 2).

• Method. We propose API-TAIL, which aligns an effective temperature by centering standardized typicality to absorb batch-level deployment shifts, counts the responses that remain atypical, and calibrates the count across a pool of legitimate decoding and serving configurations (Section 3). One audit of 200 requests needs one response per prompt, less than 0.16 USD of API calls and two to eight GPU-minutes of deterministic local scoring.

• Evidence. API-TAIL keeps the false-alarm rate at or below 0.069 on all 26 plain honest endpoints and detects 10% substitution with power of at least 0.69 in 13 of 16 substitute settings at 200 requests (Section 5). Matched ablations explain the design (Section 6): aligning instead of maximizing likelihood adds 0.09 to 0.63 power by keeping the composite threshold low, full-vocabulary scoring adds 0.62 power over a top-20 window on long responses, and the penalty configurations in the pool are what make the model developer's own endpoint pass.

References (12)