Skip to navigation

How to Test an LLM Gateway for Free Before You Trust It

In short: Test an LLM gateway for free with 8 checks: model, tokens, latency, errors, streaming, tools, billing and support. Scripts included, about 51 requests.

Published 39 min read
On this page

An LLM gateway is easy to test and rarely tested. This post gives you an eight-test protocol with a written pass condition for each test, six copy-paste scripts that need nothing beyond the Python standard library, and a request budget: the whole kit sends about 51 requests and fits inside one day of a free tier. Most gateway reviews stop at “is it the right model”. This protocol adds the four checks that break real clients: the shape of a stream, the shape of an error, whether your balance moves when it should, and whether a human answers. We publish this post, and we are one of the gateways it applies to, so the last section grades us on the same eight tests.

Why test a gateway before you send it real traffic?

A gateway sits between your code and the companies that run the models, and it can go wrong in three separate places: what comes back, what you are charged, and what happens when something fails. A test that covers only the first one misses two thirds of the risk.

The research on third-party access services gives the reason to test. A CISPA team audited three of the 17 “shadow APIs” they found cited in 187 academic papers, and reported performance divergence of up to 47.21%, unpredictable safety behaviour and identity verification failures in 45.83% of fingerprint tests. They also noted that 4 of the 17 services had stopped operating by the time of writing. That study is about services that claim to relay official models, not about every gateway, and its numbers are not ours to extend to anyone. But the last point matters for you: a service can disappear, so the right trial is one you can walk away from at no cost.

Our post on cheap reseller risks lists the patterns people have reported, the 12-point provider checklist says what to weigh before choosing, and the explainer on what an LLM gateway is shows where each test below touches the request path. This post is the hands-on part: what to run, in what order, and what a pass looks like. It does not repeat the model-identity audit; that is the job of the six-check verification guide, and Test 1 below points to it. The deep dive on token arithmetic belongs to the token billing audit, so Test 2 is the short version.

What does the 8-test protocol cover?

Each test answers one question, costs a handful of requests and ends in a yes or a no that you decide before you run it.

# Test Question it answers Requests A pass looks like
1 Model field and fallback Does the reply say which model answered, and is any switch disclosed? 5 A stable model value and no unexplained fallback
2 Token growth Do input tokens grow in a straight line with the prompt? 6 Equal tokens per added word at two sizes, small fixed overhead
3 Latency How long until the first token, and how long in total, over many runs? 20 Median and 95th percentile inside the number your product needs
4 Errors Do bad requests fail with the right status, a JSON body and a request id? 5 401, 404 and 400 where expected, and an id on each reply
5 Streaming Does a stream end cleanly, carry usage and survive a hang-up? 2 Finish reason, usage chunk, final [DONE], partial billing on hang-up
6 Tool calls Do streamed tool arguments join into valid JSON? 3 Parsable arguments that match your schema
7 Billing movement Does money move by exactly what the price list says? 10 Usage rows equal your arithmetic; no movement on a $0 id
8 Support reply Does a person answer a specific question? 0 A specific answer, in a time you can live with

The order is not arbitrary. The first six cost nothing and take minutes. Test 7 needs the usage page and a few minutes of patience. Test 8 is slow by nature, so send the email first and run the rest while you wait.

The order of the eight tests

8 Send the support emailit is slow, so start it first1 Model field and fallbackfive identical calls2 Token growththree prompt sizes, two runs each3 Latency20 streamed runs, median and p954 Errorsfive requests that should fail5 Streamingfull read, then an early hang-up6 Tool callsstreamed arguments, parsed7 Billing movementten calls, then the usage page
The support email goes first because the reply time is part of the test. Billing comes last because it needs the request ids the other tests produce.

How do you set up the kit?

Setup takes about five minutes and none of it needs a card.

  1. Open the sign-up page and continue with Google. The account gets $10 of credit for priced models, and the 48 free models work straight away.
  2. Create a key under Keys in the console and keep it in an environment variable. The authentication guide covers scopes and expiry, and the quickstart shows a first call.
  3. Pick one id that ends in :free from the free models list. The scripts use z-ai-glm-5.3:free, whose model page lists its context window; swap in any other free id.
  4. Save the six scripts below as separate files. Each reads the key from the ONEAIAPIKEY_API_KEY variable and sends requests to https://api.oneaiapikey.com/v1.
Set the key and list the ids you can call
export ONEAIAPIKEY_API_KEY="paste-your-key-here"

# Lists the model ids your key can call. Pick one that ends in :free.
curl -sS https://api.oneaiapikey.com/v1/models -H "Authorization: Bearer $ONEAIAPIKEY_API_KEY" | head -c 600

Four ground rules keep the results honest. Use one concrete model id and send no X-Fallback-Models header, so you know which model you asked for. Keep every request id; the error reference explains where it lives, and it is how you find a request again on the usage page or in an email to support. Write each pass condition down before you run the test, because a threshold chosen after you see the number is a rationalisation. And change one thing at a time.

The request budget is small. Test 3 is the only large one, and it is large on purpose.

