Skip to content
Unmask a Stealth LLM: Fingerprint Any Model API — ContentBuffer guide

Unmask a Stealth LLM: Fingerprint Any Model API

K
Kodetra Technologies··14 min read Intermediate

Summary

Port the Ox Alpha probe kit to Python: normalized token counts, error DNA, ranked verdict.

On 20 August 2026 a model called stealth/ox-alpha showed up on OpenRouter with no lab name, no logo, no press release, a 1,048,576-token context window, and a free preview window that ran about a week. Within 48 hours it was in production traffic at Nous Research's Hermes agent and inside the Zed editor. Nobody could say who made it.

The interesting part was not the guessing. It was the method the community converged on within a day: stop asking the model who it is, and start measuring the plumbing around it. Independent researcher Ben Davis put it at Zhipu's unreleased GLM-5.x series with 99% confidence, leaning mostly on video-encoder token consumption and tokenizer alignment. Separately, unclecode (author of Crawl4AI) collected the scattered one-off tricks people were posting into modelprint, a single-page tool with an approved registry of 15 probes. Its day-one ranking put z-ai/glm-5.3 at 6 of 9 probes matched, with all four normalized tokenizer counts hitting exactly. No other lab's best candidate cleared more than 2 of 4.

This guide ports that idea to Python and explains the one piece of math that makes it work. And the technique outlives the Ox Alpha news cycle, because the same probes answer a much more boring question you actually have in production: is the alias I pinned still serving the model I benchmarked? Two days before Ox Alpha appeared, the same author showed that DeepSeek's API was quietly serving something different under the old deepseek-chat name. Nothing in the response tells you when that happens.

By the end you'll have a probe harness, a scoring function that refuses to guess when the signal is noisy, and a tripwire script that fails your CI when a provider swaps the weights under a stable alias.


Prerequisites

  • Python 3.9+ and requests (pip install requests)
  • An API key for any OpenAI-compatible endpoint. Examples here use OpenRouter, but anything that speaks /chat/completions works, including a local vLLM or Ollama server
  • Comfort reading HTTP error bodies. Half the signal in this technique lives in responses your client library normally throws away
  • A small budget. Every probe is an 8-token completion, so a full 5-model sweep costs well under a cent on most models

One warning up front: some providers' terms restrict probing or reverse-engineering. Everything here uses documented API parameters and reads documented response fields, but check the terms for the endpoint you point it at.


Step 1: Normalize against a one-character baseline

This is the whole trick, and it is the reason naive token-count comparisons fail.

When you send {"role": "user", "content": "hello"}, the value you get back in usage.prompt_tokens is not the token count of hello. It is the token count of the lab's full chat template with your text substituted in: system preamble, role markers, turn delimiters, sometimes a hidden tool schema. Ox Alpha's wrapper was measured at a fixed +75 tokens over bare GLM-5.3.

So raw counts never match across two hosts, even when the tokenizer underneath is byte-for-byte identical. Two GLM deployments with different system prompts look like two different labs.

The fix is subtraction. Send a one-character prompt first and treat that as your zero:

BASELINE = "a"

# prompt_tokens(text) = template_overhead + tokens(text)
# prompt_tokens("a")  = template_overhead + 1
#
# normalized(text)    = prompt_tokens(text) - prompt_tokens("a")
#                     = tokens(text) - 1
#
# template_overhead cancels. What survives is pure tokenizer behavior.

The residual -1 is a constant, so it cancels again the moment you compare two models. What you are left with is a number that depends only on the tokenizer vocabulary and merge rules, which are built per lab and almost never coincide across labs.


Step 2: A transport that never raises

Standard SDK wrappers raise on 4xx and hand you a cleaned-up message. That is exactly backwards here. The error body is a fingerprint: it was written by that lab's engineers, in their words, with their error-code convention. Use raw requests and keep everything.

import os, time, requests

