EN ▾
https://api.unrestrictedaiapi.com/v1uncensored2026-10-06
Get API key

OpenAI Compatible API Spec: What Is Supported

The OpenAI compatible API spec here is small: two methods, bearer-token auth and the familiar chat completions request and response. This page lists exactly what is supported, what is not, and how the limits and errors behave.

Updated

Blueprint-style diagram of an API with inputs, a central node and a stream of data flowing out

Key points

  1. Two methods only: POST /v1/chat/completions and GET /v1/models.
  2. Streaming, tool calling and JSON mode are supported; embeddings, images and audio are not.
  3. Limits are 8 concurrent and 300 per minute on a full key, 2 and 60 on a trial key.
  4. A 429 can mean rate_limited, concurrency, or temporary overload with Retry-After: 5.

Summary of the spec

If you already have code that talks to OpenAI, the short version of the openai compatible api spec is this: change the base URL, change the key, set the model to uncensored. Request and response bodies follow the chat completions shape, so SDKs parse them without changes.

ItemValue
Base URLhttps://api.unrestrictedaiapi.com/v1
AuthAuthorization: Bearer YOUR_KEY
MethodsPOST /v1/chat/completions, GET /v1/models
Model IDuncensored
Context window100,000 tokens, prompt plus completion
Max request body8 MB
OutputText only

The model is a single open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official endpoint of any model vendor and it does not route between vendors. That is why there is one model ID and why the model list is short.

Endpoints

GET /v1/models

Returns the models available to your key. It is the cheapest way to confirm that your key and base URL are right, and many UI clients call it to fill a dropdown.

curl https://api.unrestrictedaiapi.com/v1/models \
  -H "Authorization: Bearer $KEY"

POST /v1/chat/completions

The only generation endpoint. You send a messages array of objects with a role (system, user, assistant or tool) and content, plus the model and any sampling options. A minimal call:

curl https://api.unrestrictedaiapi.com/v1/chat/completions \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [
      {"role": "system", "content": "Answer in one sentence."},
      {"role": "user", "content": "What is a base URL?"}
    ]
  }'

The reply carries the generated text in choices[0].message.content and token counts in usage. Those counts are what billing is based on.

Not offered: the legacy completions endpoint, embeddings, image, audio and video endpoints, fine-tuning and file endpoints. A client that calls them will receive an error, so disable those features in tools that default to using them.

Request parameters

These parameters are accepted and passed through to the model:

  • temperature and top_p for sampling.
  • stop for one or more stop sequences.
  • seed for repeatable sampling when you keep everything else equal.
  • presence_penalty and frequency_penalty to reduce repetition.
  • max_tokens, which is optional. If you leave it out, the completion can use the rest of the 100,000-token window.
  • stream for server-sent events.
  • tools and tool_choice for function calling.
  • response_format with {"type":"json_object"} for JSON mode.

Two practical notes. First, the window counts prompt and completion together, so a 90,000-token prompt leaves about 10,000 tokens for the answer. Second, the body limit is 8 MB, which is far more than 100,000 tokens of text needs, so you only reach it by embedding large encoded payloads in messages.

Streaming

Set stream: true and the response arrives as server-sent events. Each event is a JSON chunk with a delta holding the next piece of text, and usage is reported at the end of the stream. SDKs hide the framing; with the raw protocol you read lines that begin with data: until the stream closes.

from openai import OpenAI

client = OpenAI(base_url="https://api.unrestrictedaiapi.com/v1", api_key="YOUR_KEY")

with client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "List five HTTP status codes."}],
    stream=True,
) as stream:
    for chunk in stream:
        if chunk.choices and chunk.choices[0].delta.content:
            print(chunk.choices[0].delta.content, end="")

One rule affects capacity planning: a streamed request holds its concurrency slot until the stream ends, not until the first token. If a client stalls while reading, it keeps the slot busy. Always close or finish the stream, and set a client timeout.

Tool calling and JSON mode

Tool calling

Pass tools as a list of function definitions with JSON Schema parameters. If the model decides to call one, the message contains tool_calls, which are also streamed when stream is on. You run the function and send back its result as a message with role: "tool" and the matching tool_call_id. Use tool_choice to force a particular function or to leave the decision to the model.

{
  "model": "uncensored",
  "messages": [{"role": "user", "content": "Weather in Oslo?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "description": "Current weather for a city",
      "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"]
      }
    }
  }]
}