Requests each test sends (51 in total)

  • 1 Model field and fallback5
  • 2 Token growth6
  • 3 Latency20a percentile needs a sample, so this is the big one
  • 4 Errors5rejected requests, no model work
  • 5 Streaming2
  • 6 Tool calls3run the script three times
  • 7 Billing movement10
  • 8 Support reply0an email, not an API call
The total is 51 requests against a shared free allowance of 100 a day. By our arithmetic, assuming about one token per word, the kit uses roughly 5,500 tokens at most, which is under 0.2% of the 3,000,000 tokens the free lane allows each day.

Test 1: which model answers, and is any switch disclosed?

The first test is deliberately small. Send the same fixed prompt five times at temperature 0 and read two things: the model field in the body and the headers on the reply. The body tells you what the gateway says answered. The headers tell you whether it switched.

Be clear about how weak the first signal is. A model field is text a gateway writes, so a dishonest one can write anything, which is why the verification guide pairs repeated graded prompts and random-choice probes with a baseline you trust. What the field does give you is a consistency check: five identical calls should report one model, and a field that changes between calls is worth a question.

The header is the more interesting half. A gateway that fails over to another model when the first one is down is doing something useful, and the uptime and fallback guide argues you want that. The test is whether the switch is disclosed. On our gateway the model you named is retried up to twice, and when that fails the fallback rules, presets or automatic routing can move the request to another similar model; the reply then carries an X-Fallback-From header naming the model that failed, and the failover rules explain the details. The free lane also retries a failing :free call on another model by itself. So on a free id you may meet that header, and meeting it is not a failure. A model change without the header would be.

Tests 1 and 2: model field, fallback header, token growth
import os, json, urllib.request

BASE = "https://api.oneaiapikey.com/v1"
KEY = os.environ["ONEAIAPIKEY_API_KEY"]
MODEL = "z-ai-glm-5.3:free"

def ask(prompt):
    body = {"model": MODEL, "temperature": 0, "max_tokens": 16,
            "messages": [{"role": "user", "content": prompt}]}
    req = urllib.request.Request(BASE + "/chat/completions", json.dumps(body).encode(),
                                 {"Authorization": "Bearer " + KEY, "Content-Type": "application/json"})
    with urllib.request.urlopen(req, timeout=60) as r:
        return json.load(r), r.headers

# Test 1: which model field comes back, and did a fallback step in?
seen = set()
for _ in range(5):
    data, h = ask("Reply with the single word OK.")
    seen.add(data.get("model"))
    if h.get("X-Fallback-From"):
        print("fallback used, drop this reply:", h["X-Fallback-From"], h.get("X-Request-Id"))
print("model field values:", seen)

# Test 2: do input tokens grow in a straight line with the prompt?
counts = {}
for n in (0, 200, 400):
    counts[n] = sorted({ask("word " * n + "Reply OK.")[0]["usage"]["prompt_tokens"] for _ in range(2)})
print("prompt_tokens by added words:", counts)
base = min(counts[0])
for n in (200, 400):
    print(f"tokens per added word at {n}:", round((min(counts[n]) - base) / n, 3))

Pass condition: one stable model value across five calls, and any X-Fallback-From header explained by what you sent. Drop a fallback reply from every other test, because its answer, speed and tokens belong to a different model. If you have a baseline endpoint you trust, go on to the six checks in the verification guide; they are the right depth for the identity question and this post will not repeat them.

Test 2: do input tokens grow in a straight line?

Token counts are the unit of every bill, so a gateway that reports them wrongly has a billing problem and not a quality problem. The quickest way to see a billing problem is to send prompts of three sizes and compare how the input count grows.

The second half of the script above sends a prompt with 0, 200 and 400 repeated filler words plus a short instruction, twice each, and prints prompt_tokens and the tokens added per word. Two things should hold. First, the line should be straight: the slope between 0 and 200 words should equal the slope between 0 and 400. Second, the slope should match what a local tokenizer says for the same text. An example makes the logic concrete. If the counts come back as 8, 208 and 408, the overhead is 8 tokens, the slope is 1.0 at both sizes and nothing looks odd. If they come back as 8, 260 and 512, the line is straight but the slope is 1.26, and you now have a question for your tokenizer. If they come back as 8, 260 and 700, the line bends, which is a stronger signal that something scales with the prompt.

Be careful with the local count. OpenAI’s tiktoken cookbook says the way tokens are counted from chat messages may change from model to model and calls its helper function an estimate and not a fixed rule; requests that pass function definitions add extra tokens on top. The tiktoken library covers OpenAI encodings, and an open-weight model needs its own published tokenizer. So expect a small constant gap, a few tokens of chat template, and distrust a gap that grows with the prompt. The token billing audit separates the legitimate sources of extra tokens, such as system prompts, tool schemas and cache reads, from the suspicious ones, and the guide to reducing LLM API costs shows how to trim the part that is yours.

Pass condition: equal tokens per added word at both sizes (within a couple of percent), a small fixed overhead, and one prompt_tokens value per prompt across the two repeats. The same value across repeats matters because a count that wobbles for an identical prompt cannot be reconciled with anything.

Test 3: how fast is it, over enough runs to mean something?

Speed is the test people run once and believe. One request tells you almost nothing, because latency is a distribution with a tail. The Google SRE book makes the point with an example: a service with a 100 ms average at 1,000 requests a second can easily have 1% of requests taking 5 seconds, and for a page that calls several such services the 99th percentile of one can become the median of the whole. So measure the median and a high percentile, not the mean.