BASE = os.environ.get("FP_BASE_URL", "https://openrouter.ai/api/v1")
KEY  = os.environ.get("OPENROUTER_API_KEY", "")
BASELINE = "a"

def chat(model, messages, **kw):
    """One raw call. Returns (status, json_body, headers). Never raises on HTTP error."""
    body = {"model": model, "messages": messages, "max_tokens": 8, **kw}
    r = requests.post(f"{BASE}/chat/completions",
                      headers={"Authorization": f"Bearer {KEY}",
                               "Content-Type": "application/json"},
                      json=body, timeout=90)
    try:
        return r.status_code, r.json(), dict(r.headers)
    except ValueError:
        return r.status_code, {"_raw": r.text[:400]}, dict(r.headers)

def prompt_tokens(model, text):
    """usage.prompt_tokens for a pinned text, or None if the host hides usage."""
    st, body, _ = chat(model, [{"role": "user", "content": text}])
    if st != 200:
        return None
    return (body.get("usage") or {}).get("prompt_tokens")

max_tokens=8 on every call keeps this cheap. You never need the completion; you need the accounting.


Step 3: Four tokenizer probes

Four pinned texts, chosen because each one stresses a different part of a vocabulary. Do not paraphrase them once you start collecting data. The texts must be byte-identical across every model you compare, or the whole exercise is noise.

TOK_TEXTS = {
    "tok_english": "The quick brown fox jumps over the lazy dog near the riverbank.",
    "tok_chinese": "\u4eba\u5de5\u667a\u80fd\u6a21\u578b\u7684\u5206\u8bcd\u5668\u51b3\u5b9a\u4e86\u6bcf\u4e2a\u6c49\u5b57\u6d88\u8017\u591a\u5c11\u4e2a\u6807\u8bb0\u3002",
    "tok_code":    "def f(x):\n\tif x is None:\n\t\treturn {'k': [1,2,3]}\n\treturn x**2\n",
    "tok_unicode": "\U0001f9ea\U0001f469\u200d\U0001f4bb\u0915\u094d\u0937 \uff21\uff22\uff23 \u0e01\u0e33",
}

def tokenizer_fingerprint(model, repeat=2):
    """Normalized prompt-token counts. Runs twice; flags 'unstable' on disagreement."""
    base = prompt_tokens(model, BASELINE)
    if base is None:
        return {k: "usage-hidden" for k in TOK_TEXTS}
    out = {}
    for name, text in TOK_TEXTS.items():
        seen = set()
        for _ in range(repeat):
            n = prompt_tokens(model, text)
            seen.add(None if n is None else n - base)
        out[name] = seen.pop() if len(seen) == 1 else "unstable"
    return out

Why these four:

  • English pangram covers the alphabet against the common-English merge table. It is the weakest discriminator on its own, since most labs land within a token or two of each other, but it anchors the others.
  • Chinese paragraph is the strongest single signal. CJK segmentation is where vocabularies diverge hardest, because whether a lab gave Chinese its own merges or fell back to bytes changes the count by 30% or more.
  • Code snippet stresses tab indentation, brace and bracket pairs, and operator merges. Labs that trained heavily on code compress return, None, and dedent sequences differently.
  • Emoji and rare Unicode hits ZWJ sequences, Devanagari conjuncts, fullwidth Latin, and Thai combining marks. This is a direct read on byte-fallback behavior, which is a vocabulary-construction decision, not a tuning knob.

The repeat=2 is not paranoia. If you go through a router, two calls can land on two different hosts with two different system prompts, and the difference will look like a fingerprint when it is actually routing noise. Reporting unstable and dropping the row is strictly better than reporting a number you cannot trust.


Step 4: Error-surface probes

Tokenizers identify the family. The error surface identifies the serving stack, which is often what actually settles an argument. These four are the ones that earned their place during the Ox Alpha week.

