API-TAIL: Detecting Model Substitution in LLM APIs through Temperature-Aligned Likelihood Tails
Organizations: TokenRhythm Technologies
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 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
| 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 | ||
| Power ( ) | Power ( ) | ||||
| Panel | Substitute | ||||
| 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 | |
| Variant of API-TAIL | Qwen P30 | Qwen P-user | Gemma P30 | Gemma P-user |
|---|---|---|---|---|
| MLE temperature | [+0.07, +0.27] | [+0.37, +0.67] | [+0.06, +0.13] | [0.00, 0.00] |
| Fixed , no alignment | [+0.22, +0.42] | [+0.47, +0.78] | [-0.07, +0.05] | [+1.00, +1.00] |
| Top-20 window | [-0.04, +0.02] | [+0.41, +0.68] | [0.00, 0.00] | [0.00, 0.00] |
| Nucleus ( ) | [+0.20, +0.40] | [+0.47, +0.78] | [+0.78, +0.88] | [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 |
LLM Auditing
Large language model auditing tests models and deployed systems for bias, safety, privacy, reliability, and provenance using behavioral and internal evidence.
See all 644 papers