There are two numbers worth separating. First-token time is how long you wait before text starts, and it is what a person in a chat window feels. Total time is what a batch job or an agent loop pays for each call. The performance metrics page defines both, and the scripts below measure them from your side, network included.

A one-line curl command covers a quick check of the connection and the time to the first byte. The curl manual defines time_starttransfer as the time from the start until the first byte was received, including the time the server needed to calculate the result, and time_total as the full duration. On a non-streamed request the first byte is the whole answer, so this is a sanity check only; the streamed script is the real test.

curl: first byte and total for one small request
curl -sS -o /dev/null \
  -w "status %{http_code}  first byte %{time_starttransfer}s  total %{time_total}s\n" \
  https://api.oneaiapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $ONEAIAPIKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "z-ai-glm-5.3:free", "max_tokens": 20, "messages": [{"role": "user", "content": "Say hello."}]}'
Test 3: 20 streamed runs, median and 95th percentile
import os, json, math, time, statistics, urllib.request

BASE, KEY, MODEL = "https://api.oneaiapikey.com/v1", os.environ["ONEAIAPIKEY_API_KEY"], "z-ai-glm-5.3:free"
RUNS = 20

def one():
    body = {"model": MODEL, "stream": True, "max_tokens": 80, "temperature": 0,
            "messages": [{"role": "user", "content": "Explain DNS in two sentences."}]}
    req = urllib.request.Request(BASE + "/chat/completions", json.dumps(body).encode(),
                                 {"Authorization": "Bearer " + KEY, "Content-Type": "application/json"})
    t0, first = time.perf_counter(), None
    with urllib.request.urlopen(req, timeout=120) as r:
        for raw in r:
            line = raw.decode().strip()
            if not line.startswith("data: ") or line == "data: [DONE]":
                continue
            ch = json.loads(line[6:]).get("choices")
            if first is None and ch and (ch[0]["delta"].get("content") or ch[0]["delta"].get("reasoning_content")):
                first = time.perf_counter() - t0
    total = time.perf_counter() - t0
    return (first if first is not None else total), total

def pct(xs, p):  # nearest rank: the ceil(n * p / 100)-th smallest value
    return sorted(xs)[max(1, math.ceil(len(xs) * p / 100)) - 1]

rows, errors = [], 0
for _ in range(RUNS):
    try:
        rows.append(one())
    except Exception as e:  # a 429 or a timeout is a result too, count it
        errors += 1
        print("error:", e)
    time.sleep(1)

ft, tt = [a for a, _ in rows], [b for _, b in rows]
print(f"ok {len(rows)}  errors {errors}")
print(f"first token  median {statistics.median(ft) * 1000:.0f} ms   p95 {pct(ft, 95) * 1000:.0f} ms")
print(f"total        median {statistics.median(tt):.2f} s    p95 {pct(tt, 95):.2f} s")

How many runs do you need? Enough that the percentile is not just the worst sample. With nearest-rank arithmetic the 95th percentile of 20 runs is the 19th smallest value, so only one run sits above it. That is better than a single number but still thin. The calculator shows how the sample size changes what a percentile means.

What does your percentile rest on?

Percentile is the n-th smallest value, n =
19
Runs above the percentile
1
Reading
Nearly the slowest runs: take more samples

Nearest-rank method, the one used in the script. With 100 runs the 95th percentile has five runs above it.

Two cross-checks make the numbers more useful. First, compare your client-side first-token time with the one on the usage page. The gateway measures from the moment it receives your request, as the performance documentation explains, so the gap between the two is roughly your own network to the gateway. A large gap points at your connection or region, not at the gateway. Second, run the script twice, at two different times of day. Free routes share capacity, so a reading taken in a quiet hour can flatter you. The status page and the rankings show speed measured by us from real traffic, which is a second opinion from the other side, and the export from the usage page has first_token_ms and duration_s columns for your own medians.

Pass condition: you pick it, from what your product needs. A chat window may tolerate a couple of seconds to first token; an overnight batch job may tolerate a minute. Write the number down first, then compare the median and the 95th percentile with it, and count errors as failures: an error in the sample is a result, and the script counts it. We do not publish a speed promise, and the terms say so, which is exactly why you measure.

Test 4: do bad requests fail the way your client expects?

A client library decides what to retry from the status code. The official SDKs retry connection errors, 429 and 5xx a couple of times by default, and treat other 4xx codes as final. A gateway that answers an error with HTTP 200 and an error message in the body breaks that logic without a sound: your retry never fires, or your app treats an error text as an answer.

RFC 9110 defines the vocabulary: a 401 means the request lacks valid authentication credentials, a 404 means the server did not find a current representation for the target. The script sends five requests that should fail, and prints the status, the error code in the body and whether a request id is present, either in the X-Request-Id header or at the end of the message.

Test 4: five requests that should fail
import os, json, urllib.request, urllib.error

HOST = "https://api.oneaiapikey.com"
KEY = os.environ["ONEAIAPIKEY_API_KEY"]
GOOD = {"model": "z-ai-glm-5.3:free", "max_tokens": 5, "messages": [{"role": "user", "content": "Hi"}]}
OWN = "Bearer " + KEY

