EN ▾
Unrestricted Search

Uncensored LLM API for developers

Unrestricted SearchGet API key

cURL for API Testing: Check Your LLM Key and Model

A few curl commands will tell you whether your key works, what the model returns and how the API behaves under limits. Here is a short test routine you can paste into a terminal.

Updated

Terminal sending a request beam to a model cube that returns chat bubbles

Key points

  • Two requests, GET /v1/models and one chat completion, prove the key, URL and model ID.
  • Use -i to see rate-limit headers and X-Balance-USD; use -N to watch a stream arrive.
  • A 429 has two causes, requests per minute and concurrency, and the error code tells you which.
  • A typical small test request costs a fraction of a cent.

The two-command smoke test

When you need curl for api testing on a new LLM endpoint, start with the smallest request that can fail in an informative way. Replace YOUR_KEY with your key and run this:

curl -sS https://api.unrestrictedsearch.top/v1/models \
  -H "Authorization: Bearer YOUR_KEY"

You should get JSON listing the model uncensored. That one call checks the host name, TLS, the /v1 path and the key. If it fails, nothing later will work, so fix it here.

Then send a chat completion:

curl -sS https://api.unrestrictedsearch.top/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Name three uses of curl in one line."}],
    "max_tokens": 60
  }'

The reply sits at choices[0].message.content. The same body works from any OpenAI SDK, so once curl succeeds, your Python or Node client has only one way left to go wrong, which is configuration. If you still need a key, the key page explains the one-click trial credit.

Flags that make output readable

Raw curl output is a single dense line. A few flags help a lot:

  • -sS hides the progress meter but still prints errors.
  • -i includes response headers: X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency.
  • -w prints timing or status after the body.
  • --fail-with-body makes curl exit non-zero on HTTP errors while still showing the error JSON, which is handy in scripts.

To pull just the text out, pipe through jq:

curl -sS https://api.unrestrictedsearch.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Say hi"}]}' \
  | jq -r '.choices[0].message.content'

Keep the key in an environment variable (export API_KEY=...) rather than in the command. Shell history and screen shares are how keys leak. To see status and total time together, add -o /dev/null -w "%{http_code} %{time_total}s\n" to a request, which gives you a one-line check you can repeat.

Testing streaming

Streaming is a request flag, stream: true, and the answer comes back as server-sent events. Add -N so curl does not hold the output back:

curl -N -sS https://api.unrestrictedsearch.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "stream": true,
    "messages": [{"role": "user", "content": "Count from 1 to 10."}]
  }'

Each line begins with data: and carries a small JSON chunk with a text delta. The stream ends with data: [DONE], and usage is reported at the end. If everything appears at once, something between you and the API is buffering, typically a proxy. If you are testing concurrency, remember that a streaming request keeps its slot until the stream finishes, so a slow reader occupies capacity.

JSON mode and tool calls from the shell

Two features are worth verifying before you build on them. JSON mode first:

curl -sS https://api.unrestrictedsearch.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "response_format": {"type": "json_object"},
    "messages": [{"role": "user", "content": "Give JSON with keys city and country for Lisbon."}]
  }' | jq -r '.choices[0].message.content' | jq .

The final jq . parses the message content as JSON; if the model returned something invalid, jq complains, which is exactly the signal you want. Ask for JSON in the prompt as well as in the parameter.

Now a tool call. You describe a function, and the model answers with a tool_calls entry instead of text when it wants it run:

curl -sS https://api.unrestrictedsearch.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "tool_choice": "auto",
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_time",
        "description": "Current time in a city",
        "parameters": {
          "type": "object",
          "properties": {"city": {"type": "string"}},
          "required": ["city"]
        }
      }
    }],
    "messages": [{"role": "user", "content": "What time is it in Tokyo?"}]
  }'

Look for tool_calls in the first choice. To finish the loop you send a second request that repeats the conversation, appends the assistant message with its tool call, and adds a message with role: "tool" holding your function result. The documentation has the field details.

Controlling the output while you test

Curl is a good place to learn what the sampling parameters do, because you can change one number and rerun the same request. The API passes through temperature, top_p, stop, seed and the frequency and presence penalties.