def _err_shape(body):
    """A short, comparable signature of an error body -- not the full prose."""
    err = body.get("error") or {}
    if not isinstance(err, dict):
        return "unstructured"
    msg = str(err.get("message", ""))[:60].strip().lower()
    return f"{err.get('type') or err.get('code') or 'err'}|{msg}"

def probe_temperature(model):
    """temperature=2.0 -- the validation prose is written by the lab's engineers."""
    st, body, _ = chat(model, [{"role": "user", "content": "hi"}], temperature=2.0)
    return "accepted" if st == 200 else _err_shape(body)

def probe_max_tokens(model):
    """max_tokens=10**9 -- the refusal usually names the real output ceiling."""
    st, body, _ = chat(model, [{"role": "user", "content": "hi"}], max_tokens=10**9)
    return "accepted" if st == 200 else _err_shape(body)

def probe_error_code_family(model):
    """Numeric, string, or typed? GLM's numeric 1301 is what gave Ox Alpha away."""
    st, body, _ = chat(model, [{"role": "user", "content": "hi"}], temperature=2.0)
    if st == 200:
        return "no-error"
    err = body.get("error") or {}
    if not isinstance(err, dict):
        return "unstructured"
    raw = (err.get("metadata") or {}).get("raw") or err
    coden = raw.get("code") if isinstance(raw, dict) else None
    if coden is None:
        coden = err.get("code")
    return f"{type(coden).__name__}:{coden}"

def probe_finish_reason(model):
    """finish_reason vocabularies differ per lab: length / max_tokens / MAX_TOKENS."""
    st, body, _ = chat(model, [{"role": "user", "content": "Count from 1 to 200."}])
    if st != 200:
        return "error"
    ch = (body.get("choices") or [{}])[0]
    return ch.get("finish_reason") or ch.get("native_finish_reason") or "absent"

PROBES = {
    "temperature_2":     probe_temperature,
    "max_tokens_1e9":    probe_max_tokens,
    "error_code_family": probe_error_code_family,
    "finish_vocabulary": probe_finish_reason,
}

def fingerprint(model):
    fp = tokenizer_fingerprint(model)
    for name, fn in PROBES.items():
        fp[name] = fn(model)
        time.sleep(0.2)
    return fp

A note on _err_shape: it truncates the message to 60 characters and lowercases it. That is deliberate. Full error prose sometimes embeds a request ID or a timestamp, which would make every run look different. You want the stable prefix, not the whole string.

Notice what is not in this list: no personality probes, no censorship probes, no "what model are you" question. During the Ox Alpha week the community ran both and reached opposite verdicts on the same day, because behavior bends to whatever system prompt the host injected. Tokenizers and error handlers do not bend.


Step 5: Score, and refuse to guess

The scoring function has one job beyond counting matches: it must drop any probe where either side returned a non-answer. An honest "I could not measure this" beats a fabricated match.

TOK_KEYS = tuple(TOK_TEXTS)
BAD = {"unstable", "usage-hidden", "error", "absent", None}

def compare(mystery, candidate):
    total = tok_hits = comparable = 0
    for k, v in mystery.items():
        if v in BAD or candidate.get(k) in BAD:
            continue
        comparable += 1
        if v == candidate[k]:
            total += 1
            if k in TOK_KEYS:
                tok_hits += 1
    return {"matched": total, "comparable": comparable, "tokenizer": tok_hits}

def rank(mystery_fp, candidate_fps):
    rows = [(name, compare(mystery_fp, fp)) for name, fp in candidate_fps.items()]
    rows.sort(key=lambda r: (r[1]["tokenizer"], r[1]["matched"]), reverse=True)
    return rows

def report(mystery_name, mystery_fp, candidate_fps):
    print(f"\n{mystery_name} against the crowd's guesses:\n")
    for name, s in rank(mystery_fp, candidate_fps):
        print(f" {s['matched']}/{s['comparable']}  tokenizer {s['tokenizer']}/4   {name}")
    print()

