如何從外部驗證模型閘道不是空殼:五項檢查
How to verify a gateway is not a shell: five checks from the outside
作者提出五項外部檢查,從 token 用量、串流節奏、模型特有行為、資料目錄,以及錯誤和可用性回報,辨別模型閘道是否只是空殼。例如以 200-token 和 2,000-token 提示詞比較 usage,並核對模型上下文窗口、能力標記、分級價格及來源連結是否與官方文件一致。這些檢查不能判斷價格是否公平,也不能證明某次請求按所列價格計費;作者指出後者須查閲發票。
Anyone can put an OpenAI-compatible endpoint in front of a queue and answer requests. The hard part is proving that a specific request actually reached the model whose name is in the model field, at the context length and price the seller advertised. The difference between a reseller and a shell is invisible in the happy path — both return a plausible paragraph — so verification has to come from the edges.
Below are the five checks we use before trusting a gateway, each runnable in a few minutes with curl and a spreadsheet.
Check 1: token accounting has to scale
Every OpenAI-compatible response carries a usage block. A real upstream metered its own tokens; a shell either hardcodes a plausible number or estimates with a crude word count. The test is simple: send the same question with a 200-token prompt and again with a 2,000-token prompt padded with harmless filler.
curl -s https://your-gateway.example/v1/chat/completions \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"model":"gpt-5.4","messages":[{"role":"user","content":"'$PAD' Summarise the padding above in one line."}]}' \
| jq '.usage'
Expect prompt_tokens to move roughly tenfold and completion_tokens to stay close to constant. If the count barely moves, the gateway is not tokenising what it received. If the numbers are identical across two different prompts, they are generated, not measured.
Check 2: streaming has cadence, not a burst
Time to first token (TTFT) is where shells give themselves away. A shell that waits for the upstream to finish and then relays the whole body looks fine in total latency but arrives as one burst: TTFT is almost equal to total duration. A real streaming upstream sent the first token seconds before the last.
Measure it by timestamping each SSE chunk. On a 500-token answer, genuine streaming shows a first delta well ahead of completion and steady increments; a buffered relay shows every delta inside the final 200 milliseconds. This check needs no access to the seller's infrastructure and catches the most common cheap implementation.
Check 3: model-specific edges must survive
Shells route everything to one underlying model and paper over the differences. Edge cases expose it:
- Long context. A model advertised at 400k tokens must accept a 300k-token prompt without truncation. A 32k-backed shell silently drops the middle or returns a context-length error it attributes to you.
- Tool calls. The exact shape of
tool_calls, the id format, and how parallel calls are numbered differ per provider. A translator that rewrites one schema into another leaks artefacts. - Reasoning and media. Whether a
reasoning_contentfield exists, whether image input is accepted at all, and whatfinish_reasonappears on a refusal are all model-specific.
Pick two cheap checks per provider family and run them once. A shell passes neither.
Check 4: the metadata surface has to hold up against official docs
This is the check that takes the longest to fake, because it is cumulative. A gateway that carries 336 models has to publish, per model, the context window, capability flags, the official price and its tiers, and a source link — otherwise its buyers cannot price anything. Our own model reference pages are the version of that surface we are willing to be judged on: one page per model, official price with tiers, and a source link per entry.
| What a shell shows | What a real gateway shows |
|---|---|
| A model list that stops at the popular 20 | Every model it can actually route, with a page each |
| One price per model, no tiers | Input and output priced separately, plus per-image / per-second units |
| No source links | A link back to the provider's own documentation per model |
| Context limits copied into marketing copy | Context limits stated on the model's own page, next to the price |
Cross-check three models from the list against the provider's official docs. If the context window, the unit and the tier all match, the catalogue is maintained by someone reading primary sources.
Check 5: failures are specific, and uptime is measured
Error behaviour is a fingerprint. A real upstream returns a 429 with Retry-After and a provider-shaped message, a 400 that names the offending parameter, a 401 that distinguishes "bad key" from "key lacks this model". A shell returns a generic body, often a 500 for everything, because it has only one code path.
Availability claims deserve the same scepticism. An uptime figure that is 100% for every model is marketing. What we publish on the status page is availability derived from real buyer calls per model family, and it shows "no data" where no buyer has called — which is the honest answer, and not one a dashboard vendor would choose to print.
What these checks do not prove
They catch shells. They do not prove that a price is fair, that a seller's margin is reasonable, or that a model is good. Those are separate questions, answered by comparing published per-model prices side by side and by reading each model's own reference page. Nor do they prove a specific request was billed at the price shown — only your invoice can do that.
A gateway is a scheduling and billing system, not a name in a JSON field. The five checks above test the parts that a shell cannot fake cheaply: metering, streaming shape, per-model edges, a maintained catalogue, and honest failure reporting. If a seller passes all five and still quotes a price you like, you are probably buying something real. The FAQ covers the billing questions that usually follow.
來源:DEV Community · dev.to