The model proposes arguments; it does not execute anything. Validate them before you act on them, as you would with any user input.

JSON mode

Add "response_format": {"type": "json_object"} to ask for a single valid JSON object. As with other OpenAI-style implementations, also tell the model in the prompt what keys you want, for example "Return an object with keys title and tags". Parse the result in a try block anyway, and keep max_tokens generous so a long object is not cut off.

Limits, headers and errors

Key typeConcurrent requestsRequests per minute
Full key8300
Trial key260

Every response includes X-Request-Id (quote it when you contact support), X-Balance-USD (your remaining credit), X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency.

When you pass a limit the API returns HTTP 429. The error code separates the cases:

  • rate_limited: too many requests in a minute. Slow down or spread the load.
  • concurrency: too many requests in flight at once. Queue them on your side.
  • 429 with a Retry-After: 5 header: temporary overload. Wait five seconds and retry.
import time
import httpx

def post_with_retry(payload, key, tries=4):
    # payload example: {"model": "uncensored", "messages": [...]}
    for attempt in range(tries):
        r = httpx.post(
            "https://api.unrestrictedaiapi.com/v1/chat/completions",
            headers={"Authorization": "Bearer " + key},
            json=payload,
            timeout=120,
        )
        if r.status_code == 429:
            wait = int(r.headers.get("Retry-After", 2 ** attempt))
            time.sleep(wait)
            continue
        return r
    return r

Requests that fail or are refused are not charged.

Roles, history and the response object

The API is stateless. It does not remember earlier requests, so a conversation exists only as the messages array you send each time. A typical history starts with one system message that sets behaviour, followed by alternating user and assistant messages. When tool calling is in play, tool messages appear between them, each linked to the call it answers by tool_call_id.

This has two consequences. The first is cost: every turn pays for the entire history as input, so a long chat gets more expensive per message even if each question is short. The second is control: you can edit, trim or rewrite history at will. Dropping the oldest turns, replacing them with a summary or injecting a corrected assistant message are all ordinary operations, and the model treats whatever you send as the truth.

On the way back, read three things. choices[0].message holds the text or the tool calls. choices[0].finish_reason tells you why generation stopped: a natural end, the token limit, or a tool call. usage holds prompt, completion and total token counts. If the finish reason says the token limit was hit, the text is truncated, and you should either raise the limit or ask the model to continue in a follow-up turn.

A short compatibility checklist

Before you ship a client against this endpoint, run through these checks. They catch most integration problems in a few minutes.

  1. Call GET /v1/models with your key and confirm you get a list that includes uncensored.
  2. Send a plain chat request without options and confirm a normal reply with a usage block.
  3. Repeat it with stream: true and confirm that your client handles the end of the stream and the final usage data.
  4. If you use tools, send one tool-call round trip end to end, including the follow-up request with the tool message.
  5. Fire 10 requests at once on a trial key and confirm your code copes with the 429 that follows the second concurrent request.
  6. Log X-Request-Id for every call so that any odd result can be traced later.

Passing all six means your client is ready for real traffic.

Where this differs from the full OpenAI platform

Compatibility means the chat protocol, not the whole platform. Anything outside text chat is absent, and a few behaviours come from the model rather than the protocol. The model name is fixed, answers can differ in style from any model you used before, and sampling with the same seed is repeatable only while the prompt and parameters stay the same.

The one content rule you cannot change is that sexual content involving minors is blocked. Beyond that, the model is tuned to avoid refusals for lawful adult use, and prompts are not used for training.

For code in five languages see the quickstart, for prompt techniques read prompting an unrestricted model, and for the account side, pricing lists the rates: $0.15 per 1M input tokens and $0.50 per 1M output tokens, with credit that never expires. The docs hold the same spec in short form.

Questions and answers

Which OpenAI endpoints are supported?

Only POST /v1/chat/completions and GET /v1/models. Embeddings, images, audio, fine-tuning and the legacy completions endpoint are not available.

Does it support streaming and function calling?

Yes to both. Streaming uses server-sent events with usage at the end, and tool calls are streamed too. Results go back as messages with role tool.

What is the maximum context length?

100,000 tokens, counting the prompt and the completion together. The request body can be up to 8 MB.

What does a 429 mean here?

Either you passed the per-minute limit (rate_limited), had too many requests at once (concurrency), or the service is briefly overloaded and sent Retry-After: 5.

Your key is one form away

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

Get API key