Integrating MiniCPM Uncensored API: Step-by-Step Setup
This guide walks you through connecting your application to the uncensored text API. You will learn how to configure your client, manage authentication, and verify connectivity using the trial credit.

Understanding the API Endpoint and Model
Before writing any code, you need to understand where your requests are going. The service provides a hosted, OpenAI-compatible chat-completions API. This means you can use standard libraries that expect an OpenAI structure. The base URL for all requests is https://api.minicpm.cc/v1. You do not need to worry about complex routing or multiple endpoints. The only model available is identified by the string "uncensored". When you send a request, you specify this model ID to ensure you are interacting with the uncensored open-weight text model.
The API follows a strict text-in, text-out paradigm. There are no embeddings, image generation, audio processing, or video capabilities. If you need to generate images or convert speech to text, this API will not handle those tasks. It focuses solely on generating text responses based on your prompts. This simplicity allows for faster integration and lower latency for pure text workflows.
When you initialize your client, you must point it to the correct base URL. This ensures that your API key is validated against the correct service. The API supports standard HTTP methods for different operations. You will primarily use POST requests for generating completions and responses. You can also use GET requests to list available models, although there is only one.
It is important to note that this is an independent service. It is not an official product of any other company. When you see references to OpenAI compatibility, it refers to the protocol structure, not the model itself. The model here is uncensored, meaning it does not refuse lawful adult, fictional, or controversial topics. This makes it suitable for creative writing, role-playing, and research where strict content filters might interfere with the output.
Authentication and Key Management
Access to the API is controlled via API keys. You can sign up using your Google account or by creating an email and password. Once you create an account, your API key is shown immediately. You should copy this key and store it securely in your environment variables. The key is required for every request you make to the API. If you lose your key, you may need to generate a new one from your dashboard.
When you send a request, you must include the API key in the Authorization header. The format is typically Bearer followed by your key. If the key is invalid, the API will return a 401 error. This indicates that the key you provided does not exist or has been revoked. You should check your dashboard to ensure the key is active and has not been deleted.
The API also enforces rate limits to ensure fair usage. You are allowed 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. This means you have sent too many requests in a short period. You should implement exponential backoff in your application to handle these errors gracefully. This prevents your application from overwhelming the server during peak usage.
Errors are handled differently based on the cause. A 402 error indicates that you have no credit remaining. Since the service uses prepaid credit, you must top up before you can continue making requests. The API does not charge for errors or refusals, so you only pay for successful token usage. This can help you manage your budget more effectively, as you are not charged for failed attempts or content refusals.
Configuring the SDK for Integration
Integrating the API into your application is straightforward if you use a standard SDK. Most developers use the OpenAI Python or Node.js SDKs, as they are compatible with this API. You need to set the base URL to https://api.minicpm.cc/v1 and provide your API key. This allows you to use familiar methods like chat.completions.create without modifying the core logic of your application.
Once the SDK is configured, you can start sending requests. The API supports streaming over Server-Sent Events (SSE). This allows you to receive tokens as they are generated, providing a smoother user experience. You can enable streaming by setting the stream parameter to true. The usage information is included in the last chunk of the response, so you can track token consumption in real-time.
The API also supports function calling, which allows your application to interact with external tools. You can define tools in your request, and the model will return structured data that your application can execute. This is useful for building agents that can perform actions like searching the web or calculating values. You can also use JSON mode to force the model to output valid JSON, which is helpful for parsing responses in your code.
Parameters such as temperature, top_p, stop sequences, and seed are supported. These allow you to control the randomness and determinism of the output. For example, setting a low temperature makes the output more focused and deterministic. You can also set a seed to reproduce the same output multiple times. This is useful for testing and debugging your application to ensure consistent behavior.
Testing with Trial Credit and Pricing
Every new account receives $0.50 of trial credit, which allows you to test the API without immediate payment. This credit is sufficient for a moderate number of requests, allowing you to verify connectivity and test different parameters. You can use this trial to ensure that your integration is working correctly before committing to a purchase. It is a good way to evaluate the quality of the uncensored model for your specific use case.
The pricing is straightforward and based on token usage. You pay $0.15 per million input tokens and $0.50 per million output tokens. This means that the cost depends on the length of your prompt and the length of the response. Errors and refusals are free, so you only pay for the tokens that are actually generated. This can be cost-effective for applications that have frequent failed requests or long prompts with short responses.
To top up your account, you can use cryptocurrency. The service accepts USDT on the TRC20 network or USDC on the Base network. You can add any whole amount between $20 and $500. If you top up with $50 or more, you may receive a bonus credit ranging from 5% to 15%. This bonus is added to your account immediately after the payment is confirmed. There are no monthly fees or subscriptions, so you only pay for what you use.
It is important to note that paid credit never expires. You can top up once and use the credit over an extended period. This is beneficial for projects with sporadic usage patterns. You do not need to worry about losing your credit if you do not use it for a while. However, you cannot refund unused credit, so you should top up based on your estimated needs.
Reddit Community Insights and Common Questions
Developers often discuss MiniCPM models on Reddit, particularly in communities like r/LocalLLaMA. Users frequently ask about the efficiency of running MiniCPM models locally, especially regarding memory usage and quantization. Some users report that Fp16 or Q8_0 quantizations are sufficient for micro models, while others argue that preserving higher precision is necessary for certain tasks. These discussions highlight the versatility of the MiniCPM architecture across different hardware configurations.
Another common topic is the multimodal capabilities of newer MiniCPM variants, such as MiniCPM-o. Users are excited about the ability to handle vision and speech with relatively small parameter counts. Some developers are experimenting with full-duplex audio interfaces and WebRTC demos, noting that the latency is surprisingly low. These experiments show that the underlying technology is reliable enough for real-time interactive applications.
There is also interest in the robotic applications of MiniCPM, with models designed for manipulation and tracking. Users discuss the specs required for robotic arms and the integration of cameras. While some are skeptical about the ability of small models to control physical hardware, others are successfully using open-source parts to build custom setups. This suggests that the model's reasoning capabilities are improving rapidly.
When it comes to the API, users often ask how to best integrate it into existing workflows. The consensus is that the API is a great option for developers who want to avoid the overhead of running a local model. It provides a reliable, scalable solution for text generation without the need for dedicated GPU hardware. Users appreciate the uncensored nature of the model, which allows for more creative and unrestricted outputs.
When This API Is Not the Right Choice
While this API is excellent for text generation, it may not be the right choice for every project. If you need to generate images, audio, or video, this API will not handle those tasks. It is a text-only service, so you will need to use other tools for multimodal outputs. Similarly, if you need to convert speech to text or perform optical character recognition, you will need to integrate additional services.
The API also does not support fine-tuning. If you need to train the model on your specific dataset, you will need to use a different service that offers fine-tuning capabilities. The uncensored model here is a fixed model, so you cannot modify its weights or behavior beyond the parameters provided. This is a trade-off for the simplicity and speed of the API.
Another limitation is the lack of embeddings. If you need to build a retrieval-augmented generation (RAG) system, you will need to use a separate embedding API. The uncensored model can process the retrieved text, but it does not generate the embeddings itself. This means you will need to manage two different services for your RAG pipeline.
Finally, if you require high availability guarantees or specific certifications like SOC2 or HIPAA, this service may not meet your needs. The API does not claim any SLA percentages or certifications. It is an independent service focused on providing uncensored text generation. If you need enterprise-grade reliability or compliance, you should evaluate other options that offer those features.
Troubleshooting and Best Practices
When integrating the API, you may encounter common errors. A 401 error indicates an invalid key, so check your dashboard to ensure the key is correct. A 402 error means you have no credit, so you will need to top up using crypto. A 429 error indicates a rate limit, so you should implement backoff logic in your application. These errors are straightforward to resolve once you understand their causes.
To ensure smooth integration, always handle errors gracefully. Do not assume that every request will succeed. Implement retry logic for transient errors, but be careful not to overwhelm the server with retries. Use the streaming feature to provide a better user experience, especially for long responses. This allows users to see the output as it is generated, reducing perceived latency.
It is also important to monitor your token usage. The API provides usage information in the last chunk of a streaming response. You can use this information to track your spending and ensure you are within your budget. Since errors are free, you can afford to experiment with different parameters without worrying about costs.
Finally, keep your API key secure. Do not expose it in your client-side code or version control. Use environment variables to store the key and access it in your application. This prevents unauthorized access to your account and ensures that your credit is used only by your application. Regularly rotate your keys if you suspect a breach.
Frequently asked questions
How do I get started with the uncensored API?
Sign up on the site using Google or email. Your API key is shown immediately. Use the base URL https://api.minicpm.cc/v1 in your SDK to start making requests.
What is the cost of using the API?
You pay $0.15 per million input tokens and $0.50 per million output tokens. Errors and refusals are free. You can top up with crypto, starting at $20.
Can I use this API for function calling?
Yes, the API supports function calling. You can define tools in your request, and the model will return structured data for your application to execute.
What happens if I run out of credit?
You will receive a 402 error. You can top up your account using USDT on TRC20 or USDC on Base. Paid credit never expires.