Get API key

GetAiApiKeyArtificial Intelligence API Checklist for Production

AI API Key Tester: Check a Key in 30 Seconds

You do not need a website to act as an ai api key tester. A single curl call, or six lines of Python, tells you whether a key is valid, whether the model answers and how much balance is left.

Updated

Key inserted into a console with three green indicator lights, representing an API key check

Key points

  1. Call GET /v1/models first: it proves the key and the base URL without spending tokens on a completion.
  2. A one-token chat call proves the model works, and X-Balance-USD shows your balance.
  3. Never paste a live key into an unknown online checker; test locally.
  4. Common failures come from a wrong base URL, a missing Bearer prefix or a limit.

Why test locally instead of on a web page

Searching for an ai api key tester turns up many pages where you paste a key and press a button. Avoid them. A key is a password that spends your money, and you cannot know what such a page does with it. The tests below take half a minute, run on your own machine, and send the key only to the API you want to use.

You need three things: the key, the base URL https://api.getaiapikey.com/v1, and the model ID uncensored. Put the key in an environment variable so it does not end up in your shell history or in a file you might commit.

export API_KEY="paste-your-key-here"

Keys come from the API key page. If you do not have one yet, new users can claim $0.50 of trial credit there with one click after sign-up, which is enough for every test in this article many times over.

Check 1: list models with curl

The cheapest test is the model list. It needs a valid key and a correct base URL, and it does not generate any text.

curl -i https://api.getaiapikey.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

The -i flag prints the response headers. A healthy answer starts with HTTP/2 200 and a JSON body that includes the model ID uncensored. If you see an authentication error instead, usually status 401, the key is wrong, was copied with a trailing space, or the header is missing the word Bearer. A 404 means the URL is wrong, most often a missing /v1 or a doubled one.

Check 2: run one real completion

A key can be valid and still fail on a real request, for example because the balance is empty. So send a tiny chat call and cap the output to keep the cost near zero:

curl -i https://api.getaiapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","max_tokens":5,"messages":[{"role":"user","content":"Say ok."}]}'

Read the headers before the body. X-Request-Id identifies the call, which is what support asks for. X-Balance-USD shows how much credit remains. X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency reveal the limits of your key: 300 and 8 for a full key, 60 and 2 for a trial key. That one call therefore checks authentication, the model, the balance and the key type.

The price of the test is negligible. A prompt of about 10 tokens and a reply of 5 tokens costs 10 x $0.15 / 1M + 5 x $0.50 / 1M, which is about $0.000004. Failed or refused requests are not charged at all.

Check 3: the same test in Python

If your real code uses Python, test it the way the code will run. This script uses the official openai package, so a pass here means your application setup works too:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.getaiapikey.com/v1",
    api_key=os.environ["API_KEY"],
)

raw = client.chat.completions.with_raw_response.create(
    model="uncensored",
    max_tokens=5,
    messages=[{"role": "user", "content": "Say ok."}],
)
print("status:", raw.status_code)
print("balance:", raw.headers.get("X-Balance-USD"))
print("req/min limit:", raw.headers.get("X-RateLimit-Limit-Requests"))
print("concurrency limit:", raw.headers.get("X-RateLimit-Limit-Concurrency"))
print("reply:", raw.parse().choices[0].message.content)

The with_raw_response wrapper gives access to the headers while parse() returns the usual response object. Python setup itself is covered in how to install an LLM client in Python if the import fails.

Check your balance without a completion

To read the balance without generating text, call one of the balance endpoints. There is an OpenAI-style one and a short one:

curl https://api.getaiapikey.com/v1/balance \
  -H "Authorization: Bearer $API_KEY"

curl https://api.getaiapikey.com/v1/dashboard/billing/credit_grants \
  -H "Authorization: Bearer $API_KEY"

Tools that already expect the OpenAI credit-grants format can use the second path unchanged. Add a call like this to a monitoring script and you get a warning before a production bot runs dry. Top-ups start at $20 and credit never expires, so there is no penalty for keeping a comfortable reserve. Amounts and bonuses are on the pricing page.

Turn the test into a health check

Once the key works, keep the test. A small script that runs on a schedule tells you about a bad deploy, an expired secret or a low balance before your users do. Here is a Node version using the built-in fetch (Node 18 or later):

const base = "https://api.getaiapikey.com/v1";

async function check() {
  const res = await fetch(`${base}/chat/completions`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "uncensored",
      max_tokens: 5,
      messages: [{ role: "user", content: "Say ok." }],
    }),
  });
  const balance = Number(res.headers.get("X-Balance-USD"));
  console.log(res.status, "balance:", balance);
  if (res.status >= 400 || balance < 5) process.exitCode = 1;
}

check();

The script exits with a non-zero code when the call fails or the balance falls under $5, so a cron job or CI step can alert you. Pick the threshold from your own burn rate: at $2 a day, $5 gives you a little over two days of warning.

What a passing test does not prove

A green check shows that auth, routing and the model work at that moment, at low load. It does not show how your application behaves with 20 users at once. For that, remember the limits: a full key runs 8 requests at the same time, and streamed requests keep their slot until the stream ends. Load-test your own code with a cap on parallel calls before launch.

Reading failures

What you seeMost likely reasonWhat to do
Authentication error, often 401Wrong key, extra whitespace, no Bearer prefixRe-copy the key, check the header string
404 or HTML instead of JSONWrong base URLUse exactly https://api.getaiapikey.com/v1
Model not foundDifferent model ID in the requestSet model to uncensored
429 with rate_limited or concurrencyToo many requests per minute or at onceWait, then retry with a delay
429 with Retry-After: 5Temporary overloadWait 5 seconds and retry
Connection or timeout errorNetwork, proxy or firewallTest from another network, check proxy variables

Requests above 8 MB are rejected, so if only large calls fail, check the body size. The documentation lists all error codes and headers.

Good habits for handling a key

  • Keep the key in an environment variable or secret store, never in client-side code, a public repository or a screenshot.
  • Use one key per application where you can, so a leak is easy to trace and replace.
  • If a key might have leaked, replace it, then look at the balance for unexpected spend.
  • Do not share a trial key between several programs: with 2 concurrent requests it will hit limits fast.

If you only want to see whether a free option exists before you sign up, the article on a free LLM API key explains what is available. Otherwise, the three checks above are all the testing a key needs.

Questions and answers

Is there an official online key tester?

You do not need one. GET /v1/models plus one small chat call, run from your own machine, checks the key, the model and the balance without exposing the key to a third party.

Does testing a key cost money?

A short call with max_tokens set to 5 costs a few millionths of a dollar. Failed or refused requests are not charged.

How do I tell a trial key from a full key?

Read the X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency headers. A trial key shows 60 and 2, a full key shows 300 and 8.

My key works in curl but not in my app. Why?

Compare the base URL, the model ID and the Authorization header in your app with the curl call. The usual culprits are a missing /v1, a trailing space in the key and an old environment variable.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.