The sort key puts tokenizer first and total matches second. That ordering encodes the actual epistemics: four matching normalized tokenizer counts is a claim about the vocabulary, which is expensive to fake and rarely shared across labs. Four matching error strings is a claim about the serving stack, which two teams at the same company will trivially share.


Step 6: Run it

You can exercise all of this without spending a cent by swapping the transport for a mock. This matters more than it sounds: it lets you unit-test the normalization math, which is the part that silently breaks.

# selftest.py -- offline proof that the baseline subtraction actually cancels
import fingerprint as fp

LABS = {
    "z-ai/glm-5.3":        {"tpl": 12, "tok": {"a":1,"en":14,"zh":26,"code":31,"uni":24},
                            "err": ("int", 1301, "length")},
    "z-ai/glm-4.7-flash":  {"tpl": 9,  "tok": {"a":1,"en":14,"zh":26,"code":31,"uni":24},
                            "err": ("str", "invalid_request_error", "stop")},
    "openai/gpt-5.6-luna": {"tpl": 7,  "tok": {"a":1,"en":13,"zh":33,"code":29,"uni":24},
                            "err": ("str", "invalid_request_error", "length")},
    "x-ai/grok-4.6":       {"tpl": 3,  "tok": {"a":1,"en":13,"zh":38,"code":28,"uni":19},
                            "err": ("str", "invalid_request", "stop")},
}
# the mystery: GLM-5.3's tokenizer behind a much fatter hidden template (+87 vs +12)
LABS["stealth/ox-alpha"] = {"tpl": 87,
                            **{k: LABS["z-ai/glm-5.3"][k] for k in ("tok", "err")}}

def fake_fp(model):
    L = LABS[model]
    counts = {k: L["tpl"] + v for k, v in L["tok"].items()}
    base = counts["a"]
    kind, coden, finish = L["err"]
    return {
        "tok_english": counts["en"] - base,
        "tok_chinese": counts["zh"] - base,
        "tok_code":    counts["code"] - base,
        "tok_unicode": counts["uni"] - base,
        "temperature_2":     f"{coden}|temperature must be in [0, 1]",
        "max_tokens_1e9":    f"{coden}|max_tokens exceeds the model limit",
        "error_code_family": f"{kind}:{coden}",
        "finish_vocabulary": finish,
    }

mystery = fake_fp("stealth/ox-alpha")
cands = {m: fake_fp(m) for m in LABS if m != "stealth/ox-alpha"}

print("mystery fingerprint:")
for k, v in mystery.items():
    print(f"  {k:<18} {v}")
fp.report("mystery model (stealth/ox-alpha)", mystery, cands)

assert mystery["tok_english"] == cands["z-ai/glm-5.3"]["tok_english"], "baseline must cancel"
assert fp.compare(mystery, cands["z-ai/glm-5.3"])["tokenizer"] == 4
assert fp.compare(mystery, cands["x-ai/grok-4.6"])["tokenizer"] == 0
noisy = dict(mystery); noisy["tok_chinese"] = "unstable"
assert fp.compare(noisy, cands["z-ai/glm-5.3"])["comparable"] == 7, "unstable rows must drop"
print("selftest: all assertions passed")

Actual output:

$ python3 selftest.py
mystery fingerprint:
  tok_english        13
  tok_chinese        25
  tok_code           30
  tok_unicode        23
  temperature_2      1301|temperature must be in [0, 1]
  max_tokens_1e9     1301|max_tokens exceeds the model limit
  error_code_family  int:1301
  finish_vocabulary  length

mystery model (stealth/ox-alpha) against the crowd's guesses:

 8/8  tokenizer 4/4   z-ai/glm-5.3
 4/8  tokenizer 4/4   z-ai/glm-4.7-flash
 2/8  tokenizer 1/4   openai/gpt-5.6-luna
 0/8  tokenizer 0/4   x-ai/grok-4.6

selftest: all assertions passed

