EN ▾
Start now

Apertus ia API Documentation

Connect your existing tools to uncensored ia with a single API key and the standard OpenAI-compatible endpoint.

1. Quickstart: Connect Your First Request

The base URL is https://api.apertusia.com/v1. Pass your API key in the Authorization header. The model identifier is uncensored. This setup works with any OpenAI-compatible client.

Use this cURL command to test connectivity immediately. Replace YOUR_API_KEY with your actual key.

curl https://api.apertusia.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the top 5 python libraries for web scraping"}]
  }'

Authentication errors return 401. Insufficient funds return 402. Rate limits return 429.

2. Supported Parameters: Temperature, Top P, and Seed

Control randomness with temperature, diversity with top_p, and reproducibility with seed. These parameters follow standard OpenAI conventions. Set temperature to 0.7 for balanced output or 1.0 for higher creativity. Use top_p to limit sampling to the top probability mass. The seed parameter ensures identical outputs for debugging.

Example Python snippet for local testing:

from openai import OpenAI

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

3. Streaming Responses with Server-Sent Events

Enable streaming by setting stream: true. The API returns chunks via Server-Sent Events. Each chunk contains partial text and token usage data. This reduces perceived latency for long responses. Handle SSE events to update your UI in real time.

Node.js example using the official SDK:

import OpenAI from "openai";

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

4. Function Calling and JSON Mode Configuration

Use response_format with {"type": "json_object"} for strict JSON output. This ensures structured data for programmatic pipelines. Enable function calling by providing a tools array in the request body. The model will return tool calls in the expected format. Use tool_choice to force specific behavior.

5. Rate Limits and Request Size Constraints

Each API key supports 300 requests per minute. Concurrent requests are limited to 8 per key. The maximum request body size is 8 MB. The context window holds 100,000 tokens total. Max output per request is up to the full 100,000-token window. Leave max_tokens unset, or set it high, to avoid truncation. Errors do not consume credit. Refunds are not issued, but billing errors are corrected via Support.

6. Authentication and Error Handling

Generate your key via the dashboard. Use Google login or email. The key appears immediately. Include it in the Authorization: Bearer header. Invalid keys return 401. 429 errors indicate rate limit exhaustion. 402 errors mean your prepaid credit is exhausted. Top up with USDT or USDC. Credits never expire.

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 queries

What is the uncensored ia model context window?

The model supports a 100,000 token context window. This includes both the prompt and the completion. There is no separate output cap: a response can use all the room left in the window.

How do I handle streaming responses in Python?

Set the <code>stream</code> parameter to <code>true</code> in your request. Iterate over the response object to process each chunk. Use the official SDK for automatic SSE parsing.

What happens if I hit the rate limit?

The API returns a 429 status code. You can retry after a short delay. Each key allows 300 requests per minute. Increase concurrency by generating additional keys if needed.

Secure your key now

Register, grab the key, point to our endpoint. Done.