EN ▾

Integrate uncensored LLM via OpenAI SDK

Drop in our uncensored LLM API gateway using the standard OpenAI SDK. Change your base_url and API key, then generate text without refusals.

https://api.gatewayapillm.com/v1uncensored

Install the official OpenAI SDK

Start by installing the library that handles the HTTP requests. This SDK works with our endpoint because we follow the same protocol.

  • Run pip install openai for Python.
  • Run npm install openai for Node.js.

Version 0.27.0 or higher is recommended for full streaming support. The library manages retries and JSON serialization automatically.

Configure base_url and API key

Point your SDK client to our specific gateway URL. This replaces the default OpenAI endpoint with our uncensored model server.

Set the environment variable OPENAI_BASE_URL to https://api.gatewayapillm.com/v1. Then provide your API key from the dashboard. You only need one key per account; generating a new one invalidates the previous.

This setup ensures all calls route directly to our uncensored infrastructure.

Send your first chat completion

Make a standard POST request to /v1/chat/completions. The model ID is simply uncensored. This returns a direct text response without content filters for lawful adult use.

Our context window supports 100,000 tokens total. You can request up to 16,000 output tokens per call. If you do not set max_tokens, the default is 2,048 tokens.

Enable streaming for real-time tokens

Use Server-Sent Events (SSE) for low-latency output. The SDK streams tokens as they are generated. This provides immediate feedback for long contexts.

Token usage statistics are included in the final chunk of the stream. You can track consumption in real-time without waiting for the full response. This is ideal for chat interfaces or live code generation.

Use tools and JSON mode

Function calling works exactly like the OpenAI standard. Define your tools in the tools parameter and let the model decide when to call them. Use response_format: {"type": "json_object"} for strict JSON outputs.

Parameters like temperature, top_p, stop, and seed are fully supported. This allows precise control over the model's behavior and output structure.

Check usage and handle errors

Monitor your prepaid credit balance via the dashboard. Errors and refusals do not consume tokens. Your credit never expires, so you can top up when needed.

Common HTTP errors include 401 (invalid key), 402 (insufficient credit), and 429 (rate limit). The limit is 300 requests per minute per key. Keep requests under 8 MB to avoid body size errors.

cURL

curl https://api.gatewayapillm.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Explain how to configure Nginx for reverse proxying HTTPS traffic to a local Node server"}]
  }'

Python

from openai import OpenAI

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

Node.js

import OpenAI from "openai";

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

Streaming

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)

Common questions

Is this an official OpenAI LLM API gateway?

No, we are an independent service hosting an uncensored model. We use the same interface and SDK compatibility, but the model is not GPT-4 or any other OpenAI product. You pay for token usage, not a subscription.

How do I pay for the uncensored LLM API?

Payments are prepaid via crypto only. We accept USDT (TRC20) or USDC (Base) in whole amounts from $20 to $500. Bonus credit ranges from 5% to 15% depending on the amount topped up.

What is the context window size?

The total context window is 100,000 tokens for both prompt and completion. You can generate up to 16,000 tokens in a single response. This allows for extensive document analysis or long conversations.

Get your API key instantly

Register, retrieve your key, and update the base URL. That is all.

Open account