EN ▾

MiniCPM-V API: Text Integration Guide

A MiniCPM-V API usually means image and video understanding, and this service does not do that. It is a text-only, OpenAI-compatible endpoint, so it fits chat, writing, roleplay and tool-using agents, and it plugs into SillyTavern and LangChain with a base URL and a key.

Updated

Key points

  • MiniCPM-V is a vision-language model family. This API accepts text only and has no image input.
  • It is an independent service with one model, ID uncensored, not the official API of any vendor.
  • SillyTavern and LangChain connect with the base URL https://api.minicpm.top/v1 and a key.
  • Pair it with a separate vision tool if you need to describe images first, then pass the text on.
A camera lens converting into streams of text blocks that flow into a chat bubble, showing an image-to-text pipeline

The honest answer about vision

The name MiniCPM-V refers to a vision-language model: you give it a picture, it gives you text. If you came looking for that endpoint in order to caption photos, read screenshots or answer questions about a scanned page, this service is the wrong tool, and it is better to know that before you sign up.

What you get here is narrower. The API takes text and returns text. It runs one open-weight model, operated by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official API of any vendor, and the model ID is uncensored. There is no image input, no image, audio or video generation, no embeddings and no fine-tuning.

So who is this page for? Developers who landed here while looking for a way to plug a language model into a front end or framework, and who are happy with text. That covers a lot of ground: chat assistants, story and character tools, summarizers, extraction pipelines and agents that call functions.

A workable pattern when you have images

If your project truly needs a model that looks at images, use one that does. Nothing in this article changes that.

You can still build an image-aware app around a text endpoint. The usual approach splits the job in two.

  1. Run a vision model or OCR tool of your choice, locally or from another provider, to turn the image into text: a caption, a list of detected objects, or extracted text.
  2. Send that text to this API as part of the prompt and let the language model do the reasoning, rewriting or conversation.

This costs you an extra hop and the second model never sees the pixels, so details the vision step dropped are gone. For many tasks, such as turning a receipt's extracted text into structured JSON, that is perfectly fine. For tasks where visual detail matters, such as judging the layout of a chart, use a real vision model end to end.

The JSON step in that pipeline is where this API helps. Set response_format to {"type": "json_object"} and ask for the fields you want.

import json
from openai import OpenAI

client = OpenAI(base_url="https://api.minicpm.top/v1", api_key="YOUR_KEY")

ocr_text = "ACME STORE\nMilk 2.40\nBread 1.80\nTOTAL 4.20"

result = client.chat.completions.create(
    model="uncensored",
    response_format={"type": "json_object"},
    messages=[
        {"role": "system", "content": "Reply with JSON only."},
        {"role": "user", "content": "Extract store, items (name, price) and total from:\n" + ocr_text},
    ],
)
data = json.loads(result.choices[0].message.content)
print(data)

Connect SillyTavern

SillyTavern lets you add an OpenAI-compatible endpoint, which is how you reach this API from it.

  1. Open the API connection panel (the plug icon) and choose Chat Completion as the API type.
  2. Pick the source named Custom (OpenAI-compatible).
  3. Set the endpoint URL to https://api.minicpm.top/v1 and paste your key into the key field.
  4. Type uncensored as the model ID if it is not filled in for you, then press connect.

For fiction, roleplay and companion-style apps for adults, set the context size in SillyTavern to something comfortable below the limit of 100,000 tokens. Long character cards and chat history are resent on every turn, so a smaller context saves money as well as time. The minors rule applies here as everywhere: the service will not produce sexual content involving minors.

If you hit a 429 while swiping through alternative replies quickly, you are running into the concurrency limit. A trial key allows 2 requests at once and a full key allows 8. Streamed replies hold their slot until finished.

Connect LangChain

LangChain's OpenAI chat wrapper accepts a custom base URL, so no special adapter is needed. Install langchain-openai and create the model like this.

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="uncensored",
    base_url="https://api.minicpm.top/v1",
    api_key="YOUR_KEY",
    temperature=0.6,
)

print(llm.invoke("Summarize the plot of Hamlet in three sentences.").content)

From there, chains, prompt templates and output parsers work as they do with any chat model. Tool binding goes through the standard OpenAI tool-calling fields (tools, tool_choice and role: "tool" results), which this API supports, including streamed tool_calls.

The plain HTTP equivalent, useful for confirming your key before you debug a framework:

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

Cost of a text pipeline, worked out

The price is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Say your pipeline summarizes extracted text: each call sends 3,000 input tokens and returns 400 output tokens, and you run 1,000 calls.

  • Input: 1,000 x 3,000 = 3,000,000 tokens = 3M x $0.15 = $0.45
  • Output: 1,000 x 400 = 400,000 tokens = 0.4M x $0.50 = $0.20
  • Total: $0.65

That is 65 cents for a thousand summaries. Billing is prepaid and pay as you go with no subscription. Failed or refused requests are not charged and credit does not expire. Top up any whole amount from $20 to $500, with a bonus of +5% from $50, +10% from $100 and +15% from $200. See the pricing page for crypto options.

Getting started

Create an account on the API key page. After sign-up you can claim $0.50 of trial credit with one click, valid for 7 days with no card. The quickstart docs repeat the first request in a few languages. If you want a view on how a different, much-discussed API stacks up against reality, there is a separate piece on Grok API myths and facts.

Prompts are not used for training, and each response includes an X-Balance-USD header so your app can watch its own spend.

Settings that matter for character and story apps

Frontends built for fiction tend to expose a wall of sliders. A few of them have a large effect, and the rest rarely move the result much.

Temperature and top_p

Temperature around 0.7 to 0.9 gives varied prose without drifting. Going toward 1.2 and above produces stranger text and more mistakes. Change one of temperature or top_p at a time; adjusting both makes it hard to tell which did what.

Penalties and stop sequences

The frequency and presence penalties are passed through to the model. A small positive frequency penalty can reduce a character repeating the same phrase every turn. Stop sequences are useful when a model keeps writing the other character's lines: add the name followed by a colon as a stop string, so generation ends before it speaks for someone else.

Seed

If you want to compare two prompt wordings fairly, pass the same seed with both. It makes runs more repeatable, which helps when you are tuning a system prompt.

Context budget

The window is 100,000 tokens in total, but a frontend that fills it on every turn will pay for it on every turn. Input tokens are billed each call. Keep the character card short, summarize old turns, and set the app's context limit well under the maximum.

Limits and errors in framework code

Frameworks hide HTTP details, which is fine until something breaks. Three things are worth knowing.

First, the rate limits. A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. LangChain batch calls and agent loops can easily exceed 2 parallel requests, so cap the concurrency setting of your batch runner to match your key.

Second, the error shapes. A 429 body carries the code rate_limited or concurrency, and a temporary overload adds a Retry-After: 5 header. Most SDKs retry 429 automatically a couple of times; check that the retry count suits your workload.

Third, streamed calls. A streamed request holds its concurrency slot until the stream ends, so an agent that starts a stream and never reads it to the end will starve itself of slots. Always consume the stream or close it.

Questions and answers

Does this API accept images like MiniCPM-V?

No. It is text only, with no image input or generation. Use a separate vision or OCR tool first if you need to describe images, then send the resulting text.

What model ID do I use in SillyTavern or LangChain?

Use uncensored, with the base URL https://api.minicpm.top/v1 and your API key.

Is this the official MiniCPM-V API?

No. It is an independent hosted service running one open-weight model. It is not run by any model vendor.

How large can a prompt be?

The context window is 100,000 tokens, prompt plus completion, and the request body can be up to 8 MB.

Your key is one form away

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

Get API key