EN ▾

OpenAI-compatible uncensored LLM APIuncensoredapis.com

HomeAgents

OpenAI-Compatible API Tester: Verify Any Endpoint

Terminal sending test requests to an API gateway cube, each returning a green check mark

You do not need a special openai compatible api tester to check an endpoint. Four requests and a short Python script tell you whether a base URL really behaves like the OpenAI API.

Updated

Key points

  1. Start with GET /v1/models, then one minimal chat completion.
  2. Test streaming and read the usage at the end of the stream.
  3. Send bad requests on purpose to see how errors look.
  4. One script can run all checks and print pass or fail.

The four checks that matter

Many services say they are OpenAI-compatible. Some copy only the chat route, some change the error format, some drop streaming details. A tester should confirm what your client code relies on:

  1. Auth and discovery: GET /v1/models with a Bearer key.
  2. A minimal chat completion: POST /v1/chat/completions.
  3. Streaming: the same call with stream: true.
  4. Errors: what comes back for a bad key, a bad model name and a malformed body.

The examples below use this site's endpoint, https://api.uncensoredapis.com/v1, and the model uncensored. Swap in the base URL and model of whatever you are testing. If you do not have a key yet, create one here; new accounts can claim a $0.50 trial with no card.

Check 1: list the models with curl

export API_KEY="sk-your-key"
curl -s -w "\nHTTP %{http_code}\n" \
  https://api.uncensoredapis.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

Expect HTTP 200 and a JSON object with a data array. Each item has an id. Here the ID you will use everywhere is uncensored. This one call checks DNS, TLS, the path prefix and the key, so if it fails there is no point testing anything else. The usual causes are a missing /v1 in the base URL, an extra trailing slash, or a key pasted with a newline.

Check 2: one minimal chat request

curl -s https://api.uncensoredapis.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with the word ok."}]}'

In the reply, check choices[0].message.content, finish_reason and the usage object with prompt and completion token counts. Use the headers too: add -i and look for X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. They are handy for logging and for cost tracking later. The same service also accepts POST /v1/responses, which the API reference explainer covers.

Check 3: a Python script that tests everything

Curl is fine for a first look, but a script you can rerun after every change is better. This one uses the official openai package and reports each check.

import sys
from openai import OpenAI, AuthenticationError, NotFoundError, RateLimitError

BASE = "https://api.uncensoredapis.com/v1"
MODEL = "uncensored"
client = OpenAI(base_url=BASE, api_key=sys.argv[1])

def check(name, fn):
    try:
        print("PASS", name, "-", fn())
    except Exception as e:
        print("FAIL", name, "-", type(e).__name__, e)

def models():
    ids = [m.id for m in client.models.list().data]
    assert MODEL in ids, ids
    return ids

def chat():
    r = client.chat.completions.create(
        model=MODEL, messages=[{"role": "user", "content": "Say ok."}])
    assert r.choices[0].message.content
    return r.usage.total_tokens

def stream():
    parts, usage = [], None
    for c in client.chat.completions.create(
            model=MODEL, stream=True,
            messages=[{"role": "user", "content": "Count to five."}]):
        if c.choices and c.choices[0].delta.content:
            parts.append(c.choices[0].delta.content)
        usage = getattr(c, "usage", None) or usage
    assert parts
    return f"{len(parts)} chunks, usage={usage}"

def bad_model():
    try:
        client.chat.completions.create(
            model="no-such-model", messages=[{"role": "user", "content": "hi"}])
    except NotFoundError as e:
        return "NotFoundError " + str(e.status_code)
    except Exception as e:
        return type(e).__name__
    raise AssertionError("bad model name was accepted")

for n, f in [("models", models), ("chat", chat), ("stream", stream), ("bad model", bad_model)]:
    check(n, f)

Run it with python tester.py sk-your-key. The bad model check records whatever error class your SDK raises, which is useful information in itself. If the service accepts an unknown model name, it is probably routing or aliasing it, and you should find out how.

Check 4: error handling

Your application will see failures, so look at them deliberately.

  • Bad key: change one character in the key. Expect HTTP 401 and a JSON error body, not an HTML page.
  • Malformed body: send {"model":"uncensored"} with no messages. Expect a 4xx with a readable message.
  • Rate limits: this API returns 429 with the code rate_limited for requests per minute and concurrency for too many simultaneous requests. A temporary overload also returns 429, with Retry-After: 5.

A good client treats 429 as a signal to wait and retry, and 4xx other than 429 as a bug to fix. Write the retry rule once and test it by launching ten requests at the same time. Limits per key type are on the errors and rate limits page.

Compatibility gaps to look for

Passing the four checks is a good start. These are the places where clones most often differ, so poke at each one if your app depends on it:

  • Parameters: send temperature, top_p, stop, seed and the penalties. Some servers silently ignore them. Run the same prompt three times with a fixed seed and a low temperature and compare outputs.
  • Message roles: try a system message first, then a long multi-turn history. Check that the system message actually changes behaviour.
  • Tool calls: ask for a call to a function you define, then send the result back as a role: "tool" message. In streaming mode, tool_calls arrive in pieces that you must concatenate.
  • JSON mode: set response_format to {"type":"json_object"} and parse 20 replies.
  • Body size: this API accepts bodies up to 8 MB. A request over the limit should fail with a clear 4xx, not hang.

Write down each gap you find and decide whether your code can work around it. Keep the notes next to the script, because the next time the provider ships an update you will want to rerun the same checks and compare. If you test several providers, run the identical script against each one and keep the output in a table, so the differences are visible at a glance instead of buried in memory. A missing parameter is usually harmless. A different error format or broken streaming is usually not.

What passing does not prove

A green run shows protocol compatibility. It says nothing about answer quality, speed under load or price. Those need separate tests on your own prompts. Two quick additions are worth making: a request with a long prompt near your real size (this endpoint has a 100,000-token context window), and a tool-calling request if your app uses agents.

Also keep in mind what you are testing against. This service hosts one open-weight model, tuned to answer without content refusals for lawful adult use. It is text only and is not the official API of any model vendor. Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens, listed on the pricing page, and failed requests are not billed, so repeated test runs cost very little. The docs list every supported parameter.

Questions and answers

Is there an online tool to test an OpenAI-compatible endpoint?

Any HTTP client works: curl, Postman, or a short script with the OpenAI SDK. The advantage of a script is that you can rerun it after each change.

Which base URL should I put in the SDK?

Use the full URL including /v1, for example https://api.uncensoredapis.com/v1. Do not add /chat/completions, since the SDK appends it.

Why do I get 404 on a request that looks right?

The most common cause is a base URL without /v1 or with a doubled path. Check it with a GET to /v1/models first.

How do I check my remaining balance while testing?

Read the X-Balance-USD header on any response, or call GET /v1/balance.

Your key is one form away

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