How to Detect LLM Model Substitution in API Relay Services: A Five-Step Verification Guide

    Some API relay providers silently swap a flagship model for a cheaper one, so users pay for premium output while actually receiving lightweight responses. Because model weights, version numbers, and routing decisions live on the server side, this kind of substitution is hard to notice from a chat interface. This article explains why relay services substitute or downgrade models, then walks through a five-step verification method: knowledge boundary testing, reasoning and long-context testing, token fingerprinting, performance baselines, and contract auditing. It also includes reproducible inspection scripts and a checklist of common mistakes, so developers and enterprises can replace subjective impressions with observable, comparable data.

    Introduction: From “nearly a month of being misled”

    A developer who had used large model APIs for a long time bought an annual plan from a relay service, paying the price of a flagship model. It took almost a month before he noticed that answer quality had clearly declined: complex coding problems were frequently wrong, and questions requiring cross-referencing analysis got plausible-sounding but unreliable answers. Calling the same generation of models through the official channel did not behave this way. The root issue was not that “the model got dumber,” but that the flagship model specified at purchase had been quietly swapped at the interface level for a cheaper one.

    There are three asymmetries that let ordinary users go a long time without noticing:

    • Information asymmetry: Model weights, version numbers, and routing policies all sit on the server side; the client can only see the conversation content and token usage statistics.
    • Asymmetry in verification cost: Substituting a model only requires changing a server-side configuration, while detecting it requires continuously constructing controlled experiments.
    • Incentive asymmetry: Once quality fluctuations are attributed to “the model just performing inconsistently,” the user’s attention shifts, and the substitution can stay hidden even longer.

    So the core idea for guarding against model substitution can be summed up in one sentence: don’t ask “what it says it is,” observe “what its behavior looks like.” This article treats model calls as an external service that needs acceptance testing, and presents a five-step verification method along with a practical, automatable inspection scheme.

    1. Clarifying the concept: why relay services “adulterate”

    A relay service refers to a setup where, without changing the way the API is called, a third-party proxy layer receives requests uniformly, then forwards them to an upstream model service, while handling authentication, billing, and response conversion. The proxy pattern itself is a normal technical approach. Adulteration happens in the forwarding step: the user pays for model A, but the proxy layer sends the request to model B, then fills in identifiers and usage figures in the response using model A’s format.

    It’s worth stressing that the problem isn’t only “expensive model swapped for a cheap one” — the more insidious case is “a model’s capabilities quietly trimmed.”

    Type Typical behavior Impact on users
    Horizontal downgrade Flagship model replaced with a lightweight model or a small open-source model Clear drop in complex reasoning, long-form writing, and code generation quality
    Vertical downgrade New or stable version replaced with an older or preview version Outdated knowledge, weaker instruction following and tool-calling ability
    Cross-vendor substitution One vendor’s model passed off as another’s Output style, knowledge boundaries, and declared model don’t match
    Dynamic scheduling Silent switching to a cheap model during peak hours or for specific accounts Inconsistent quality that’s hard to attribute
    Hidden reduction Injecting hidden system prompts, truncating history context, disabling advanced features Personalization breaks, multi-turn conversations “forget,” capabilities shrink
    Metering distortion Compressing context, falsifying usage statistics, double billing The actual service shrinks while the bill is settled at flagship rates

    Example: A developer pays for a model billed as having “extra-long context capability.” To save cost, the proxy layer silently truncates history messages beyond 32K before forwarding. The answers the user receives still read coherently and look completely normal on the surface, but the further the conversation goes, the more it “forgets” earlier agreements. This kind of problem can’t be found in a single conversation; it can only be caught through continuous monitoring with multi-turn, long-context test cases.

    The fundamental reason adulteration survives is cost difference. In most vendors’ public pricing, the per-token cost of flagship models versus lightweight models differs by several times, even an order of magnitude. Yet on some “aggregated calling” or “ultra-low-price” channels, the end-user price is nearly the same. With model weights closed-source and server-side implementation invisible, users can hardly perceive the difference from a chat interface, and the cost of violating is relatively low — so wrapper shells and downgrading have a persistent motive. Only when the caller can observe, compare, and trace does this arbitrage space get compressed.

    2. Core principle: a verification approach based on black-box behavior modeling

    There is one premise we must face squarely: for a black-box service, “whether it is a certain model” cannot be strictly proven. Any detection method claiming “100% certainty” deserves skepticism. The pragmatic goal is to narrow the doubt to a controllable range, which can follow four principles:

    1. Reproducible: Fix the random seed (or set temperature to 0 as much as possible), prompts, and parameters, so the issue can be triggered repeatedly.
    2. Comparable: Call the same test case once through the official channel and once through the relay service, using the official call result as the baseline.
    3. Quantifiable: Every test case carries a standard answer and can be auto-scored, avoiding subjective judgments like “it feels dumber.”
    4. Accumulating: Sample multiple times and record over the long term, drawing conclusions from data distributions rather than a single result.

    In addition, the five steps should be used in combination; any single step can be deliberately evaded or produce a misjudgment.

    3. The five-step verification method in detail

    Step 1: Knowledge boundary test — check the “time fingerprint”

    Principle: A large model’s parameters are fixed after training is complete, so it has a roughly clear knowledge cutoff. Without calling external search, the model should “not know” about facts after that point and honestly say it can’t answer.

    Key points:

    • Prepare 3–5 real public events that occurred “after the paid model’s stated knowledge cutoff”; make questions specific (time, subject, verifiable outcome), while avoiding leaking answer clues in the prompt;
    • Clearly tell the model “if you don’t know, just answer ‘I don’t know,’” to reduce fabrication;
    • Ask the same question multiple times and observe whether answers are stable.

    Interpretation: If it can stably describe events after the cutoff date, you can basically rule out “an older version,” but you can’t prove from this that it’s the specific paid version. If it knows nothing at all, that’s consistent with the “older or lightweight model” hypothesis — a suspicious signal, not a conclusion.

    Limitations: If the relay service has hooked up web search or a knowledge base behind the scenes, the knowledge boundary fails. So this step is best used only as an exclusion test, not as sole grounds for a verdict.

    Example question:

    1. Please answer: What was the officially announced result of {specific event} that happened in {year, month}?
    2. Requirement: Answer based only on training data; if you don't know, reply only "I don't know."

    Step 2: Reasoning and long-context test — check the “capability fingerprint”

    Principle: Model capability follows a gradient with parameter scale and training investment. Single-round simple Q&A can be handled by all models; once the difficulty ladder rises, the gap between flagship and lightweight models widens rapidly.

    Include at least four categories of test cases:

    • Multi-step logic: reasoning problems with ample distractors and a unique answer;
    • Code algorithms: programming problems with many edge cases that can be run and verified automatically;
    • Long-context recall: embed a key or number at a random position in a long text, testing three positions separately — beginning, middle, and end;
    • Strict instruction following: multiple constraints at once, such as output format, length, forbidden words, and field order.

    Example (multi-step logic):

    1. A warehouse has 12 crates of parts, each crate has 24 boxes, each box has 6 pieces.
    2. The warehouse uses 3/4 of them to load onto trucks and ship away, and the rest is divided among 8 workers.
    3. Each truck is exactly filled with 96 boxes. Please give in order: total number of pieces, number loaded onto trucks, number of trucks needed, remaining number, and number each worker gets.
    4. Output only five numbers, separated by commas, no explanation.

    Example (long-context recall):

    1. A 4-digit code is hidden in the long text below. Find it and output it exactly as-is, and do nothing else.
    2. (Insert filler text here... paragraph {some position}: the meeting key is 7Q2X, do not distribute...)

    Interpretation: Record each category’s average score and the proportion of complete failures, and compare against the baseline from the official call. Signs like “mid-context recall rate suddenly drops” or “format compliance rate falls sharply” often explain the problem better than “the answers aren’t smart enough.” If scores are close, a clear reasoning downgrade can basically be ruled out.

    Limitations: Sampling is random, and a single failure can’t be a conclusion. Sample each category multiple times, or use a private question pool, to avoid the relay provider doing “targeted optimization” for public benchmarks.

    Step 3: Token fingerprint comparison — check the “underlying fingerprint”

    Principle: Different models use different tokenizers, so the same sentence splits into a different number of tokens. OpenAI-compatible interfaces usually carry usage statistics in the response (such as input token counts); you can compare these against locally computed results using the tokenizer of the declared model.

    Key points:

    • Construct a “mixed probe” text containing mixed Chinese and English, consecutive digits, rare symbols, emojis, and code snippets;
    • Use a local tokenizer for the corresponding series of the tested model to count tokens (open-source models can load the official tokenizer directly; for closed-source models, use the usage returned by the official call as the baseline);
    • Call both the relay service and the official channel with the same request, and compare the usage differences on both ends.
    1. """Token usage fingerprint comparison (illustrative)"""
    2. def token_fingerprint(client_a, client_b, model, text, tokenizer):
    3. """client_a / client_b are wrapper call functions that each return the input token count in usage"""
    4. # Probe text: covers mixed Chinese/English, digits, symbols, emojis, and code
    5. probe = f"中文 English 123456 Rare:{{}} @#$% 😀\n```python\nprint('hi')\n```\n{text}"
    6. # Tokenization standard of the declared model itself (open-source models can compute locally with the official tokenizer)
    7. local_count = len(tokenizer.encode(probe))
    8. # Use the official channel call result as the comparison baseline
    9. a = client_a(model=model, prompt=probe)
    10. b = client_b(model=model, prompt=probe)
    11. return {
    12. "local_tokens": local_count,
    13. "service_a_tokens": a["prompt_tokens"],
    14. "service_b_tokens": b["prompt_tokens"],
    15. "match": a["prompt_tokens"] == b["prompt_tokens"],
    16. }

    Interpretation: Usage statistics that clearly don’t match the declared model’s tokenization standard are a strong signal worth investigating. For example, some open-source tokenizers optimized for Chinese differ markedly from general-purpose tokenizers in how they split pure Chinese text.

    Limitations: The usage fields are returned by the server and can theoretically be faked. So this step needs to be combined with others, and since different models’ system prompt lengths also affect the count, you must compare against official channel results rather than infer from nothing.

    Step 4: Performance baseline test — check the “runtime fingerprint”

    Principle: A model’s parameter count, inference precision, and server-side scheduling policy show up in latency and throughput characteristics. Lightweight models usually run faster, but speed alone isn’t enough to make a determination. More concerning is “drastic performance fluctuation in the same service,” which is a typical sign of dynamic scheduling.

    Key points:

    • Metrics: time-to-first-token (latency of the first token returned), overall elapsed time, output throughput (tokens/sec), error rate;
    • Method: with identical request content and parameters (fixed output length, disable streaming or uniformly collect first-token time), measure the relay service and the official channel separately, taking P50 and P95 percentiles;
    • Time windows: cover both peak and off-peak periods;
    • Note: If the relay service itself is located overseas, network round-trip differences far exceed model differences, so horizontal comparison has limited meaning. In that case, focus on the same service’s fluctuation over the time dimension, and directly inspect anomalous fields in the response structure.

    Interpretation: Being several times faster than the official channel with quality dropping in tandem points to a lightweight model. Normal during the day but quality collapsing at evening peak points to dynamic scheduling. Usage fields that are anomalous in order of magnitude call for checking the metering standard.

    Step 5: Contract audit and continuous inspection — check the “rules and accounts”

    Principle: Technical detection solves “does it look like it”; contracts and accounts solve “does it add up.” For enterprise procurement, model identifiers, version policies, downgrade notification mechanisms, and billing standards should be written into the contract or service level agreement, and complete call records should be kept, so every downgrade can be held accountable.

    Key points:

    • Checklist reconciliation: Organize representative cases from the five steps into a fixed checklist, and run it regularly before each purchase, after version upgrades, and during long-term use;
    • Automated inspection: Turn the checklist into scheduled tasks that auto-score, archive results, and set alerts;
    • Bill reconciliation: Use text requests with known token counts to check whether the returned usage matches the billed usage, and compare item-by-item against the contract unit price;
    • Evidence for recourse: When anomalies are found, keep evidence such as request timestamps, original responses, and comparison results, and formally raise inquiries with the service provider.
    1. """Model fidelity inspection (illustrative): run on a schedule, results persisted for monitoring alerts"""
    2. import json
    3. import statistics
    4. import time
    5. # Private question bank: covers knowledge boundary, reasoning, long context, and instruction following.
    6. # Each item has a standard answer and a scoring function.
    7. # CASES = [{"id": "K01", "kind": "knowledge", "prompt": "...", "score": score_fn}, ...]
    8. # call(model, prompt) is a self-wrapped call function returning {answer, prompt_tokens, total_ms}
    9. def run_inspection(call, model, cases, rounds=3, threshold=0.8):
    10. records = []
    11. for case in cases:
    12. for _ in range(rounds): # Sample multiple times to reduce misjudgment from randomness
    13. t0 = time.perf_counter()
    14. r = call(model, case["prompt"])
    15. records.append({
    16. "case_id": case["id"],
    17. "kind": case["kind"],
    18. "score": case["score"](r["answer"]), # Auto-score based on the standard answer
    19. "total_ms": round((time.perf_counter() - t0) * 1000, 1),
    20. "prompt_tokens": r["prompt_tokens"],
    21. "ts": time.strftime("%Y-%m-%dT%H:%M:%S"),
    22. })
    23. # Archive results to object storage or a log service, hook up monitoring alerts, and compare against historical baselines
    24. by_kind = {}
    25. for rec in records:
    26. by_kind.setdefault(rec["kind"], []).append(rec["score"])
    27. summary = {
    28. "model": model,
    29. "pass_rate": {k: round(statistics.mean(v), 3) for k, v in by_kind.items()},
    30. "p50_ms": statistics.median(r["total_ms"] for r in records),
    31. "alert": any(statistics.mean(v) < threshold for v in by_kind.values()),
    32. }
    33. return summary, records

    4. Common mistakes and a pitfall checklist

    1. Asking “what model are you”: Conversational models may have different system prompts loaded, and a model’s self-description isn’t reliable, so the answer can’t be used as evidence;
    2. Testing only once: Sampling is random; you must sample multiple times and compare against a baseline;
    3. Using only public benchmarks: They’re easy to target-optimize for, so use a private, periodically rotated question pool;
    4. Looking only at latency: High latency may just be network or queuing; combine it with quality metrics for a holistic judgment;
    5. Ignoring hidden reductions: “Half-true, half-false” services like hidden prompts and context truncation are harder to detect and need dedicated test cases;
    6. Paying for ultra-low prices: When the price clearly deviates from a reasonable cost range, “cheap” very likely comes from undisclosed downgrading. Enterprise procurement should prioritize legitimate channels with complete qualifications and clear service terms.

    5. Implementation advice for enterprises and teams

    For individual developers, the five steps above are enough to handle most risks. Enterprise-grade applications need to build long-term mechanisms on top of this:

    • Unified call gateway: Wrap multiple services uniformly to make switching and comparison easy at any time;
    • Quality observability: Hook each call’s case scores, latency, and usage into monitoring alerts, and notify promptly when abnormal fluctuations appear;
    • Evaluation pipeline: Version the question pool, persist results (e.g., archive to object storage), and schedule inspection tasks; do canary comparison of old vs. new versions in the pipeline when needed;
    • Supplier management: Bring model identifiers, downgrade policies, billing standards, and data-handling terms into contracts and SLAs;
    • Leverage platform capabilities: For example, general cloud products such as Baidu AI Cloud’s log service, monitoring alerts, and object storage can carry call record archiving, quality metric monitoring, and inspection result retention, lowering self-build costs.

    Conclusion

    Model adulteration persists not because the technique is sophisticated, but because it exploits information asymmetry and the high cost of verification. The five-step verification method won’t give a “100%” conclusion, but it turns subjective suspicion into comparable, quantifiable, traceable data. For ordinary users, prioritizing legitimate channels and judging abnormal low prices with price common sense is itself the most effective line of defense; for developers and enterprises, treating model calls as an external service that needs acceptance testing and building a continuous inspection mechanism is the only way to fundamentally shrink the survival space of “there’s something behind the cheapness.”