The mystery model carried a +87 template and GLM-5.3 carried +12, yet tok_english came out at 13 for both. That is the baseline subtraction doing its job. Without it, every row would have been off by 75 and the ranking would have been flat.

Now read the second line, because it is the honest part of the result. glm-4.7-flash also scores 4 of 4 on tokenizers. Of course it does: it is the same lab, so it ships the same vocabulary. The tokenizer evidence narrows you to a family. The error rows are what separate 8/8 from 4/8 within that family, and even those only tell you the two are served off the same stack. This mirrors what modelprint found against the real endpoint, where glm-5.3 took 6 of 9 and glm-4.7-flash took 5 of 9, both with 4 of 4 tokenizers.

To point it at real endpoints, replace fake_fp with fp.fingerprint and pass real model IDs. Budget roughly 12 calls per model.


Worked example: a tripwire for silent alias swaps

Here is where this earns a place in your repo rather than your bookmarks. Providers reuse aliases. deepseek-chat, gpt-4o, claude-3-5-sonnet-latest, an internal gateway route your platform team owns: all of these have pointed at different weights at different times, usually without an announcement. If your eval baselines are pinned to an alias, a swap invalidates them silently.

Snapshot the fingerprint once, then diff it on a schedule:

# watch.py
import json, os, sys
from fingerprint import fingerprint, TOK_KEYS

def snapshot(model, path="fingerprints.json"):
    db = json.load(open(path)) if os.path.exists(path) else {}
    db[model] = fingerprint(model)
    json.dump(db, open(path, "w"), indent=2, ensure_ascii=False)
    return db[model]

def drifted(model, path="fingerprints.json"):
    """Returns a list of changed probes. Empty list means nothing moved."""
    db = json.load(open(path))
    old, new = db[model], fingerprint(model)
    return [(k, old.get(k), new[k]) for k in new
            if old.get(k) != new[k] and "unstable" not in (old.get(k), new[k])]

def verdict(changes):
    tok = [c for c in changes if c[0] in TOK_KEYS]
    if tok:
        return "ALERT: tokenizer moved -- this is a different model family."
    if changes:
        return "WARN: serving stack changed, tokenizer intact -- likely same family."
    return "OK: fingerprint unchanged."

if __name__ == "__main__":
    print(verdict(drifted(sys.argv[1])))

The three-level verdict is the whole design. Output:

>>> verdict([])
OK: fingerprint unchanged.

>>> verdict([("finish_vocabulary", "length", "stop")])
WARN: serving stack changed, tokenizer intact -- likely same family.

>>> verdict([("tok_chinese", 26, 33), ("finish_vocabulary", "length", "stop")])
ALERT: tokenizer moved -- this is a different model family.

A WARN usually means the provider moved you to a different region or upgraded a gateway. Annoying, worth logging, rarely worth re-running your evals. An ALERT means the vocabulary changed underneath a stable name, and every latency number, every cost projection, and every quality baseline you have for that alias is now describing a model you are no longer talking to. Wire the ALERT branch to a non-zero exit code and put it in a nightly job.


