ru ▾
Create key

Integration Guide for Developers

Get your uncensored AI API running in minutes with our OpenAI-compatible endpoint. This guide covers the essential Python, Node, and streaming integrations for low-cost, unrestricted generation.

Quickstart: First Request in Python

Start generating text immediately using the official OpenAI Python SDK. Point the client to our base URL and supply your API key from the dashboard. The model ID is uncensored. This setup works for any standard chat completion request.

  • Install the package via pip install openai.
  • Set the environment variable or pass it directly in the client init.
  • Send your prompt and receive the completion.

This approach ensures you are using the raw, unrestricted model without any hidden filters interfering with your output.

from openai import OpenAI

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

Chat Completions Endpoint Details

Interact with the API by sending POST requests to the chat completions endpoint. You can use any HTTP client or library that supports standard JSON payloads. The endpoint is POST /v1/chat/completions.

  • Include your API key in the Authorization header.
  • Set the model field to uncensored.
  • Provide your messages in the messages array.

You can also retrieve available models using GET /v1/models. This endpoint confirms your connectivity and API key validity.

curl https://api.cheapestapillm.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Calculate the cost per token for 1 million requests"}]
  }'

Streaming Responses and Token Usage

Enable streaming by setting stream: true in your request. This returns data as Server-Sent Events (SSE) chunks. Each chunk contains partial text and token usage details.

  • Process chunks as they arrive for real-time display.
  • Check the final chunk for total token counts.
  • Handle interruptions gracefully if the connection drops.

Streaming is ideal for long responses or interactive applications where latency matters. You pay only for the tokens actually generated.

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)

Function Calling and JSON Mode

Use structured outputs for reliable data extraction. Set response_format to {"type": "json_object"} to enforce JSON output. This ensures your parser receives consistent data.

  • Define tools in the tools parameter for function calling.
  • Specify tool_choice to control when functions are invoked.
  • Parse the JSON response in your application logic.

This feature is essential for building automated workflows or integrating with other systems. It works seamlessly with the uncensored model.

import OpenAI from "openai";

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

Rate Limits and Constraints

Each API key is limited to 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. The context window supports up to 100,000 tokens total.

  • Monitor your usage to avoid hitting limits.
  • Implement retry logic with exponential backoff.
  • Keep prompts concise to stay within token limits.

If you exceed the rate limit, you will receive a 429 error. Adjust your request frequency or upgrade your prepaid credit to maintain throughput.

Error Handling and Pricing

Understand common errors to debug quickly. A 401 error indicates an invalid API key. A 402 error means your prepaid credit is exhausted. A 429 error signals rate limiting.

  • Check your account balance for 402 errors.
  • Verify your API key for 401 errors.
  • Reduce request frequency for 429 errors.

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors do not consume credits. This transparent model ensures you know exactly what you are paying for.

Frequently asked questions

What is the cheapest API LLM option for uncensored generation?

Our service offers the cheapest API LLM rate at $0.15 per 1M input tokens and $0.50 per 1M output tokens. You pay only for what you use with no monthly subscription or minimum spend required.

Is the uncensored AI API compatible with OpenAI SDKs?

Yes, our API is fully OpenAI compatible. You can use the official OpenAI Python, Node, or any other SDK by simply changing the base URL to <code>https://api.cheapestapillm.com/v1</code> and providing your API key.

How do I handle errors when using the uncensored AI API?

Common errors include 401 for invalid keys, 402 for insufficient credit, and 429 for rate limits. Each error has a specific resolution, such as topping up your crypto credit or waiting for the rate limit window to reset.

Get your API key

Register, copy your key, update the endpoint. That is all.