Base URL & Authentication
To start using the unhinged ai model, you need a valid API key. Generate one instantly via Google or email on the Get API key page. No phone number is required, and the key is displayed immediately.
Set your base URL to https://api.unhinged.top/v1. All requests must include an Authorization header with the Bearer scheme. This setup works with any OpenAI-compatible SDK. The API serves one uncensored LLM online, optimized for direct text generation without extra routing layers.
First Request
Send a standard chat completion request to test the integration. The model ID is always uncensored. This endpoint returns raw text without content refusals for lawful adult use. If you hit a limit, the API returns a clear error code.
curl https://api.unhinged.top/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'This simple POST request demonstrates the direct text-in, text-out nature of the service. You can adjust parameters like temperature to control creativity. The response includes token usage, helping you track costs against the transparent pricing model.
Python SDK Integration
Use the official OpenAI Python SDK to interact with the API. Configure the base URL and API key in your client initialization. This approach allows you to keep existing code structure while swapping in the uncensored model.
from openai import OpenAI
client = OpenAI(base_url="https://api.unhinged.top/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)Python developers benefit from the synchronous nature of this snippet. It handles the request lifecycle automatically. Ensure you handle exceptions for rate limits or authentication failures. The model supports up to 100,000 tokens in the context window, allowing for substantial prompt history.
Node SDK Integration
For JavaScript and TypeScript environments, the Node SDK offers similar ease of use. Initialize the client with your base URL and key. This allows for rapid prototyping of AI features in web applications or backend services.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unhinged.top/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);Asynchronous handling is built into the SDK. You can await the response directly. This pattern is ideal for server-side rendering or API endpoints that need to return model outputs to clients. Remember that the uncensored api is limited to text generation; do not expect image or audio support in this endpoint.
Streaming Responses
For lower latency experiences, enable streaming by setting stream: true. The API returns Server-Sent Events (SSE). Each chunk contains partial text. The final chunk includes the complete token usage summary.
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)Streaming is essential for chat-like interfaces where users expect real-time feedback. Parse the choices[0].delta.content fields to reconstruct the full response. This method reduces the time to first token significantly compared to full synchronous responses.
Limits, Errors & Context
The API enforces strict quotas to ensure stability. You are limited to 300 requests per minute and 8 concurrent requests per key. The request body must not exceed 8 MB. If you exceed these limits, you will receive a 429 error.
Authentication errors return 401 if the key is invalid. If your prepaid credit is exhausted, the API returns 402. Errors and refusals are free, so you are only charged for successful token usage. The context window supports 100,000 tokens total, and the response can run to the end of the window.