EN ▾

Unrestricted Search API: LLM Summaries in Python

There is no single endpoint that crawls the web and answers without limits. What you can build in an afternoon is a two-step flow: you fetch the text, and an OpenAI-compatible API reads and summarises it.

Updated

Terminal window sending document tiles into a cube that outputs short ribbons, illustrating LLM summaries in Python

The short version

If you are looking for an unrestricted search api, here is how to read that request in practice. The API on this site does not search. It is a text-in, text-out chat endpoint. Your code gets the search results from wherever you like, passes them in as messages, and the model summarises, ranks or extracts from them without refusing on topic grounds.

The setup takes three things: a base URL, a key and a model name. The base URL is https://api.unrestrictedsearch.cc/v1, the model ID is uncensored, and the key goes in an Authorization: Bearer header, which the OpenAI SDK handles for you. The rest of the page builds on that with working Python.

Why split it this way? Search and language are different jobs. A crawler and an index need storage, bandwidth and constant upkeep, and the sources you pick decide what can be found. A language model needs none of that; it needs text. Keeping the two apart means you can swap your search source later, say from a self-hosted instance to a paid provider, without touching the summarising code. It also means you can test the model side alone, with a handful of pasted paragraphs, before you build any fetching at all.

Get a key and install the SDK

Sign up with Google or with an email and password, then open the API key page. New users can claim $0.50 of trial credit there with one click. It needs no card, lasts 7 days and is limited to one per person. A trial key runs 2 concurrent requests and 60 requests per minute, which is plenty for developing the flow below.

Install the official SDK and keep the key in an environment variable instead of in the source.

pip install openai
export UNRESTRICTED_KEY="paste-your-key-here"

Check the connection before writing anything else. The models endpoint is a cheap way to confirm that the URL and key are right.

curl https://api.unrestrictedsearch.cc/v1/models \
  -H "Authorization: Bearer $UNRESTRICTED_KEY"

You should see uncensored in the list. If you get an authentication error, the key is wrong or missing; if the connection fails, check that the URL ends in /v1 and has no trailing path.

Summarise fetched pages

The core function takes a page of text and returns a short summary. It uses a low temperature so that repeated runs give similar output, and it asks the model to stick to the text.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.unrestrictedsearch.cc/v1",
    api_key=os.environ["UNRESTRICTED_KEY"],
)

def summarise(title: str, text: str) -> str:
    resp = client.chat.completions.create(
        model="uncensored",
        temperature=0.2,
        max_tokens=300,
        messages=[
            {"role": "system", "content": (
                "Summarise the page in 3 to 5 sentences. "
                "Use only what the text says. Do not add warnings or opinions."
            )},
            {"role": "user", "content": f"Title: {title}\n\n{text}"},
        ],
    )
    return resp.choices[0].message.content

print(summarise("Example page", "Paste the extracted page text here."))

Where the text comes from is your decision. Many people use a search provider's API, a self-hosted metasearch instance, or a plain HTTP fetch followed by a readability extractor. The model does not care, as long as you strip navigation, scripts and cookie banners first. Cleaner input means fewer tokens and better summaries.

A few habits help in practice. Put the page title and the address in the prompt so the model can tell sources apart. Keep the system message short and specific; long lists of rules tend to get ignored. If you summarise many pages for the same query, include the query in the prompt, because a summary written with a goal in mind is more useful than a neutral one. And save the output with the source address, so you can trace any sentence back to the page it came from.

Keep the context window in mind: 100,000 tokens covers prompt and reply together. A long page should be trimmed or split, not sent whole.

Return structured results with JSON mode

For a search tool you often want fields, not prose: a title, a one-line gist, a relevance score. JSON mode asks the API to return a valid JSON object. Describe the shape in the prompt, because the mode guarantees syntax and not your schema.

import json

def extract(query: str, title: str, text: str) -> dict:
    resp = client.chat.completions.create(
        model="uncensored",
        temperature=0,
        response_format={"type": "json_object"},
        messages=[
            {"role": "system", "content": (
                "Return a JSON object with keys: gist (string, one sentence), "
                "relevance (integer 0 to 10 for the given query), "
                "entities (array of strings). Output JSON only."
            )},
            {"role": "user", "content": f"Query: {query}\nTitle: {title}\n\n{text}"},
        ],
    )
    return json.loads(resp.choices[0].message.content)

Wrap json.loads in a try block anyway and handle a missing key with a default. Models occasionally return a valid object that lacks a field. Sorting the results by the relevance value gives you a basic reranker without any extra service.