Try this experiment. Send the same prompt three times with "temperature": 1.2, and the replies will differ noticeably. Then send it three times with "temperature": 0 and a fixed "seed": 42; the replies should come out much closer to each other, though identical output is not something to promise for every prompt. Use "stop": ["\n\n"] to cut a reply at the first blank line, which is a handy way to force one-paragraph answers while you test a prompt.

Another habit worth building is to log the X-Request-Id header from every test. If something looks wrong and you ask for help through the support page, that ID lets someone find the exact request instead of guessing from a description.

Long inputs

To test a long prompt without pasting thousands of words into the terminal, keep the body in a file and send it with -d @request.json. The max body is 8 MB and the context window is 100,000 tokens for prompt plus completion, so a file test is the easiest way to see how the endpoint behaves near those limits before your application does.

Reading error responses

Break things on purpose once, so you recognize failures later. Send a request with a wrong key and you get an authentication error with an HTTP 4xx status. Send a malformed body and the error JSON names the problem. Neither is charged, since failed or refused requests are not billed.

The one that needs understanding is HTTP 429, which has three flavors:

SignalMeaningWhat to do
Error code rate_limitedToo many requests in a minute (300 on a full key, 60 on trial)Space calls out
Error code concurrencyToo many at once (8 on a full key, 2 on trial)Wait for others to finish
Header Retry-After: 5Temporary overloadSleep 5 seconds, retry

Reproduce the concurrency case with a trial key. Three background jobs will trip it:

for i in 1 2 3; do
  curl -sS -o /dev/null -w "%{http_code}\n" https://api.unrestrictedsearch.top/v1/chat/completions \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model":"uncensored","messages":[{"role":"user","content":"Write a 300 word story."}]}' &
done
wait

With a 2-slot key, expect two 200 responses and one 429. Seeing it once makes the retry logic you write later much easier to trust.

What a test costs

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Take a modest test: 1,000 input tokens and 500 output tokens.

  • Input: 1,000 / 1,000,000 x $0.15 = $0.00015
  • Output: 500 / 1,000,000 x $0.50 = $0.00025
  • Total: $0.0004

The $0.50 trial credit therefore covers about 1,250 requests of that size ($0.50 / $0.0004). That is plenty for exploring every feature above. The X-Balance-USD header on each response shows what is left, so you can watch the number move. Full details and top-up options are on the pricing page.

Caps help while testing: set max_tokens low and the output side of the bill stays tiny. The parameter is optional in normal use, because a completion can use whatever is left of the 100,000-token window.

Turn the checks into a script

Once the manual commands pass, save them as a script you can run after every deploy or key rotation:

# smoke test
set -euo pipefail
BASE="https://api.unrestrictedsearch.top/v1"

code=$(curl -sS -o /tmp/models.json -w "%{http_code}" "$BASE/models" \
  -H "Authorization: Bearer $API_KEY")
[ "$code" = "200" ] || { echo "models failed: $code"; exit 1; }

out=$(curl -sS "$BASE/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","max_tokens":5,"messages":[{"role":"user","content":"ping"}]}')
echo "$out" | jq -e '.choices[0].message.content' > /dev/null
echo "ok"

It exits non-zero on any failure, so it slots into CI or a cron job. For a longer list of things to verify before launch, the production checklist picks up where this script stops.

Add one more guard if the script runs unattended: check the balance header. A run that reads X-Balance-USD from the response and warns when it falls under a threshold you choose gives you notice before requests start failing for lack of credit. Grab it with curl -sS -D - -o /dev/null on the same chat request and filter the header with grep.

Questions and answers

Which curl command should I run first?

Run the GET /v1/models request. It needs no body, it proves the base URL and key are correct, and it shows the model ID to use in later calls.

Does a test request cost money?

Yes, tokens are billed at $0.15 per 1M input and $0.50 per 1M output, but a short test costs a tiny fraction of a cent. Failed or refused requests are not charged.

Why does curl print nothing for my streaming request?

Curl buffers output unless you add -N. With -N you see each server-sent event line as it arrives.

How do I test the rate limit without breaking anything?

Fire a few requests in parallel from a shell loop and watch for HTTP 429. A full key allows 8 at once, a trial key only 2, so the trial key shows the behavior quickly.

Your key is one form away

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

Get API keyRead the docs