The API for uncensored AI models
Integrate the AI API: Python, Node and curl in 10 minutes

An AI API is a web interface through which your code sends text to a language model and receives the response back. This guide takes you from key to first working call in around ten minutes.
Updated

Key points
- An AI API is an HTTP endpoint: you send JSON, you receive JSON or a stream.
- The interface is OpenAI-compatible: swap base URL and key, model is uncensored.
- Streaming, JSON mode and tool calling are directly available via parameters.
- For HTTP 429, the error code distinguishes between the rate limit and concurrent requests.
What an AI API actually is
A language model runs on servers with lots of GPU memory. You don't have to run it yourself: you send a request via HTTPS to an address and get text back. This address along with its rules is called an API. Payment is per token, which are roughly word parts. With us, 1 million input tokens cost $0.15 and 1 million output tokens cost $0.50.
The structure is always the same. You send a list of messages with roles (system, user, assistant) and a model name. The model responds with the next message. It remembers nothing between two calls; you provide the history yourself each time.
Prerequisites: key and base URL
You need two things: an API key and the base URL. The interface follows the OpenAI format, so every OpenAI SDK and every compatible client works as soon as you have both.
- Base URL:
https://api.kiapis.com/v1 - Model:
uncensored - Authentication: Header
Authorization: Bearer <key>
You generate the key after signing in (Google or email with password) on the Get API key page. New users can claim $0.50 trial credit once, without payment details and valid for 7 days. That is enough for this entire guide.
Regarding model selection details: there is exactly one model, an open-weight model from an independent provider. It is not an official API from a major manufacturer and is text-only.
First call: curl, Python, Node
First curl, because it needs nothing but the terminal:
curl https://api.kiapis.com/v1/chat/completions \
-H "Authorization: Bearer $KI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "Du antwortest knapp auf Deutsch."},
{"role": "user", "content": "Was ist ein Token?"}
]
}'The same in Python with pip install openai:
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.kiapis.com/v1", api_key=os.environ["KI_KEY"])
r = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "Du antwortest knapp auf Deutsch."},
{"role": "user", "content": "Was ist ein Token?"},
],
)
print(r.choices[0].message.content)And in Node.js with npm install openai:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.kiapis.com/v1",
apiKey: process.env.KI_KEY,
});
const r = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Was ist ein Token?" }],
});
console.log(r.choices[0].message.content);In addition to POST /v1/chat/completions there are POST /v1/responses and GET /v1/models. The remaining balance is available via GET /v1/balance, and it is also in the response header X-Balance-USD.
The parameters you really need
The API passes temperature, top_p, stop, seed and the penalty parameters to the model. In practice, usually a few controls are enough:
| Parameter | Effect | Rule of thumb |
|---|---|---|
temperature | Variance in word choice | low (0 to 0.3) for extraction, higher (0.7 to 1) for creative |
max_tokens | Upper limit of response length | optional; set it to cap costs |
stop | Cancellation text | useful for structured outputs |
seed | Reproducibility | for testing; passed through |
stream | Response in chunks | true for chat interfaces |
The context window is 100,000 tokens for prompt and response combined. The request body must not exceed 8 MB.
Streaming, JSON mode, and Tool-Calling
With stream: true, tokens arrive via Server-Sent Events. At the end, you receive the usage details.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Zähle von eins bis fünf."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)For machine-readable responses, enable JSON mode and specify the fields you want in the prompt:
r = client.chat.completions.create(
model="uncensored",
response_format={"type": "json_object"},
messages=[{"role": "user", "content": "Gib Name und Hauptstadt von Frankreich als JSON mit den Feldern land und hauptstadt."}],
)
print(r.choices[0].message.content)Function calling works via tools and tool_choice. The model then returns tool_calls; you send your response to the call back as a message with role: "tool". Even with streaming, tool_calls arrive in chunks. The full schema is in the documentation.
Managing a conversation: send the history yourself
Since the API does not store state, you must build the history yourself. After each response, append it to the list and resend everything in the next request.
verlauf = [{"role": "system", "content": "Du bist ein hilfsbereiter Assistent."}]
def sag(text):
verlauf.append({"role": "user", "content": text})
r = client.chat.completions.create(model="uncensored", messages=verlauf)
antwort = r.choices[0].message.content
verlauf.append({"role": "assistant", "content": antwort})
return antwort
print(sag("Ich heiße Mara."))
print(sag("Wie heiße ich?"))Each round is calculated as input, so long conversations become more expensive. Truncate or summarize old messages if you approach the 100,000-token window.
Error codes and how to handle them
In case of issues, the API responds with an HTTP status code and a JSON error object. The most important cases:
- 401: The key is missing or incorrect. Check headers and typos.
- 404: Usually,
/v1is missing from the base URL. - 429 with code
rate_limited: too many requests per minute (300 with full key, 60 with test key). - 429 with code
concurrency: too many parallel requests (8 or 2). A streaming request holds its place until the end of the stream. - 429 with header
Retry-After: 5: temporary overload, retry after 5 seconds.
A simple retry mechanism is usually sufficient:
import time
from openai import RateLimitError
def frage(text, versuche=4):
for i in range(versuche):
try:
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": text}],
)
return r.choices[0].message.content
except RateLimitError:
time.sleep(5 * (i + 1))
raise RuntimeError("Zu viele Wiederholungen")Failed or rejected requests are not charged, so retries only cost if they succeed.
Monitor costs
A request with 1,500 input tokens and 400 output tokens costs 1,500 / 1,000,000 × $0.15 = $0.000225 plus 400 / 1,000,000 × $0.50 = $0.0002, totaling $0.000425. A thousand such requests cost $0.425. You can top up any whole amount from $20 to $500, paid with USDT on TRC20 or USDC on Base. From $50 you get a +5% bonus, from $100 +10%, from $200 +15%. The balance never expires. All rates are on the pricing page.
Finally, a note on content: The model is tuned for responses without refusal for lawful adult use. Sexual content involving minors is excluded. The production topic deepens the uncensored AI checklist.
Further guides
Frequently Asked Questions
Do I need programming skills for an AI API?
Basic knowledge of Python or JavaScript is sufficient. Even curl in the terminal is enough to try it out.
Will my existing OpenAI code work?
Usually yes. You change the base URL and key and set the model to uncensored. The request format remains the same.
Can the API generate images or audio?
No, the API is text-only. There is no image, audio, or video generation, no embeddings, and no fine-tuning.
How long can a prompt be?
The prompt and response share a 100,000-token window. The request body must not exceed 8 MB.
Your key is just one click away
Create an account, copy the key, adjust the base URL. That’s it.