Ki api integration guide
This guide covers the Ki API integration for uncensored text generation using standard OpenAI-compatible endpoints. You get direct access to an unrestricted model with transparent per-token billing and no subscription locks.
Base URL and authentication
The API lives at https://api.kiapi.cc/v1. You get one active key per account, shown immediately after signup via Google or email. Change the base_url in your client and set the Authorization header to Bearer YOUR_KEY. This works with any standard OpenAI SDK.
- Base URL:
https://api.kiapi.cc/v1 - Header:
Authorization: Bearer YOUR_KEY
curl https://api.kiapi.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "fetch latest version from github repo"}]
}'
Chat Completions endpoint
Send messages to POST /v1/chat/completions. Use the model ID uncensored for unrestricted outputs. The endpoint accepts standard chat formats with a context window of 100,000 tokens total. It returns text responses without content refusals for lawful adult use. No embeddings or image generation are available here.
from openai import OpenAI
client = OpenAI(base_url="https://api.kiapi.cc/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 responses (SSE)
Enable streaming by setting stream: true. You receive server-sent events (SSE) for real-time token delivery. The final chunk contains the full usage statistics for billing. This is ideal for chat interfaces that need immediate partial responses. You can parse the SSE stream to update the UI instantly.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.kiapi.cc/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);
Function calling and JSON mode
Use response_format: {"type": "json_object"} for strict JSON outputs. The API supports tool definitions and tool choices for function calling. You can define custom tools in the tools array. The model will respond with structured data when required. This works alongside standard text 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)
Model parameters and limits
Supports temperature, top_p, stop, seed, and penalty parameters. Max output is 16,000 tokens per request. You can send up to 300 requests per minute. Concurrency is limited to 8 simultaneous requests per key. The request body must stay under 8 MB. These limits ensure stable performance for uncensored generation tasks.
Token usage and billing
Input tokens cost $0.15 per million. Output tokens cost $0.50 per million. Errors and refusals are free. Credit is topped up via crypto only. Prepaid credit never expires. You pay only for real token usage. No monthly subscription fees apply. The system tracks usage accurately for billing.
FAQ
What is the Ki API base URL?
The base URL is HTTPS://api.kiapi.cc/v1. You use this for all OpenAI-compatible clients. Change the base URL in your SDK configuration to point here.
How do I handle streaming responses?
Set stream to true in your request. You receive SSE events with partial text. The final event contains the token usage data. Parse the stream to update your UI in real time.
What are the rate limits?
You get 300 requests per minute. Concurrency is limited to 8 simultaneous requests. The request body must stay under 8 MB. These limits apply per API key.
Get your API key
Register, copy your key, and point to the base URL. That’s it.