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.
| Item | Value |
|---|---|
| Protocol | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| API key | Bearer token in the Authorization header |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.minicpm.top/v1 |
| Model | uncensored |
| Tools / tool calls | Yes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool |
| Max output | up to the rest of the 100,000-token window; max_tokens optional (no separate cap) |
| Sampling parameters | temperature, top_p, stop, seed and the two penalties are passed through |
| Max context | 100,000 tokens (prompt + completion together) |
| JSON mode | JSON object mode via response_format json_object |
| Streaming | Supported (stream: true), usage included at the end |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Requests per minute | 300 requests per minute per key |
| Concurrency | 8 requests at the same time per key |
| Request size | up to 8 MB per request |
| Bonus credit | +5% from $50, +10% from $100, +15% from $200 |
| How you pay | pay as you go from prepaid credit; nothing is charged for failed or refused requests |
| Credit expiry | no monthly fee; paid credit does not expire |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Token prices | input $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 |
| Account | Google or e-mail and password |
| Content | adult content allowed; sexual content involving minors is refused |
| Keys | one 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.
| Code | Type | Meaning |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | check the Authorization header or use your current key |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | refused by the content policy |
404 | not_found | unknown endpoint |
413 | request_too_large | request body larger than 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | temporary 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.