- Install openai, point base_url at https://api.uncensoredai.top/v1 and pass the model ID from the first example.
- No SDK is required: a plain requests.post to /v1/chat/completions works.
- You keep the chat history yourself and send it with every call.
- 429 means a limit was hit; read Retry-After and try again.
No card needed. After sign-up, claim $0.50 of free test credit with one click (once per person).
Get API keyFive steps to a working call
- Create an account with Google or with email and password, then open the API key page and create a key. New users can claim $0.50 of trial credit there with one click, no card needed, valid for 7 days.
- Store the key in an environment variable:
export UNCENSORED_KEY="your-key". - Install the library:
pip install openai. - Create a client with
base_urlset tohttps://api.uncensoredai.top/v1. - Call
chat.completions.createwith the model IDuncensored.
That is the whole setup. The service is OpenAI-compatible, so code written for the OpenAI SDK needs two changed values and nothing else. If you want a longer step-by-step walkthrough for developers, see the integration guide.
Your first request
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.uncensoredai.top/v1",
api_key=os.environ["UNCENSORED_KEY"],
)
resp = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "You are a blunt, concise editor."},
{"role": "user", "content": "Rewrite: the thing was done by the team quickly."},
],
temperature=0.7,
)
print(resp.choices[0].message.content)
print(resp.usage.prompt_tokens, resp.usage.completion_tokens)
The usage line prints the number of tokens in and out, which you can multiply by the prices on the pricing page ($0.15 per 1M input, $0.50 per 1M output) to see what the call cost. The model behind the endpoint is an open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official API of any big vendor, and it is a different thing from a router that picks between vendors, so expect one consistent model rather than a choice.
To list what the key can use, call client.models.list(), which maps to GET /v1/models.
Keeping keys and settings out of your code
A key pasted into a script ends up in a Git repository sooner or later. A small amount of structure avoids that and makes the project easier to move between machines.
Put the key and base URL in environment variables, and read them in one module that the rest of your code imports. A .env file loaded with the python-dotenv package works well in development; add it to .gitignore on the first day. In production, use whatever secret store your host provides.
# llm.py
import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ.get("UNCENSORED_BASE_URL", "https://api.uncensoredai.top/v1"),
api_key=os.environ["UNCENSORED_KEY"],
)
MODEL = "uncensored"
Every other file then does from llm import client, MODEL. If you later add a second endpoint for tests, you change one line. The same pattern works for the async client: create AsyncOpenAI in the same module and import it where needed.
Treat a leaked key as lost. If it appears in a public place, create a new one on the key page and stop using the old one. Because credit is prepaid, the worst case is limited to your balance, which is one more reason to top up in modest amounts while you test.
No SDK: plain requests
If you do not want a dependency, the HTTP call is short. This is useful in scripts, serverless functions and anywhere the openai package is awkward to install.
import os
import requests
r = requests.post(
"https://api.uncensoredai.top/v1/chat/completions",
headers={"Authorization": "Bearer " + os.environ["UNCENSORED_KEY"]},
json={
"model": "uncensored",
"messages": [{"role": "user", "content": "Name three uses for a haiku."}],
"max_tokens": 200,
},
timeout=120,
)
r.raise_for_status()
print(r.json()["choices"][0]["message"]["content"])
print(r.headers.get("X-Request-Id"), r.headers.get("X-Balance-USD"))
The same call in curl, handy for a quick test from a terminal:
curl https://api.uncensoredai.top/v1/chat/completions -H "Authorization: Bearer $UNCENSORED_KEY" -H "Content-Type: application/json" -d '{"model":"uncensored","messages":[{"role":"user","content":"Hello"}]}'
The response headers carry X-Request-Id and X-Balance-USD. Quote the first when you contact support, and use the second to track your remaining credit.
Chat history and streaming
The API is stateless. It remembers nothing between calls, so a conversation is a list you grow yourself. Append the user message, send the list, append the assistant reply, repeat. Combine that with streaming and you have a small terminal chat:
history = [{"role": "system", "content": "You are a witty co-writer."}]
while True:
text = input("you: ")
if text in ("quit", "exit"):
break
history.append({"role": "user", "content": text})
stream = client.chat.completions.create(
model="uncensored",
messages=history,
stream=True,
temperature=0.9,
)
reply = ""
print("ai: ", end="")
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
piece = chunk.choices[0].delta.content
reply += piece
print(piece, end="", flush=True)
print()
history.append({"role": "assistant", "content": reply})
The context window is 100,000 tokens, prompt and completion together, which is a long conversation. Even so, the whole history is billed as input on every turn, so long chats cost more per message than short ones. A ten-turn chat that averages 2,000 tokens in and 300 tokens out per turn uses 20,000 input tokens ($0.003) and 3,000 output tokens ($0.0015), which is $0.0045 in total. Trim or summarize old turns if a session goes on for hundreds of messages.
A streamed request holds one of your concurrent slots until the stream ends, so close it or read it to the end.
JSON output and tool calls
Programs want structure. JSON mode makes the reply a valid JSON object:
import json
resp = client.chat.completions.create(
model="uncensored",
response_format={"type": "json_object"},
messages=[
{"role": "system", "content": 'Reply as JSON: {"name": str, "traits": [str]}'},
{"role": "user", "content": "Invent a grumpy dwarf blacksmith for my story."},
],
)
character = json.loads(resp.choices[0].message.content)
print(character["name"], character["traits"])
Tool calling lets the model ask your code to do something, like look up a record. You describe functions in tools, the model answers with a tool_calls entry, you run the function, and you send the result back as a message with the role tool.
tools = [{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll a die with the given number of sides",
"parameters": {
"type": "object",
"properties": {"sides": {"type": "integer"}},
"required": ["sides"],
},
},
}]
messages = [{"role": "user", "content": "Roll a twenty-sided die for me."}]
first = client.chat.completions.create(
model="uncensored", messages=messages, tools=tools, tool_choice="auto"
)
msg = first.choices[0].message
if msg.tool_calls:
call = msg.tool_calls[0]
messages.append(msg)
messages.append({"role": "tool", "tool_call_id": call.id, "content": "17"})
final = client.chat.completions.create(
model="uncensored", messages=messages, tools=tools
)
print(final.choices[0].message.content)
In real code you would parse call.function.arguments as JSON and run your function with it. The hard-coded "17" keeps the example short.
Sampling settings that matter
Most Python examples copy the defaults and move on, but a few parameters change results noticeably. The endpoint passes temperature, top_p, stop, seed and the frequency and presence penalties through to the model.
Temperature
Low values (0 to 0.3) make answers steady and are right for extraction, classification and anything you want to repeat. Values around 0.8 to 1.0 give livelier prose and suit fiction, dialogue and brainstorming. Past 1.2 the text tends to drift, so reach for it only when you have a reason.
Top_p and penalties
Change one of temperature and top_p, not both at once, or you will not know which one did what. The penalties help when the model repeats a phrase in long outputs. Raise them in small steps, because large values push the text toward odd word choices.
Seed and stop
Pass a fixed seed while you tune a prompt so you can compare two versions on the same random draw. Use stop to cut generation at a marker such as a blank line, which also trims the output tokens you pay for.
max_tokens
It is optional, and a completion can use whatever is left of the 100,000 token window. Set it anyway for anything automated. Output tokens cost $0.50 per 1M against $0.15 per 1M for input, so a runaway answer is the most expensive mistake a script can make.
When something goes wrong
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 or an authentication error | Missing or wrong key, or the Bearer prefix is absent | Print the first four characters of the variable you load; with requests, send the header Authorization: Bearer plus the key |
| 404 on the request | Base URL missing /v1, or a typo in the path | Use https://api.uncensoredai.top/v1 as base_url and let the SDK add /chat/completions |
| 429 with rate_limited | More than 60 (trial) or 300 (full) requests per minute | Slow the loop and honor Retry-After |
| 429 with concurrency | More than 2 (trial) or 8 (full) requests in flight | Lower your worker count; close unfinished streams |
| JSON parse error | The prompt did not describe the keys, or the output was cut off | State the schema in the system message and raise max_tokens |
| Reply cuts off mid-sentence | max_tokens set too low | Raise it, or remove it |
If none of these fits, send the value of the X-Request-Id header to support along with what you expected. That ID points to the exact call.
Errors, limits and good habits
A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. The maximum request body is 8 MB. When you pass a limit, you get HTTP 429 with the error code rate_limited (too many per minute) or concurrency (too many at once). A temporary overload also returns 429, with a Retry-After: 5 header. A simple wrapper handles all three:
import time
from openai import RateLimitError
def ask(messages, tries=4):
for _ in range(tries):
try:
return client.chat.completions.create(model="uncensored", messages=messages)
except RateLimitError as err:
time.sleep(float(err.response.headers.get("Retry-After", 5)))
raise RuntimeError("still rate limited")
Failed or refused requests are not charged, so retries cost nothing extra. Prompts are not used for training.
One rule has no setting that changes it: the service will not produce sexual content involving minors. Everything else is aimed at lawful adult use, such as fiction, roleplay and companion apps. You remain responsible for how you use the output and for the terms of any platform you publish on.
The API is text only. It does not generate images, audio or video, and it does not offer embeddings or fine-tuning. If a project needs those, use another service for that part and keep this one for text.
Ready to go further? The quickstart has the reference details, and top-ups start at $20 with a bonus from $50, paid by crypto only.
More guides
Questions and answers
Which Python library should I use?
The official openai package works unchanged once you set the base URL and key. The requests library also works if you prefer to call /v1/chat/completions directly.
What model name do I pass?
Pass "uncensored" as the model value. You can confirm it with GET /v1/models.
Does the API remember earlier messages?
No. You send the full message list on every call, so your code owns the history. The context window is 100,000 tokens.
How do I try it without paying?
Sign up, then claim the $0.50 trial credit with one click on the API key page. It needs no card, is one per person and lasts 7 days.
Is there anything the model will not write?
It will not produce sexual content involving minors. Within lawful adult use, it is tuned to answer without content refusals.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