CASES = [  # name, path, Authorization, body, status the error reference leads you to expect
    ("wrong key",        "/v1/chat/completions", "Bearer not-a-real-key", GOOD, 401),
    ("unknown model",    "/v1/chat/completions", OWN, {**GOOD, "model": "no-such-model-9999"}, 404),
    ("broken JSON",      "/v1/chat/completions", OWN, "{not json", 400),
    ("no messages",      "/v1/chat/completions", OWN, {"model": GOOD["model"]}, 400),
    ("path without /v1", "/chat/completions",    OWN, GOOD, 404),
]
for name, path, auth, body, want in CASES:
    raw = body.encode() if isinstance(body, str) else json.dumps(body).encode()
    req = urllib.request.Request(HOST + path, raw, {"Authorization": auth, "Content-Type": "application/json"})
    try:
        r = urllib.request.urlopen(req, timeout=30)
        status, text, h = r.status, r.read().decode(), r.headers
    except urllib.error.HTTPError as e:
        status, text, h = e.code, e.read().decode(), e.headers
    try:
        err = json.loads(text).get("error", {})
    except ValueError:
        err = {}
    has_id = bool(h.get("X-Request-Id")) or "request id" in text
    print(f"{name:17} got {status} want {want}  code={err.get('code')!r}  request id: {'yes' if has_id else 'NO'}")

The want column comes from our error reference, and you should replace it with the provider’s documented behaviour when you test someone else. What we expect from ours:

Probe Status we expect Why it matters
Wrong key 401 Clients must not retry it, and it must not look like a model error
Unknown model id 404 with the code model_not_found A typo must fail loudly, never fall through to a different model
Broken JSON 400 Tells you your request is wrong, so retrying is useless
No messages field 400 Same lesson, a different field
Path without /v1 404 The classic base-URL mistake gets a message that names the fix

A fifth column is worth adding yourself: whether the failed request was charged. The billing documentation says requests that fail before the model produces anything are not charged, and Test 7 gives you the chance to check that on the usage page. An error that costs money is a billing bug, however well it is formatted.

You can also look at the other family of errors without forcing it. The 429 you would see on a free id past its daily cap carries the code daily_limit_free and a Retry-After header, and MDN’s reference explains the status itself. Do not trigger it on purpose in this kit, since it would spend your day; the rate-limit guide and the post on 429 errors show how to tell the three causes apart when you meet one.

Pass condition: the expected status for each probe, a JSON error object, and a request id on the four requests that reach the model route. A path that never reaches that route has less to report, so judge it on the status and the message.

Test 5: does a stream end cleanly, and what does a hang-up cost?

Streaming is where compatibility claims go to break. The wire format is simple, which is why it is easy to get almost right. The MDN guide to server-sent events says the server must answer with the text/event-stream content type, with each event terminated by a pair of newlines. The WHATWG standard adds that a line starting with a colon is ignored, which is why a well-written parser skips keep-alive comments instead of choking on them. On top of that, the chat format adds its own conventions: content chunks, a chunk with a finish reason, an optional usage chunk with an empty choices array, and a final data: [DONE].

One streamed reply, in order

HTTP 200 and event-streamtext/event-stream plus X-Request-IdContent chunksdelta.content pieces, in orderChunk with finish_reasonstop, length or tool_callsUsage chunk, empty choicesonly if you sent include_usagedata: [DONE]the clean end of the streamEnded early: incompleteretry if you need the whole answer
The documented order on our streaming page. A stream that stops before the finish reason has failed, even though its HTTP status was 200.

Gateways differ here, and not always in the direction you expect. OpenRouter’s documentation, which we read on 28 November 2026, says usage details including cost are always returned automatically and that stream_options.include_usage is deprecated and has no effect on its Chat Completions endpoint. Ours does the opposite: the streaming guide says a streamed chat response has no usage chunk unless you send stream_options.include_usage, and that the request is still metered and billed in full either way, with the counts on the usage page. Neither is wrong. They are two behaviours behind one client library, and a script that expects a usage chunk will pass on one gateway and fail on the other.

Errors mid-stream are the other trap. Once headers are sent the status is already 200, so a later failure cannot change it. OpenRouter’s streaming page says errors after that point arrive as an event in the stream, and ours says the same: an error object inside a data: event, or a stream that ends without a finish reason. The rule for your client is the same on both: treat a stream that ends without a finish reason as incomplete. You cannot force a mid-stream failure on demand, but you can check that your client code has a branch for it.

Test 5: read one stream completely, then hang up on another
import os, json, urllib.request

BASE, KEY, MODEL = "https://api.oneaiapikey.com/v1", os.environ["ONEAIAPIKEY_API_KEY"], "z-ai-glm-5.3:free"

def open_stream(prompt, max_tokens):
    body = {"model": MODEL, "stream": True, "stream_options": {"include_usage": True},
            "max_tokens": max_tokens, "messages": [{"role": "user", "content": prompt}]}
    req = urllib.request.Request(BASE + "/chat/completions", json.dumps(body).encode(),
                                 {"Authorization": "Bearer " + KEY, "Content-Type": "application/json"})
    return urllib.request.urlopen(req, timeout=120)

