Create key
Create key

Uncensored LLM API Documentation

Get started with our uncensored LLM API in minutes. Drop your API key into any OpenAI-compatible client and send your first prompt.

Base URL and Authentication

Our API lives at https://api.huggingfacellmapi.com/v1. You authenticate using a Bearer token sent in the Authorization header. Generate your key instantly via the Get API key page using Google or email. Keep this key secure; anyone with it can spend your prepaid credits. If you lose it, generate a new one to replace the old active key. No phone number is required to start.

First Request with cURL

Send a raw JSON payload to test the endpoint immediately. Use the model ID uncensored to bypass standard filters. The following cURL command demonstrates a basic text generation request.

curl https://api.huggingfacellmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Summarize the release notes for version three point zero five"}]
  }'

This returns a JSON object containing the generated text. Check the choices array for the actual content. If you receive a 401 error, verify your key is correct and active.

Python SDK Integration

Use the official openai Python library for a clean interface. Point the client to our base URL and set your API key. This approach handles retries and JSON parsing automatically.

from openai import OpenAI

client = OpenAI(base_url="https://api.huggingfacellmapi.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)

Install the package via pip. You can then call the chat completions endpoint just like you would with OpenAI. The response object gives you access to token usage and finish reasons.

Node.js Client Setup

JavaScript developers can use the openai Node package. Configure the client with our specific base URL. This ensures all requests route through our uncensored servers.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.huggingfacellmapi.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);

Run this snippet in your Node environment. It demonstrates a simple synchronous call. You can integrate this into Express routes or serverless functions easily.

Streaming Responses

Enable streaming by setting stream: true. The server sends Server-Sent Events (SSE) containing partial tokens. This reduces perceived latency for end-users.

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 each chunk as it arrives. The final chunk contains the total token usage for the request. This is useful for building chat interfaces that type out responses in real-time.

Limits, Errors, and Context

The context window is 100,000 tokens for prompt and completion combined. You can request up to 16,000 output tokens. Errors like 401 indicate an invalid key, while 402 means insufficient credit. Rate limits cap you at 300 requests per minute. Requests exceeding 8 MB in size will be rejected. Errors during processing do not consume your credits.

Common questions

What is the base URL for the uncensored LLM API?

Use HTTPS://api.huggingfacellmapi.com/v1 as your base URL. This endpoint is compatible with standard OpenAI SDKs and clients. You must update the base URL in your configuration to route requests to our servers.

How do I handle rate limits and errors?

You are limited to 300 requests per minute and 8 concurrent requests per key. A 429 error indicates you have hit the rate limit. Wait a few seconds and retry. A 402 error means your prepaid credit is exhausted; top up via crypto to continue.

What happens if the API returns an error?

Errors such as 500 server errors or timeouts do not consume your prepaid credits. Only successful token generation counts against your balance. If you experience a double charge, contact support through the Support page for a refund of your credit.

Get your API key now

Sign up, copy the key, update the base URL. Done.