Unrestricted LLMUnrestricted AI Models Explained
What Is a Chat Completion? Messages, Roles and Code
A chat completion is a single API call: you send a list of messages, and the model returns the next message in the conversation. This page shows the exact fields, a full request and response, and how to call the format against our endpoint.

Key points
- A chat completion takes an ordered list of messages with roles and returns one new assistant message.
- The API is stateless, so your code resends the history on every call and pays for those input tokens each time.
- Our endpoint follows the OpenAI format at POST /v1/chat/completions with the model ID uncensored.
- Streaming, tool calling and JSON mode are the same request with a few extra fields.
The short answer
So, what is a chat completion? It is one round trip to a language model API. Your code sends a list of messages, each with a role such as system, user or assistant, and the server replies with the next assistant message. That reply is the "completion" of the conversation so far.
The format was popularised by OpenAI and is now copied by many providers, which is why one client library can talk to many different servers. If you have used a chat window, you have seen the idea in action. A chat completion request is what the window sends in the background each time you press enter.
Two properties matter more than any other. First, the request is a plain HTTPS POST with a JSON body. Second, the server remembers nothing between calls. Everything the model should know has to be inside the messages you send right now.
Anatomy of a request
A request has two required fields: model and messages. Everything else is optional tuning. Here is what you will use most often.
| Field | What it does |
|---|---|
model | Which model answers. On our API the ID is uncensored. |
messages | The ordered conversation, oldest first. |
temperature, top_p | Control how random the sampling is. Lower values give steadier output. |
max_tokens | Upper bound on the reply length. Optional here; the reply can use the rest of the context window. |
stop | Strings that end generation when the model produces them. |
stream | Set to true to receive the reply in pieces over server-sent events. |
tools, tool_choice | Describe functions the model may ask you to call. |
response_format | Ask for valid JSON output with {"type":"json_object"}. |
seed | Request repeatable sampling where the backend supports it. |
The four roles
Each message is an object with a role and content. The role tells the model who is speaking.
- system sets standing instructions: tone, rules, a persona, an output format. Put it first.
- user is the person (or your program) asking.
- assistant is what the model said earlier. You add these yourself when you replay history.
- tool carries the result of a function the model asked you to run.
The order matters. The model reads the list top to bottom and writes what comes next.
What comes back
The response is JSON. The part you read is choices[0].message.content. Beside it you get a finish_reason and a usage block with token counts, which is what billing is based on.
curl https://api.unrestrictedllm.cc/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain what an API key is in two sentences."}
],
"temperature": 0.3
}'
A typical reply looks like this, trimmed for space:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "uncensored",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "An API key is a secret string that identifies you to a service..."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 31, "completion_tokens": 48, "total_tokens": 79}
}
finish_reason tells you why generation ended. stop means the model finished or hit a stop string. length means the token limit cut it off. tool_calls means the model wants you to run a function before it continues.
Our responses also carry headers worth logging: X-Request-Id for support questions and X-Balance-USD for the credit left on your key.
Why your code has to resend the history
Because the endpoint is stateless, a chatbot is just a loop that appends to a list. The model does not "remember" your last question. You send it again, along with the answer it gave.
from openai import OpenAI
client = OpenAI(
base_url="https://api.unrestrictedllm.cc/v1",
api_key="YOUR_API_KEY",
)
messages = [{"role": "system", "content": "You are a patient tutor."}]
while True:
text = input("you> ")
if not text:
break
messages.append({"role": "user", "content": text})
reply = client.chat.completions.create(
model="uncensored",
messages=messages,
)
answer = reply.choices[0].message.content
messages.append({"role": "assistant", "content": answer})
print("bot>", answer)
This has a cost consequence that surprises people. Every turn sends the whole conversation as input. Take a system prompt of 200 tokens, a user message of 100 tokens per turn and an answer of 300 tokens per turn. Turn 1 sends 300 input tokens. Turn 10 sends 200 + 9 x 400 + 100 = 3,900 input tokens.
Over ten turns the input adds up to 10 x 300 + 400 x (0 + 1 + ... + 9) = 3,000 + 18,000 = 21,000 tokens, plus 3,000 output tokens. At $0.15 per 1M input tokens and $0.50 per 1M output tokens that is $0.00315 for input and $0.0015 for output, so $0.00465 for the whole ten-turn chat. Cheap, but the input share grows with every turn, which is why long sessions get trimmed or summarised. Details on rates are on the pricing page.
The context window on this API is 100,000 tokens, counting prompt and completion together. A very long history will eventually need pruning, usually by dropping the oldest turns while keeping the system message.
Chat completions versus the older completion call
Before chat models, APIs offered a plain "completion" endpoint. You sent one string and the model continued it. Chat completions replace that with a list of role-tagged messages. Under the hood the server still turns the list into a single prompt using the model's chat template, but you no longer have to format turn markers yourself.
That is the practical reason to prefer the chat shape: the system message, tool results and multi-turn history have a defined place. Our API exposes two methods only: POST /v1/chat/completions and GET /v1/models. There is no legacy text completion route, no embeddings, and no image or audio generation, so if a library asks for those you will need another service for that part.
The models list is a quick way to check that your key and base URL work:
curl https://api.unrestrictedllm.cc/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
Streaming, tools and JSON mode
Three optional features change the shape of the exchange without changing the basic idea.
Streaming
With stream: true the server sends the reply as small chunks over server-sent events, and token usage arrives at the end of the stream. This is what makes text appear word by word in a UI.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Write a four-line poem about rivers."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
One detail for production code: a streamed request holds one of your concurrency slots until the stream ends. A client that opens streams and never closes them will start getting concurrency errors.
Tool calling
You describe functions in tools. If the model decides one is needed, the reply contains tool_calls with a function name and JSON arguments. Your code runs the function, appends the result as a message with role: "tool", and calls the API again so the model can use the result.
JSON mode
Setting response_format to {"type":"json_object"} asks for syntactically valid JSON. Say in the prompt which keys you want, because the flag only guarantees the syntax, not your schema.
Common mistakes with the format
- Forgetting to append the assistant reply. The next turn then makes no sense to the model, since it never sees its own earlier answer.
- Putting instructions in a late user message. Standing rules belong in the first system message.
- Wrong base URL. Clients need the address up to and including
/v1, herehttps://api.unrestrictedllm.cc/v1. The client adds/chat/completionsitself. - Ignoring HTTP 429. A full key allows 8 concurrent requests and 300 requests per minute. The error code
rate_limitedmeans too many per minute,concurrencymeans too many at once, and a temporary overload returns 429 withRetry-After: 5. Wait and retry. - Sending huge bodies. The maximum request body is 8 MB.
Failed or refused requests are not charged, so retrying after an error does not cost you for the failed attempt.
Try it on our endpoint
Any OpenAI SDK works once you change the base URL and key, so there is nothing new to learn. New accounts can claim $0.50 of trial credit with one click on the key page after sign-up. It needs no card and is valid for 7 days. The key page walks through sign-up, and the documentation lists every supported parameter.
If you want background on what the model does differently from filtered models, the article on unrestricted AI models covers it. The short version: it is a single open-weight model that answers without content refusals for lawful adult use, text only, with prompts not used for training.
More guides
Questions and answers
Is a chat completion the same as a chat session?
No. A chat completion is a single stateless request and response. A session exists only because your code keeps the message list and resends it each time.
Do I need the OpenAI library to make a chat completion?
No. It is an ordinary HTTPS POST with a JSON body, so curl, fetch or any HTTP client works. The OpenAI SDKs are a convenience once you point them at our base URL.
How are chat completions billed on this API?
By tokens, at $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. The usage block in each response shows the counts.
What model ID do I put in the request?
Use uncensored as the model value. You can confirm it by calling GET /v1/models with your key.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.