# Part A: read a whole stream and check its shape
r = open_stream("Write one sentence about rivers.", 60)
print("content-type:", r.headers.get("Content-Type"), "| request id:", r.headers.get("X-Request-Id"))
lines = [raw.decode().strip() for raw in r if raw.strip()]
chunks = [json.loads(x[6:]) for x in lines if x.startswith("data: ") and x != "data: [DONE]"]
finish = [c["choices"][0]["finish_reason"] for c in chunks if c.get("choices") and c["choices"][0].get("finish_reason")]
usage = [c for c in chunks if c.get("usage")]
print("last line is [DONE]:", lines[-1] == "data: [DONE]")
print("finish_reason seen:", finish)
print("usage chunk has empty choices:", bool(usage) and usage[-1].get("choices") == [])
print("usage:", usage[-1]["usage"] if usage else None)
print("text:", "".join(c["choices"][0]["delta"].get("content") or "" for c in chunks if c.get("choices"))[:80])

# Part B: hang up early, then look this request id up on the usage page
r = open_stream("Count from 1 to 300, one number per line.", 400)
rid = r.headers.get("X-Request-Id")
for i, _ in enumerate(r):
    if i >= 8:
        break
r.close()
print("hung up early, request id:", rid)

Part B of the script is the more telling half. It opens a stream asking for a long answer, reads a few lines and hangs up. Our documentation says the gateway then closes the request to the provider and bills the tokens produced up to that point, not the full max_tokens. OpenRouter’s page says its cancellation works only for streaming requests with supported providers, and that for others the model keeps processing and you are billed for the complete response. That is a detail you cannot learn from a feature list and can learn from this test: after the script runs, find its request id on the usage page and read the output token count. It should be far below 400.

If your own server relays the stream, add one more check: turn buffering off. The streaming guide notes that a buffering proxy delivers the text in one lump at the end, which looks like a slow first token when it is really your proxy. The streaming comparison and the guide to streaming tokens to a browser cover the client side.

Pass condition: text/event-stream content type, a finish reason, a usage chunk with empty choices when you asked for one, [DONE] as the last line, and a usage-page row for the hung-up request that shows partial output.

Test 6: do streamed tool calls arrive as valid JSON?

Agents live on tool calls, and streaming splits a tool call into pieces. In the chat format the arguments arrive in fragments under delta.tool_calls, keyed by an index, and you must join the fragments before you parse them. The streaming guide says the same: parse only after the call is complete. A gateway that mangles the fragments, drops the index or sends invalid JSON produces an agent that fails one run in twenty, which is the hardest kind of failure to debug.

The script defines one tool, asks the model to use it, assembles the fragments and checks that the result parses and holds the required key. Choose a model whose page lists tool calling, and set it with the TOOL_MODEL environment variable; the tool calling guide shows what the gateway passes through, and the models page lists capabilities per id. Run the script three times, since a single success proves little.

Test 6: stream a tool call and parse its arguments
import os, json, urllib.request

