Kimi API Base URL and How to Set It Up
If you are looking for the kimi api base url for this service, it is https://api.kimiapi.top/v1, used with the model ID uncensored. This page shows where to paste it in each SDK and app, and how to fix the usual errors.
Key points
- Base URL: https://api.kimiapi.top/v1, model ID uncensored, auth with a Bearer key.
- Set it once in the OpenAI SDK, or through the OPENAI_BASE_URL and OPENAI_API_KEY environment variables.
- Do not append /chat/completions to the base URL in an SDK; the SDK adds the path itself.
- A GET request to /v1/models is the fastest way to check that the URL and key work.

The base URL and what goes with it
The service is an OpenAI-compatible text API, so the kimi api base url you need here is https://api.kimiapi.top/v1. Everything else you know from the OpenAI SDKs stays the same: you send a JSON body to POST /v1/chat/completions, you pass the key in an Authorization: Bearer header, and you read the answer from choices[0].message.content. Only three values change in your existing code.
- Base URL:
https://api.kimiapi.top/v1 - API key: the key you create on the API key page
- Model:
uncensored
One clarification, because the search term mentions a vendor name. This site is not the official API of Moonshot AI or of any other model maker, and it does not route requests to other vendors. It hosts one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. If you need the endpoint of a specific vendor, check that vendor's own documentation. If you want a drop-in OpenAI-style endpoint for this model, the address above is the one.
Two methods are available: POST /v1/chat/completions and GET /v1/models. There is no image, audio or embeddings endpoint, so do not point a client that needs those at this base URL.
Python: the openai package
In the official Python package you pass the base URL when you create the client. After that, every call goes through it.
from openai import OpenAI
client = OpenAI(
base_url="https://api.kimiapi.top/v1",
api_key="YOUR_API_KEY",
)
reply = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(reply.choices[0].message.content)
print(reply.usage)The usage object at the end tells you how many prompt and completion tokens the call used, which is handy when you want to check cost against the pricing page. Keep the trailing /v1 in the base URL. The SDK appends /chat/completions on its own, so a base URL that already ends with that path produces a doubled address and an error.
Node.js and curl
The Node package takes the same two options. The property is called baseURL with a capital URL.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.kimiapi.top/v1",
apiKey: process.env.API_KEY,
});
const reply = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Name three uses of a base URL." }],
});
console.log(reply.choices[0].message.content);With curl there is no SDK, so you write the full path yourself: the base URL plus /chat/completions.
curl https://api.kimiapi.top/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "uncensored", "messages": [{"role": "user", "content": "Hello"}]}'This is the one place where you do append the path. In an SDK you give the base only; in a raw HTTP call you give base plus endpoint. Most setup mistakes come from mixing the two.
Set it with environment variables
If you do not want a URL in your source code, the official OpenAI libraries read two environment variables when you create a client without arguments: OPENAI_BASE_URL and OPENAI_API_KEY. This is also the easiest way to switch a whole project, because tools built on top of those libraries usually pick the variables up without any code change.
export OPENAI_BASE_URL="https://api.kimiapi.top/v1"
export OPENAI_API_KEY="YOUR_API_KEY"
# then, in code: OpenAI() with no arguments, and model="uncensored"
python my_script.pyKeep the key out of version control. A .env file that is listed in .gitignore, or the secret store of your hosting platform, is enough for most projects. If a key ever lands in a public repository, create a new one and stop using the old one.
LangChain and similar frameworks
Frameworks that wrap the OpenAI client expose the same two fields under their own names. In LangChain for Python, for example, ChatOpenAI accepts base_url, api_key and model.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.kimiapi.top/v1",
api_key="YOUR_API_KEY",
model="uncensored",
)
print(llm.invoke("One sentence about base URLs.").content)Chat apps and front ends with a custom endpoint
Many desktop and web front ends have a connection screen with a field for a custom OpenAI-compatible endpoint. SillyTavern, for instance, lets you add an OpenAI-compatible source, and other chat clients offer a similar option under names such as custom endpoint, OpenAI-compatible or proxy URL. The labels differ, the values do not.
- Pick the custom or OpenAI-compatible connection type.
- Paste
https://api.kimiapi.top/v1into the URL or endpoint field. - Paste your key into the key field.
- Type
uncensoredas the model name if the app does not list it automatically. Apps that callGET /v1/modelswill find it in the list. - Send a short test message before you load a long conversation or character card.
A few apps want the complete endpoint instead of the base, which means https://api.kimiapi.top/v1/chat/completions. If the field is labelled with that path, or the app's help text shows it in its example, follow the app. If the app shows only an address ending in /v1, use the base.
For role-play and companion apps for adults, the long chat history is the thing to watch. The context window is 100,000 tokens for prompt plus completion, so a very long saved conversation will eventually need trimming. The docs cover the request fields in more detail.
Check that the URL and key work
Before you debug your app, test the connection by itself. A model list request needs no body and answers quickly.
# the list should contain the model ID "uncensored"
curl -i https://api.kimiapi.top/v1/models \
-H "Authorization: Bearer $API_KEY"The -i flag prints response headers. Look for X-Request-Id, which support can use to find a specific call, and X-Balance-USD, which shows the credit left on the account. The rate limit headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency show the limits that apply to your key. If this call works but your app fails, the problem sits in the app's settings, not in the service.
Common mistakes and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| Not found (404) | Missing /v1, or the path was added twice | Use https://api.kimiapi.top/v1 in SDKs; add /chat/completions only in raw HTTP |
| Authentication error | Wrong key, missing Bearer prefix, or a leftover key for another service | Copy the key again from the key page and check the header |
| Model not found | A model name from another provider is still in the config | Set the model to uncensored |
| Connection refused or DNS error | Typo in the hostname, or an http:// address | Use https:// and the exact host shown above |
| HTTP 429 | Too many requests per minute or too many at once | Slow down and retry; trial keys allow 2 concurrent requests and 60 per minute, full keys 8 and 300 |
One more habit that saves time: keep the base URL in a single config value. If it appears in five files, one of them will be wrong after the next change. Streaming, tool calling and JSON mode all use the same base URL, so you never configure a second address for them. To stream, add stream: true to the request and read the server-sent events; the final chunk carries the usage numbers.
Keeping the URL in one place
A practical setup is a small settings module or a single environment variable that every script reads. When you move from a local test to a deployed service, you change one value, not a dozen string literals. It also makes it easy to run the same code against two endpoints during a comparison: one variable per endpoint, the same prompts, and a look at the answers side by side. The same idea helps teams, because a new colleague only needs the variable names and a key of their own.
Proxies and firewalls
If the request works from your laptop but fails from a server, the cause is often outbound network rules. The client must be able to reach the host over HTTPS on the standard port. A corporate proxy may need its own setting, and the OpenAI libraries respect the usual proxy environment variables of the underlying HTTP client. Test with the curl command above from the same machine that runs your code, because that separates a network problem from an SDK problem in one step.
More guides
Questions and answers
What is the base URL for this API?
It is https://api.kimiapi.top/v1. Use it with the model ID uncensored and a Bearer key from the API key page.
Is this the official Moonshot or Kimi endpoint?
No. It is an independent hosted API for one open-weight model, not the official API of any model vendor. For another vendor's endpoint, read that vendor's documentation.
Should the base URL end with /chat/completions?
Not in an SDK. SDKs add the path themselves, so give them the address ending in /v1. Raw HTTP clients such as curl need the full path.
Can I set the base URL without changing code?
Yes. Set OPENAI_BASE_URL and OPENAI_API_KEY in the environment, and create the client without arguments. Most tools built on the OpenAI libraries respect these variables.
How do I try it without paying?
After sign-up you can claim $0.50 of trial credit with one click on the API key page. It needs no card, is valid for 7 days and is limited to one per person.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.