Pitfalls

  • Matching fingerprints prove shared infrastructure, not identity. This is the single most important limit, and it is the one every hot take got wrong during Ox Alpha week. A lab can serve two different models on one stack. Read a 4-of-4 tokenizer match as strong evidence about the family, not a signed confession.
  • Through a router, some answers are the router's. OpenRouter, LiteLLM, and internal gateways validate parameters themselves before forwarding. A temperature=2.0 rejection may never reach the lab. When a router does pass the upstream body through, you get the real signal; when it does not, you are fingerprinting the router. Pin to a specific host when the platform offers it.
  • Raw token counts are worthless. If you skip the baseline subtraction, you are measuring the host's system prompt, not the tokenizer. Two deployments of one model will look like two labs, and one model behind two gateways will look like a match to nothing.
  • Never compare across different texts. The probe texts must be byte-identical, including whitespace and newline style. A tab silently converted to four spaces by your editor changes tok_code and quietly poisons every comparison you have ever run.
  • Behavioral probes are not evidence. Asking the model who built it, testing refusal boundaries, counting how chatty it is: all of it bends to a system prompt you cannot see. The community ran censorship and personality probes on Ox Alpha and got opposite verdicts within the same day.
  • Emoji density is a weak signal, not a probe. Ben Davis noted Ox Alpha emitting roughly 1.3 emojis per thousand characters, in line with GLM and Qwen, against near-zero for Claude, GPT-5.6, and Grok. That is a genuinely interesting observation, and it is still an output-style measurement that a system prompt can erase. Use it to generate a hypothesis, never to close one.
  • Handle the honest-absence cases explicitly. Some hosts strip usage, some hide headers behind CORS, some do not support logprobs. Your harness should record usage-hidden and drop the row. A harness that silently coerces a missing value to 0 will produce confident matches between models that share nothing.
  • Rate limits will bite you. Roughly 12 calls per model, times a 12-model lineup, arriving in a burst, is enough to trip free-tier limits. The time.sleep(0.2) is the minimum; back off and retry on 429 rather than recording the 429 as a fingerprint.

Quick reference

ProbeWhat it readsWhy it discriminatesStrength
english pangramnormalized usage.prompt_tokenscommon-English merge tableWeak
chinese paragraphnormalized usage.prompt_tokensCJK segmentation diverges most across labsStrong
code snippetnormalized usage.prompt_tokenstab, brace, and operator mergesMedium
emoji + rare unicodenormalized usage.prompt_tokensbyte-fallback construction choiceStrong
template offsetprompt_tokens("a") itselfsize of the host's hidden wrapperHost, not lab
temperature 2.0validation error prosewritten by the lab's own engineersMedium
max_tokens 1e9refusal messagenames the real output ceilingMedium
error code familyint vs str vs typed codeGLM's numeric 1301 gave Ox Alpha awayStrong
finish vocabularyfinish_reason valuesvocabularies differ per labWeak
header dnacf-ray, x-amzn-requestid, id prefixBedrock vs Vertex vs first-partyStack only
context ceilingbisected accepted prompt size64k / 128k / 200k / 256k+ dates the variantMedium

Next steps

  1. Add a context-ceiling probe. Binary-search the largest prompt the endpoint accepts by padding with a repeated token. The bucket it lands in (64k, 128k, 200k, 256k+) narrows which variant of a family you are on, which the tokenizer alone cannot do.
  2. Add header DNA. Read cf-ray, x-amzn-requestid, openai-processing-ms, and the id prefix on the completion object. These name the serving stack outright. Bedrock, Vertex, and first-party deployments are trivially separable this way, and the probe costs nothing extra since you already captured the headers in chat().
  3. Query the router's ledger. On OpenRouter, GET /api/v1/generation?id=<completion_id> returns the accounting record for a single call, including native_tokens_prompt from the model's own tokenizer rather than the normalized estimate. Native counts skip the baseline math entirely when the router exposes them.
  4. Look at logprob geometry. If the endpoint supports logprobs, the normalized gap between the 2nd and 3rd top logprobs on a pinned continuation sits near a universal constant for full-precision weights. Deviations flag quantization or substitution, which is a different question from identity and often the one you actually care about.
  5. Read the originals. modelprint's probe registry is at github.com/unclecode/modelprint, with every probe as a single file under a documented contract. The paper-side treatment is LLMmap, which formalizes the query-selection problem this technique solves by hand.

The Ox Alpha preview was slated to end around 27 August 2026, and if the pattern from Pony Alpha, Elephant Alpha, and Owl Alpha holds, someone claims it within about two weeks of the drop. By the time you read this the answer may be public. The harness is the part worth keeping.

Comments

Subscribe to join the conversation...

Be the first to comment

Found this useful?

Get new AI guides for builders by email. Free.

Join 3,617 newsletter subscribers.

Also get