BASE, KEY = "https://api.oneaiapikey.com/v1", os.environ["ONEAIAPIKEY_API_KEY"]
MODEL = os.environ.get("TOOL_MODEL", "MODEL_ID_THAT_LISTS_TOOL_CALLING")
body = {"model": MODEL, "stream": True, "max_tokens": 200, "tool_choice": "auto",
        "tools": [{"type": "function", "function": {
            "name": "get_weather", "description": "Get the weather for a city",
            "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}],
        "messages": [{"role": "user", "content": "Use the tool to get the weather in Pune right now."}]}
req = urllib.request.Request(BASE + "/chat/completions", json.dumps(body).encode(),
                             {"Authorization": "Bearer " + KEY, "Content-Type": "application/json"})
calls = {}
with urllib.request.urlopen(req, timeout=120) as r:
    print("X-Tools-Dropped:", r.headers.get("X-Tools-Dropped"))
    for raw in r:
        line = raw.decode().strip()
        if not line.startswith("data: ") or line == "data: [DONE]":
            continue
        for ch in json.loads(line[6:]).get("choices", []):
            for tc in ch["delta"].get("tool_calls") or []:
                slot = calls.setdefault(tc["index"], {"name": "", "args": ""})
                fn = tc.get("function") or {}
                slot["name"] += fn.get("name") or ""
                slot["args"] += fn.get("arguments") or ""
if not calls:
    print("no tool call came back")
for i, c in sorted(calls.items()):
    try:
        args = json.loads(c["args"])
        verdict = "VALID" if "city" in args else "MISSING city"
    except ValueError:
        args, verdict = c["args"], "BROKEN JSON"
    print(i, c["name"], args, verdict)

The script also prints the X-Tools-Dropped header. On our gateway, if a model refuses tool calling, the request can be resent without the tools, and the reply then carries X-Tools-Dropped: 1, listed in the headers reference. We would rather the edit be visible than silent, and you should ask the same of any gateway: a reply that arrives without tools should say that it did. The verification guide has a different tool check, one that sets tool_choice to none and expects no calls; run it as well if your agent can touch files or money. Whichever gateway you use, enforce permissions in your own client, and give each tool its own key with a spend limit, as the coding agent key guide describes.

Pass condition: every run returns at least one call, the joined arguments parse, the required key is present, and a dropped-tools header, if it appears, is explained.

Test 7: does your money move by exactly what the price list says?

This is the test that matters most for trust, and the one reviews skip, because it needs patience and a second window. The idea is simple: send a known number of requests, compute what they should cost from the published prices, and compare with what the gateway recorded.

Start with the usage page, not the balance. Our billing documentation says the balance is rounded down to the cent, so the console never shows money you do not have. That is a sensible rule and a trap for testing: a handful of small requests costs a fraction of a cent and the balance will not visibly move. The usage page lists every request with its tokens and cost, and you can export it as a CSV, up to 5,000 rows per export. Read the per-request cost there. Replies also carry a cost field inside usage, in US dollars, but only when the exact amount is known at that point; the cost control guide lists when it is left out. OpenRouter’s usage accounting page describes a comparable cost field in every response, so it is a feature worth asking any gateway about.

Test 7: ten requests, with totals to reconcile
import os, json, time, urllib.request

BASE, KEY, MODEL = "https://api.oneaiapikey.com/v1", os.environ["ONEAIAPIKEY_API_KEY"], "z-ai-glm-5.3:free"
RUNS = 10
tokens_in = tokens_out = 0
cost_in_replies, missing = 0.0, 0
ids = []
started = time.strftime("%H:%M:%S UTC", time.gmtime())
for _ in range(RUNS):
    body = {"model": MODEL, "temperature": 0, "max_tokens": 40,
            "messages": [{"role": "user", "content": "Reply with exactly: ok"}]}
    req = urllib.request.Request(BASE + "/chat/completions", json.dumps(body).encode(),
                                 {"Authorization": "Bearer " + KEY, "Content-Type": "application/json",
                                  "X-Client-Request-Id": f"billing-test-{int(time.time())}-{len(ids)}"})
    with urllib.request.urlopen(req, timeout=60) as r:
        data = json.load(r)
        ids.append(r.headers.get("X-Request-Id"))
    usage = data["usage"]
    tokens_in += usage["prompt_tokens"]
    tokens_out += usage["completion_tokens"]
    if usage.get("cost") is None:  # the reply leaves cost out when it cannot know it exactly
        missing += 1
    else:
        cost_in_replies += usage["cost"]
    time.sleep(1)
print(f"started {started}, {RUNS} requests, input {tokens_in} tokens, output {tokens_out} tokens")
print(f"cost in replies: {cost_in_replies:.6f} USD ({missing} replies without a cost field)")
print("request ids:", *ids, sep="\n  ")

The script sends ten identical requests, each tagged with an X-Client-Request-Id of your own (the headers reference says it is for feedback and request lookup), and prints the token totals, the cost the replies reported and the gateway request ids. Wait a minute after it finishes, because a finished request and its balance entry do not always land in the same second. Then open the usage page, filter to the time window and add up the cost column.

Expected cost against billed cost

Expected cost
$0.0022
Billed minus expected
$0.0000
Expected cost per request
$0.0002
Requests before the balance shows one cent
47
rounded down to the cent, so use the usage rows below that
Reading
Matches to rounding

The default prices are an example, not any provider's rate, and the default run is the shape of the script's ten calls at an assumed 120 input and 150 output tokens each. Enter the real prices from the model's page and the totals your script printed.

The defaults show why the usage rows matter. At those example prices ten requests cost $0.00216, about a fifth of a cent, and it would take 47 such requests before a balance rounded down to the cent could change by even one cent. If you watched only the balance you would conclude nothing happened.

What the result means depends on the kind of id you used:

  • A free id (ending in :free). It bills $0 per token, so the right result is no movement at all: cost 0 on every row and an unchanged balance. If your balance falls on a :free call, that is a finding and a good reason to write to support with the request ids. The free lane is paid for by the shared daily allowance of 100 requests, not by your credit, as the no-card guide explains.
  • A priced id. Now the arithmetic bites. Take the input and output prices from the model’s page, multiply by the totals, and expect the usage rows to match to rounding. Prices are per million tokens, and output costs several times more than input on most models, so a long answer is where the money goes. The cost calculator does the same sum, and the monthly cost guide scales it up.
  • The errors from Test 4. Find those request ids too. The rejected requests should show no cost, because a request that fails before the model produces anything is not charged.

On the money test for priced ids, be honest about the setup. The $10 of sign-up credit is for priced models, but which priced ids are open changes, and the model list marks each one. Paid access beyond the credit is set up by hand, offline: pick a model, see the prices on the pricing page, and email somdutt777@gmail.com to buy access. If you do run a priced test, put it on a key with a small spend limit. A limit set under Keys in the console stops that key when it is used up and leaves your balance and other keys alone, so a bug in your script cannot spend more than you allowed. The prepaid credit guide covers how to limit what you put at risk, and the gateway fee comparison shows what other gateways add on top of the token prices you are checking.

Pass condition: the usage rows equal your arithmetic to rounding, the balance change equals the usage total once it is large enough to show, rejected requests show no cost, and a $0 id moves nothing.

Test 8: does a person answer a specific question?

Software tests cannot tell you what happens when something goes wrong at three in the afternoon. A support test can, at least a little. It is also the only test where the gateway can respond with judgement, so it earns its place.

Send an email with three questions, one of which refers to a real request id from your tests. The template below does it. Question 1 tests whether the support team can look up a request and say something specific. Question 2 tests whether prices and the buying process are stated plainly, which is how a seller behaves when it expects to be checked. Question 3 tests whether the answer to “what if you stop working” is a straight one.

A three-question support email
Subject: Questions before I add credit (request id REQUEST_ID)

Hello,

1. Request REQUEST_ID (model MODEL_ID, DATE and TIME in UTC) came back with
   STATUS_OR_SYMPTOM. What did the gateway record for it?
2. What are the input and output prices per 1M tokens for MODEL_ID, and how
   do I add credit?
3. If a model on your list stops answering, what happens to my balance?

Thank you.

Record when you sent it and when the reply arrived, then grade the reply against four points:

  1. It answers each numbered question, in order, not with a generic paragraph.
  2. It uses specifics: the request record, the actual prices, the actual steps.
  3. It says what it cannot tell you, instead of reassurance.
  4. It does not push you to pay before it has answered.

What should you expect from us? The transparency page says a reported problem is read, checked and answered, that every case is decided one by one and that a genuine concern is the bar. It also says plainly what we do not promise: a bit-identical match to the maker’s endpoint, visibility into a provider’s hardware, constant speed. We publish no response-time promise, so we cannot tell you a number, and you should not trust any number a seller prints without a method behind it. Measure it yourself. Our paid access is bought by email, which means you talk to a person before you pay; that is slower than a checkout button and it is also a built-in way to run this test. Usage that has already been consumed is final, and a technical fault on our side is looked at case by case, as the terms set out. Write to support@oneaiapikey.com for a problem with a request, and to somdutt777@gmail.com to buy access.

Pass condition: a reply that meets all four grading points, in a time you can live with, which you decided beforehand.

How do you score the results?

Put the eight results side by side before you decide anything. One odd result has many innocent explanations. Three that point the same way are a pattern.

Your scorecard: tick each test that met its pass condition

0 of 8 tests passed

Not ready

Do not route traffic yet. Fix or explain the failures first.

When a test fails, the table below says what it usually means and what to do next. It is a guide to the most likely cause, not a verdict.

What you saw Likely cause What to do next
model value changes between identical calls A fallback or a mixed pool behind one id Check the fallback header; ask which models serve the id
Tokens per added word differ between sizes Padding or counting that scales with the prompt Repeat on another day; compare with a local tokenizer; ask
Median fine, 95th percentile far worse Queueing at busy times on a shared route Test at two times of day; add a fallback id
200 where a 4xx was expected Errors returned as answers Do not rely on SDK retries; report it with the request ids
Stream ends without a finish reason Dropped upstream connection Treat as incomplete in code; retry; report a pattern
Tool arguments fail to parse Fragments joined wrongly or a weak tool model Try another model; test the gateway with a second id
Balance moves on a $0 id, or rows differ from arithmetic A billing fault Stop adding money; send request ids and the usage export
No reply, or a generic one Support is a mailbox, not a service Weigh that against the price before you commit

Which test first, given what worries you?

I fear a swapped model

Run Test 1, then go to the six-check verification guide. The CISPA study is the reason to take it seriously: its audited services diverged from the official ones by up to 47.21%.

I fear a padded bill

Run Tests 2 and 7 together. Token growth catches padding that scales with the prompt, and billing movement catches a charge that does not match the price list. The token billing audit goes deeper on the arithmetic.

I fear slowness at busy times

Run Test 3 at two times of day and compare with the status page. Then read the uptime and fallback guide to set a second route.

I fear my agent will break

Run Tests 5 and 6 with the model your agent uses. Then read the coding agent key guide and give the agent its own key with a spend limit.

I fear nobody will answer

Send the Test 8 email now and run the rest while you wait. If the answer is slow or generic, you have learned what a problem will feel like at three in the afternoon.

How does One AI API Key do on the same eight tests?

We publish this post, so treat this section as our answer sheet and check it against the scripts, not against our word. Where another gateway is stronger, we say so.

Test What you can check on our service What we do not promise
1. Model field and fallback The model field, and an X-Fallback-From header whenever a fallback answers; the failover rules A match to the maker’s own endpoint, bit for bit
2. Token growth usage in every reply, and input, output and cached tokens per request on the usage page A count equal to your local tokenizer to the digit
3. Latency First-token time and duration per request in the usage page and CSV; probes on the status page Promised speed or uptime: the terms offer none
4. Errors A documented status table, JSON error objects, a request id on gateway errors; the error reference Identical error text to any other provider
5. Streaming Documented event format, usage on request, billing for partial output after a hang-up; the streaming guide A usage chunk you did not ask for
6. Tool calls Pass-through of tool calls, and X-Tools-Dropped: 1 when tools were removed Tool support on every model id
7. Billing movement Per-request cost on the usage page, usage.cost in replies when exact, a balance rounded down; free ids bill $0 Online checkout: credit is added by email today
8. Support reply An inbox, a reporting procedure on the transparency page, case-by-case review A published reply time

Beyond the table, three limits are worth stating, because a trial should tell you what it cannot show. We do not host any model today; every model is served by an upstream provider, so we can measure what comes back but not what runs behind it. No scheduled job scores our routes against official endpoints; the transparency page lists what we monitor and what each monitor cannot see. And free models are served by upstream providers that can change, so the free lane suits building and testing, not production.

Where do rivals do better? OpenRouter, for one, returns usage and cost in every response without a flag, according to its documentation, which makes Test 7 easier there than here. Larger, older gateways have also had more traffic to harden against; where one of them beats us on a test above, believe the test and not us. The comparison with OpenRouter is dated and sourced, and the list of OpenRouter alternatives and the guide to migrating from OpenRouter put the differences in model ids and fallbacks side by side. If you would rather run the proxy yourself, LiteLLM against a hosted gateway puts a number on the effort, and LiteLLM alternatives goes through the options. If you are weighing gateways in general, the nine-option gateway table and the Helicone alternatives guide apply the same kind of checks to others. The honest summary of our position is narrow: free account by Google sign-in, $10 of sign-up credit for priced models, 48 free ids within 100 requests a day, prices published, paid access by email, usage numbers public on the rankings page. That is enough to run every test above before you pay anything.

What should you do with the results?

Keep the output files. A run you did not save cannot be compared with the next one, and the comparison is where the value is. Date each file, name the model id, and store the request ids with it. If something fails, the evidence packet is already written: the id, the time in UTC, the script output and the usage-page row.

Then decide in this order. If Tests 1, 2 and 7 are clean, the identity and the bill are at least consistent with the price list, and you can add a small balance. If Tests 4 to 6 are clean, your client code will behave the way you wrote it. If Test 3 is fine at one hour and bad at another, add a second route before you add traffic. A price that looks too good to be true needs Test 7 most, and the arithmetic of flat monthly plans shows why. The relay setup checks cover a separate risk, running someone else’s installer; our setup is an environment variable and a base URL, with no installer to run. The privacy guide says what the gateway sees while you test, and the review of One AI API Key says what you get and what you do not.

Finally, remember what the kit cannot do. It cannot see inside a provider, it cannot prove next month, and it cannot replace the habit of keeping a second route ready. If you are on another gateway today and a change at its owner makes you want a spare key, the notes on what changes when OpenRouter joins Stripe list what to watch.

Run the eight tests on a free model

$10 sign-up credit, 48 free models sharing 100 requests and 3,000,000 tokens a day, no card.

Frequently asked questions

Can I really test an LLM gateway without paying?
Yes, if the gateway has a free tier you can call without adding a card. Here that is a Google sign-in, a free key and 48 model ids ending in :free that bill $0 per token. The eight tests use about 51 requests and well under 6,000 tokens, inside the shared 100 requests and 3,000,000 tokens a day. The no-card guide compares the free tiers of other providers, so you can run the same kit against them.
How many runs do I need before a result means anything?
It depends on the test. Token counts and error codes are close to deterministic, so two or three runs show the pattern. Latency is a distribution, so take at least 20 runs and report the median and the 95th percentile, as the calculator above explains. Identity checks need many more, and the six-check verification guide says how many.
Will the tests use up my daily free allowance?
They use just over half of it. The kit sends 51 requests against a shared allowance of 100 a day, so run it once a day, not twice. The allowance refills at 00:00 UTC, which is 05:30 in India, and a request past the cap gets a 429 with the code daily_limit_free, as the error reference shows.
Should I also test with a priced model?
Yes, once, before you route real traffic to one. The free ids bill $0, so they cannot show that a charge matches the price list. The model list marks which priced ids are open, and a per-key spend limit (see cost control) keeps a mistake small. Paid models are set up by hand, offline: see the prices on the pricing page, then email somdutt777@gmail.com to buy access.
If every test passes, can I trust the gateway?
You can say it passed eight checks on one day, and that is useful, but it is evidence and not a certificate. A route can change next month, a gateway can serve different hardware to a different customer, and software tests cannot see inside a provider. Repeat the kit monthly and after any change, keep the output, and read what the gateway says it cannot promise: for us, that is the ledger on the transparency page.
What do I do if a test fails on your service?
Keep the request id from the X-Request-Id header, the exact script output and the time in UTC, then email support@oneaiapikey.com. The reporting steps say what to include. We read each report and decide case by case; the terms hold the rules, including that no uptime or speed is promised.
Do I need Python to run the scripts?
No. They use only the Python standard library, so there is nothing to install, but the logic is short enough to port: send a request, read the headers, parse lines that start with data: , compare the numbers. If you prefer an SDK, the official OpenAI Python SDK returns headers through with_raw_response, as the headers reference shows.
Does streaming cost more than a normal request?
Not here. The streaming guide says a stream costs the same tokens as a normal request. Streaming only changes when the text arrives. If you hang up early you pay for the tokens produced up to that point, which is what part B of the streaming script lets you check on the usage page.
How often should I repeat the tests?
Monthly for a production route, and again after a model announcement, an SDK upgrade or a change in your prompts. A small cron job that runs the latency and error scripts daily and writes the output to a file costs nothing on a free id and gives you the history that a single run cannot. The uptime and fallback guide covers what to do when the history shows a decline.
More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →