EN ▾

Uncensored Kimi API, OpenAI Compatible

Get your key
per 1M input tokens
$0.15
Output tokens / 1M
$0.50
token context
100,000
trial credit
$0.50
requests per minute
300

ApiKimiKimi api Key Comparison

https://api.apikimi.cc/v1

Last updated

Kimi API URL and base_url: OpenAI SDK Setup

The kimi api url you need depends on which service you are calling, and the OpenAI SDK only asks for two values to reach it: a base URL and a key. This page shows how that works, with working code for this site's endpoint and a checklist for the 404 and 401 errors that follow a wrong setting.

A glowing route from a server to an endpoint with signposts and a lens, illustrating finding the right API URL

Summary

  1. For this API the base URL is https://api.apikimi.cc/v1 and the model ID is uncensored.
  2. Authentication is Authorization: Bearer <key>; the SDK adds it for you.
  3. 404 almost always means the path is wrong, 401 means the key is missing or invalid.
  4. For the official Kimi platform, copy the URL from its own documentation.

What base_url actually is

An OpenAI-compatible API is a set of paths under a common prefix. The prefix is the base URL. The SDK appends the endpoint path to it, so the final address is base_url + /chat/completions.

For this site the base URL is:

https://api.apikimi.cc/v1

The chat endpoint is then https://api.apikimi.cc/v1/chat/completions. The other supported methods are POST /v1/responses and GET /v1/models. The model ID to put in requests is uncensored.

This is not the official Kimi service. It hosts a single open-weight model, run by an independent provider, behind a compatible endpoint. If your goal is the vendor's own platform, take the base URL from that vendor's documentation, because we do not publish it here and do not know if it changes. Everything below about how base URLs work applies to either one. For a side-by-side look at the keys, see Kimi api Key Comparison.

Finding the URL for any provider

For a service other than this one, look for a "quickstart" or "API reference" page. The base URL is usually shown in the first example, either in a curl command or in the client constructor. Copy it exactly, including the version segment at the end. Then confirm with a call to the models endpoint before you write any application code. If the models call returns a list, the URL and key are correct and everything else is a matter of parameters.

Python setup

Install the SDK with pip install openai, then pass the two values to the client.

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": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Give me one tip for naming variables."},
    ],
    temperature=0.7,
)
print(resp.choices[0].message.content)

You can also set the values through environment variables, which keeps keys out of source code. The Python SDK reads OPENAI_API_KEY and OPENAI_BASE_URL when you do not pass them explicitly.

export OPENAI_API_KEY="YOUR_KEY"
export OPENAI_BASE_URL="https://api.apikimi.cc/v1"
python app.py

Async and concurrency

For many requests at once, use the async client and limit parallelism to the 8 concurrent requests a full key allows (2 on the trial key).

import asyncio
from openai import AsyncOpenAI

client = AsyncOpenAI(base_url="https://api.apikimi.cc/v1", api_key="YOUR_KEY")
sem = asyncio.Semaphore(8)

async def ask(prompt):
    async with sem:
        r = await client.chat.completions.create(
            model="uncensored",
            messages=[{"role": "user", "content": prompt}],
        )
        return r.choices[0].message.content

async def main():
    answers = await asyncio.gather(*(ask(f"Define term {i}") for i in range(20)))
    print(len(answers))

asyncio.run(main())

The semaphore keeps you under the concurrency limit, so you avoid 429 errors with the code concurrency instead of retrying after them.

Node and curl

In Node, the option is called baseURL (camel case), not base_url.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.apikimi.cc/v1",
  apiKey: process.env.API_KEY,
});

const stream = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Stream a haiku about nginx." }],
  stream: true,
});

for await (const part of stream) {
  process.stdout.write(part.choices[0]?.delta?.content ?? "");
}

With curl you write the full URL yourself, so it is the easiest way to isolate a problem.

curl https://api.apikimi.cc/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"ping"}]}'

Streaming is done over server-sent events with stream: true, and usage arrives at the end. Get a key at Get API key; new users can claim $0.50 of trial credit with one click.

The Responses endpoint and JSON mode

Besides chat completions, the API supports POST /v1/responses. Your base URL stays the same; only the path changes.

curl https://api.apikimi.cc/v1/responses \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","input":"Name three uses of a hash map."}'

JSON mode is enabled on chat completions with response_format. Mention JSON in the prompt as well, so the model knows what shape to produce.

r = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Return a JSON object with keys city and country for Paris."}],
    response_format={"type": "json_object"},
)
print(r.choices[0].message.content)

404 and 401 checklist

Most failures come from a handful of typos. Go through them in this order.

HTTP 404

SymptomCauseFix
404 on every callMissing /v1 in the base URLUse https://api.apikimi.cc/v1
404 with a doubled pathFull endpoint pasted as base URLRemove /chat/completions from the base URL
404 on a custom clientWrong method pathUse /v1/chat/completions, /v1/responses or /v1/models
Cannot connectTypo in the host nameCompare the host character by character

HTTP 401

  • The key is missing: the environment variable is empty in the shell that runs your app.
  • A trailing space or newline got pasted with the key.
  • You are sending a key from another provider. Keys are not shared between services.
  • A custom HTTP client sends the key in the wrong header. It must be Authorization: Bearer <key>.

HTTP 429

This is a limit, not a configuration error. The code rate_limited means over 300 requests per minute (60 on the trial key). The code concurrency means too many at once: 8 on a full key, 2 on the trial key. Overload also returns 429 with Retry-After: 5.

A two-minute verification

Before debugging your app, prove the pieces one at a time.

  1. List models. curl https://api.apikimi.cc/v1/models -H "Authorization: Bearer YOUR_KEY". A list that contains uncensored proves the URL and key are correct.
  2. One chat call. Use the curl example above. If it works, your network and account are fine.
  3. Check the headers. The response carries X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. They confirm the key type and remaining balance.
  4. Then the SDK. If curl works and the SDK fails, the problem is in how you passed the base URL, usually a trailing path or a camel case slip.

A request goes through only when the body is under 8 MB and the total of prompt and completion fits the 100,000-token window. Full details are in the docs.

Reading the response

A successful chat response follows the OpenAI format. The answer is in choices[0].message.content. The field finish_reason tells you why generation stopped: a normal end, a length cut-off, or a tool call. Token counts are in usage.prompt_tokens and usage.completion_tokens, and these two numbers are what you are billed on. If any of them is missing, you are probably not looking at a response from this endpoint, which is another sign that the base URL points somewhere else.

SDK gotchas that look like URL problems

Some errors that appear to be about the address have other causes.

  • Using the wrong client class. Some SDKs ship a separate class for a specific cloud vendor's hosted variant with its own URL scheme. Use the plain OpenAI client with a custom base URL.
  • Parameter names in wrappers. Frameworks that wrap the SDK may name the option differently, such as an api base or a base URL setting. Check your version's documentation.
  • Proxies. A corporate proxy can block unknown hosts, which looks like a timeout or a connection reset. Test with curl from the same machine.
  • Old SDK versions. Very old releases of the Python SDK used module-level settings instead of a client object. Upgrade with pip install -U openai if the examples above do not run.
  • Timeouts on long outputs. A large completion takes time. Use streaming or raise the client timeout rather than assuming the URL is wrong.

The completion can use the rest of the 100,000-token window if you do not set max_tokens, so for quick tests set a small cap and avoid long waits.

Switching between two compatible endpoints

The same code can talk to the official platform, to this API or to a local server, as long as each exposes the OpenAI format. Keep the three values in configuration.

import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ.get("LLM_BASE_URL", "https://api.apikimi.cc/v1"),
    api_key=os.environ["LLM_API_KEY"],
)
MODEL = os.environ.get("LLM_MODEL", "uncensored")

Remember that the model name belongs to the endpoint. A name that is valid on one service means nothing on another, so change all three values together. Pricing here is $0.15 per 1M input tokens and $0.50 per 1M output tokens; see pricing for top-ups.

Frequently asked questions

View documentation
What is the base URL for this API?

https://api.apikimi.cc/v1. The SDK adds /chat/completions for chat requests, and the model ID is uncensored.

Why do I get 404 even though my key is right?

The path is wrong. Check that the base URL ends in /v1 and does not already include /chat/completions.

Which header carries the key?

Authorization: Bearer followed by your key. The official SDKs set it automatically from the api_key option.

Is this the official Kimi endpoint?

No. It is an OpenAI-compatible API for one open-weight model run by an independent provider. For the official platform, use the URL in that vendor's documentation.

Generate your API key

Register, retrieve the key, and update your base URL. Simple integration.