Uncensored ai API Quickstart Guide
Get started with the uncensored local LLM API by authenticating with your key and sending requests to the OpenAI-compatible endpoint. This guide covers the essential endpoints, streaming, and tooling for immediate integration.
- base_url
- https://api.llmlocaluncensored.com/v1
- model
- uncensored
Authentication and Base URL
Use your API key to authenticate every request against the base URL https://api.llmlocaluncensored.com/v1. Generate a key via the dashboard using Google or email, then pass it in the Authorization: Bearer <key> header. The model identifier is uncensored. This setup works with any standard OpenAI-compatible client.
Basic Chat Completion Request
Send a POST request to /v1/chat/completions with your messages and the model ID. The endpoint returns a text response based on your input. No extra routing or proxy layers are needed for this direct interaction.
curl https://api.llmlocaluncensored.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Show me the current system uptime"}]
}'
Ensure your payload includes the model field set to uncensored. The API processes the prompt and returns the generated text.
Streaming Responses with SSE
Enable streaming by setting stream: true in your request body. The API returns Server-Sent Events (SSE) for real-time token delivery. This approach reduces perceived latency for long outputs, especially when generating creative content or code.
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)
Parse the SSE stream to display tokens as they arrive. The final chunk contains the total token usage statistics.
Function Calling and Tools
Define tools in your request to enable function calling capabilities. The model can return structured arguments for your predefined functions. This feature allows for robust integration into larger applications requiring specific actions or data retrieval.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.llmlocaluncensored.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);
Configure the tools array with your function schemas. The API handles the routing of arguments back to your code.
JSON Mode and Parameters
Use response_format: {"type": "json_object"} to enforce strict JSON output. Adjust parameters like temperature, top_p, and seed to control randomness and reproducibility. This ensures consistent results for deterministic tasks.
from openai import OpenAI
client = OpenAI(base_url="https://api.llmlocaluncensored.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)
Set max_tokens to control output length. The default is 2,048 tokens unless overridden. Use stop sequences to halt generation at specific points.
Understanding Tokens and Limits
The context window supports 100,000 tokens for prompt and completion combined. You are charged $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors and refusals do not consume credit. A rate limit of 300 requests per minute applies per key.
Frequently asked questions
How do I get started with the uncensored local LLM API?
Generate an API key via the dashboard using Google or email. Use that key to authenticate requests to the base URL with the model ID <code>uncensored</code>. You can start sending chat completion requests immediately.
What is the context window size?
The API supports a 100,000 token context window for both prompt and completion combined. This allows for extensive conversations or large document processing without truncation issues.
How are tokens billed?
You pay $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors and refusals are free. Credits are prepaid and never expire, ensuring you only pay for actual usage.
Get your key now
Sign up, copy your key, and update your base URL. That is all you need to do.