EN ▾
Open account

OpenAI-compatible endpoint quickstart

Start generating text with our uncensored LLM immediately using standard OpenAI-compatible endpoints. We provide a single, no-filter model accessible via simple HTTP requests or your preferred SDK.

Base URL and Authentication

Connect to our API using the standardized base URL and your unique key. Every request requires authentication via the Authorization header to ensure secure access to your prepaid credit.

Our endpoint structure mirrors the industry standard, allowing you to swap your existing OpenAI configuration with minimal friction. You do not need to manage complex routing or vendor lock-in; we handle the infrastructure while you focus on the application logic.

Generate your key instantly via the dashboard. Each account maintains one active key that replaces the previous one upon regeneration, keeping your security posture simple and transparent.

curl https://api.aiinferenceapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "What is the capital of France?"}]
  }'

Chat Completions Endpoint

Send your prompt to the chat completions endpoint to receive a direct text response from the uncensored model. This single endpoint handles all text generation without the overhead of embeddings or multimodal processing.

The model accepts a standard message array containing system, user, and assistant roles. It is tuned to answer without content refusals for lawful adult use, making it ideal for creative writing, roleplay, or unrestricted data analysis.

Keep your payloads concise. The maximum request body size is 8 MB, which comfortably fits most standard conversation histories before you reach the context limit.

from openai import OpenAI

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

Streaming and Token Usage

Enable real-time output by setting the stream parameter to true in your request. The API returns a Server-Sent Events (SSE) stream, allowing you to display tokens as they are generated.

Token usage statistics are included in the final chunk of the stream. This design keeps the payload lightweight during generation while ensuring you get accurate billing data for your prepaid credit.

Streaming reduces perceived latency for end-users. You can start rendering the response immediately, which is crucial for applications requiring interactive feedback loops or long-form content generation.

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

Structure your outputs for programmatic consumption using JSON mode or function calling. Set response_format to json_object to force the model into a strict JSON schema.

For tool usage, define your functions in the tools array. The model will return structured arguments that your code can parse and execute. This capability supports complex workflows without requiring external parsing libraries.

JSON mode is particularly useful when extracting data from unstructured text. It ensures consistent formatting, reducing the need for post-processing cleanup in your application logic.

import OpenAI from "openai";

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

Parameters: Temperature, Top P, and Stop

Control the creativity and termination of your responses using standard generation parameters. Adjust temperature for variability and top_p for nucleus sampling. Use the stop parameter to define specific sequences that signal the end of the output.

Setting a lower temperature produces more deterministic and focused results. Higher values introduce more randomness, which can be beneficial for brainstorming or creative storytelling tasks.

Define stop sequences to prevent the model from running indefinitely. This is essential for maintaining predictable token usage and ensuring your application receives a clean, delimited response.

Error Handling and Limits

Monitor your requests for common HTTP status codes to manage errors effectively. A 401 indicates an invalid or expired API key, while a 402 signals that your prepaid credit is exhausted.

The 429 rate limit triggers if you exceed 300 requests per minute or have more than 8 concurrent requests per key. Increase your throughput by distributing load across multiple keys or reducing request frequency.

Your context window supports 100,000 tokens for both prompt and completion combined. Be mindful of this limit to avoid truncation. Errors and refusals consume no tokens, so you only pay for actual generation.

Frequently asked questions

What is the context window size for the uncensored model?

The model supports a 100,000-token context window, combining both the input prompt and the output completion. The maximum output per request is 16,000 tokens, or 2,048 if you do not specify max_tokens.

How do I handle rate limits with the AI inference API?

You are limited to 300 requests per minute and 8 concurrent requests per API key. If you hit the 429 error, wait briefly or distribute your load across multiple generated keys. Each account maintains one active key at a time.

Does the model refuse content?

The model is uncensored and does not refuse lawful adult, fictional, or controversial topics. The only hard limit is the refusal of sexual content involving minors. Requests of that kind will be filtered out.

Retrieve your API key

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