https://api.apikimi.cc/v1
Kimi api Quickstart Guide
Get started with our uncensored LLM API in minutes using standard OpenAI compatible clients. This guide covers authentication, request formats, and streaming setup for rapid integration.
Prerequisites: SDK Installation
Install the official SDK for your preferred language to handle authentication and serialization automatically. Our API adheres to the OpenAI standard, so any compatible client library works with minimal configuration changes.
For Python, install the library via pip. For Node.js, use npm or yarn. These tools manage the HTTP client and JSON parsing for you.
Authentication: Setting Your kimi API key
Obtain your key from the dashboard and pass it as the Authorization header. Use the base URL https://api.apikimi.cc/v1 for all requests.
Store the key securely in your environment variables or configuration files. The header format is Bearer YOUR_API_KEY.
Sending Your First Request
Send a POST request to /v1/chat/completions with your model ID uncensored. The response returns the generated text directly.
Ensure you set the model field correctly. The API returns raw output without content refusals for lawful topics.
Streaming Responses
Enable streaming by setting stream: true in your request body. This returns chunks as Server-Sent Events (SSE).
Parse the SSE stream to display tokens in real time. The final chunk includes the token usage statistics for billing.
Function Calling Setup
Define tools in the tools array within your request. The model returns tool calls instead of direct text when appropriate.
Handle the tool calls in your application logic and send the results back to the API for further processing. Support for tool_choice allows strict enforcement.
Error Handling and Limits
Handle standard HTTP errors: 401 for invalid keys, 402 for insufficient credit, and 429 for rate limits. The context window supports 100,000 tokens total.
Max output is 16,000 tokens per request. Errors do not consume credit. Adjust your retry logic based on the error code.
cURL
curl https://api.apikimi.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the key differences between Rust and Go memory management"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.apikimi.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)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.apikimi.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);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)Frequently asked questions
View documentationWhat is the kimi API base URL?
The base URL is HTTPS://api.apikimi.cc/v1. Use this for all API requests to ensure compatibility with standard OpenAI clients.
How do I handle streaming responses?
Set the stream parameter to true in your request. The API returns data as Server-Sent Events, allowing you to process tokens as they are generated.
What happens if I get a 402 error?
A 402 error indicates insufficient prepaid credit. Top up via crypto (USDT or USDC) to resume service. Errors themselves do not consume credit.
Generate your API key
Register, retrieve the key, and update your base URL. Simple integration.