Prerequisites: Install the OpenAI SDK
Start by installing the official OpenAI SDK for your language. This library handles authentication, retries, and JSON parsing so you do not need to write HTTP clients from scratch. Our API uses the same standard interfaces as the original service, meaning your existing code logic remains intact.
You only need a valid Python or Node.js environment. The SDK manages the heavy lifting for you.
- Python:
pip install openai - Node.js:
npm install openai
Configure your Base URL and API Key
Point your client to our dedicated endpoint. Replace the default base URL with our specific domain to route traffic to our uncensored models. You must also provide your API key from the dashboard.
This step isolates your requests from other vendors. Ensure you use the exact base URL provided below.
from openai import OpenAI
client = OpenAI(base_url="https://api.unrestrictedaigpt.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unrestrictedaigpt.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);
Make your first POST /v1/chat/completions request
Send a standard chat completion request. Use the model identifier uncensored to ensure you get the correct model. The API accepts standard parameters like temperature and max_tokens.
curl https://api.unrestrictedaigpt.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Run python script to sort list numerically"}]
}'The response will contain the generated text. If you need to handle errors, check the status code.
Handle streaming responses via SSE
Enable streaming by setting stream: true. This returns a Server-Sent Events stream. You process each chunk as it arrives, which reduces perceived latency for long outputs.
The final chunk includes the token usage statistics. This allows you to track costs in real-time.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Implement tool calling and JSON mode
Use the tools parameter to enable function calling. Define your function schema and let the model decide when to invoke it. You can also force JSON output using response_format for strict data structures.
Both features work exactly as they do in the standard OpenAI API.
Limits, errors, and context window
Our API enforces strict limits to ensure stability. You get a 100,000 token context window. Max output per request is 16,000 tokens. You are limited to 300 requests per minute. A 401 error means your key is invalid. A 402 error means you have no credit. A 429 error means you hit the rate limit. Errors and refusals do not consume credit.