EN ▾

First request in five minutes

Drop our base URL into your existing client config and start sending text. This guide covers the exact endpoints, parameters, and constraints for the uncensored MiniCPM API.

Base URL & Authentication

Start by updating your client configuration to point to our endpoint. The API is fully OpenAI-compatible, meaning you can reuse existing SDKs by simply swapping the base URL and API key. Authentication relies on a single bearer token generated during signup. If you receive a 401 error, your key is either invalid or expired. Keep your key secure; it provides direct access to your prepaid credits. You can generate a new key at any time, which immediately invalidates the previous one.

Chat Completions Endpoint

Send requests to POST /v1/chat/completions. The model identifier is uncensored. This endpoint handles text-in, text-out interactions. You can control generation behavior using parameters like temperature, top_p, and stop. The model supports a context window of 100,000 tokens total. Remember that there is no separate output cap, so the response can run to the end of the window unless you lower the max_tokens limit. Errors and refusals do not consume your credits, so you can experiment freely.

Streaming Responses

For low-latency applications, enable streaming by setting stream: true in your request. The server returns a sequence of Server-Sent Events (SSE). Each chunk contains a partial delta of the response. The final chunk includes the complete token usage statistics, allowing you to track costs in real-time. This is ideal for building chat interfaces where you want to display tokens as they are generated. Use the appropriate SDK method to handle the stream iterator.

Function Calling & Tools

The API supports tool definitions and function calling. Define your tools in the tools parameter and specify tool_choice to let the model decide or force a specific function. The model returns tool calls in the response object, which you then execute and feed back into the conversation. This enables complex workflows without external parsing logic. Ensure your tool definitions follow standard OpenAI-compatible schemas for best compatibility.

JSON Mode

When you need structured data, set response_format to {"type": "json_object"}. The model will constrain its output to valid JSON. This is useful for extracting entities, generating config files, or powering other applications. While the model is tuned for natural language, JSON mode improves consistency for programmatic outputs. Always validate the JSON response in your client code, as no schema enforcement is applied on the server side.

Rate Limits & Constraints

Each API key is limited to 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. If you exceed the rate limit, you will receive a 429 error; implement exponential backoff in your client. If your prepaid credit is exhausted, you will get a 402 error. Credits are prepaid and never expire. You can top up by crypto (USDT on TRC20, USDC on Base) starting from $20. Errors do not consume credits.

cURL

curl https://api.minicpm.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.minicpm.top/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.minicpm.top/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)

What the API supports

A quick checklist for developers: format, limits, features, billing.

ItemValue
ProtocolOpenAI Chat Completions schema; official openai SDKs work unchanged
API keyBearer token in the Authorization header
MethodsPOST /v1/chat/completions · GET /v1/models
Base URLhttps://api.minicpm.top/v1
Modeluncensored
Tools / tool callsYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
Max outputup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Sampling parameterstemperature, top_p, stop, seed and the two penalties are passed through
Max context100,000 tokens (prompt + completion together)
JSON modeJSON object mode via response_format json_object
StreamingSupported (stream: true), usage included at the end
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Requests per minute300 requests per minute per key
Concurrency8 requests at the same time per key
Request sizeup to 8 MB per request
Bonus credit+5% from $50, +10% from $100, +15% from $200
How you paypay as you go from prepaid credit; nothing is charged for failed or refused requests
Credit expiryno monthly fee; paid credit does not expire
Paymentcrypto: USDT on TRON or USDC on Base, $20–$500, any whole sum
Token pricesinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Trial credit$0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up
AccountGoogle or e-mail and password
Contentadult content allowed; sexual content involving minors is refused
Keysone key per account, regenerate any time (the old one stops working)

Error reference

Every error is JSON with a type you can switch on. You are never charged for an error.

CodeTypeMeaning
400bad_requestmalformed request or too long for the context window
401missing_key · invalid_key · key_revokedcheck the Authorization header or use your current key
402no_creditbalance is empty — top up, requests resume at once
403content_blockedrefused by the content policy
404not_foundunknown endpoint
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busytemporary overload, retry shortly

Questions and answers

Does the model refuse adult content?

The model is uncensored and does not refuse lawful adult, fictional, or controversial topics. However, it will always refuse sexual content involving minors, which is a hard limit applied to all requests.

How are errors billed?

Errors and refusals are free. If the model returns an error or refuses a request due to content policies, you are not charged for those tokens. You only pay for successful token generation.

Can I use multiple API keys?

Each account is limited to one active API key at a time. If you generate a new key, the previous one is immediately invalidated. This simplifies billing and security tracking.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key