Let the model call your search function

Instead of pushing results in, you can let the model request them. Tool calling is supported, so you describe a function, the model decides when to call it, and you run it and send the output back as a role: "tool" message.

import json

tools = [{
    "type": "function",
    "function": {
        "name": "web_search",
        "description": "Search the web and return short result snippets.",
        "parameters": {
            "type": "object",
            "properties": {"q": {"type": "string"}},
            "required": ["q"],
        },
    },
}]

def web_search(q: str) -> str:
    # Replace with a call to your own search source.
    return "1. Example result snippet for: " + q

messages = [{"role": "user", "content": "What changed in the latest release notes of the tool?"}]
resp = client.chat.completions.create(model="uncensored", messages=messages, tools=tools)
msg = resp.choices[0].message

if msg.tool_calls:
    messages.append(msg)
    for call in msg.tool_calls:
        args = json.loads(call.function.arguments)
        messages.append({
            "role": "tool",
            "tool_call_id": call.id,
            "content": web_search(args["q"]),
        })
    final = client.chat.completions.create(model="uncensored", messages=messages, tools=tools)
    print(final.choices[0].message.content)
else:
    print(msg.content)

This is the nearest thing to a search API experience: the user asks, the model picks the query, your function fetches, the model answers. The search itself stays under your control, which is also where you decide what sources are allowed.

Stream answers and survive rate limits

For anything a person watches, set stream: true. Tokens arrive over SSE and usage is reported at the end. Note that a streamed request keeps its concurrency slot until the stream finishes, so a slow reader can use up your 8 slots (2 on a trial key) faster than you expect.

stream = client.chat.completions.create(
    model="uncensored",
    stream=True,
    messages=[{"role": "user", "content": "Explain what a metasearch engine does."}],
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

When you batch many pages, add a retry. A 429 with the code rate_limited means too many requests per minute; concurrency means too many at once; and a 429 with Retry-After: 5 signals temporary overload. In all three cases waiting and retrying is the right response.

import time
from openai import RateLimitError

def with_retry(fn, tries=5):
    for attempt in range(tries):
        try:
            return fn()
        except RateLimitError:
            time.sleep(5 * (attempt + 1))
    raise RuntimeError("still rate limited")

A thread pool of 6 or 7 workers keeps a full key under its concurrency cap with a little headroom. The response headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency show the limits that apply to your key, and X-Balance-USD shows what is left.

Cost of a summarising job

Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens. Suppose you summarise 1,000 pages of about 3,000 tokens each, with a 300-token summary per page.

  • Input: 1,000 x 3,000 = 3,000,000 tokens, which is 3 x $0.15 = $0.45
  • Output: 1,000 x 300 = 300,000 tokens, which is 0.3 x $0.50 = $0.15
  • Total: $0.60

A smaller test of 20 pages at the same size comes to 60,000 input tokens ($0.009) plus 6,000 output tokens ($0.003), so $0.012. The trial credit therefore covers a few dozen test runs of that size. When you outgrow it, top-ups run from $20 to $500 in any whole amount, with +5% from $50, +10% from $100 and +15% from $200; the pricing page has the details, and only crypto works as payment. Failed or refused requests are not charged.

Pitfalls worth checking first

  • Wrong base URL. It must end in /v1. The SDK adds /chat/completions itself.
  • Unfiltered input. Raw HTML wastes tokens and confuses summaries. Extract the main text first.
  • Trusting the model for facts. It summarises what you give it. If the fetched page is wrong, the summary will be wrong.
  • Prompt injection from pages. A fetched page may contain text that looks like instructions. Keep your system prompt firm and treat page text as data.
  • Body size. The maximum body is 8 MB, so trim long inputs before sending them.

For the full parameter list, see the quickstart. If you want the broader picture of what the service is for, the developer overview covers it. Content that sexualises minors is blocked outright; everything else is aimed at lawful adult use, and what you build on top is your responsibility.

Questions and answers

Does the API fetch web pages for me?

No. It is a chat completion endpoint. You fetch or search elsewhere and pass the text in, or expose a search function through tool calling.

Which model name do I use?

Set model to uncensored. A call to GET /v1/models lists it.

Can I use the Node or curl clients instead of Python?

Yes. Any OpenAI-compatible client works once the base URL and key are changed.

How do I avoid 429 errors in a batch job?

Cap your workers below 8 concurrent requests on a full key, and retry after a short wait when a 429 comes back.

Is my data used for training?

No. Prompts are not used for training.

Your key is one form away

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

Get API key