Agents / Intermediate

Build a local tool-using agent with MiniCPM5 2B Midtrain

Run the MiniCPM5 2B Midtrain GGUF model locally with llama.cpp on Windows, macOS, or Linux, expose it through the llama-server OpenAI-compatible endpoint, and verify tool-calling by sending a model request that includes a tool definition and checking the returned tool call.

EstimatedSource checked 9/25/2026
LOCALRENTED GPU

Before you begin

Difficulty
Intermediate
Software
llama.cpp (llama-server), MiniCPM5-2B-F16.gguf, curl
Hardware
This setup uses llama.cpp. The exact checkpoint format, context, and runtime overhead determine its memory need; a weight-file size alone is not a GPU recommendation.
AGENTS / LLAMA.CPPSOURCE-LINKED SETUP

Build a local tool-using agent with MiniCPM5 2B Midtrain, step by step.

Run the MiniCPM5 2B Midtrain GGUF model locally with llama.cpp on Windows, macOS, or Linux, expose it through the llama-server OpenAI-compatible endpoint, and verify tool-calling by sending a model request that includes a tool definition and checking the returned tool call.

Choose a package Run its commands Check the result
01
BEFORE YOU BEGIN

The documented package

This setup uses the package documented for this task. Review its source and supported platforms before starting.

The publisher has not provided a complete memory target for this task. Check its hardware guidance before starting.

CURRENT SETUP

MiniCPM5 2B Midtrain · official

This setup uses llama.cpp. The exact checkpoint format, context, and runtime overhead determine its memory need; a weight-file size alone is not a GPU recommendation.

View weight source
02
THE WORKFLOW

Set up MiniCPM5 2B Midtrain on your machine

Pick your operating system. Every command below is for the selected package and runtime.

01

Prepare prerequisites

You need the MiniCPM5 2B Midtrain GGUF file named MiniCPM5-2B-F16.gguf, a llama.cpp build with the llama-server binary, and at least 8 GB of memory or a supported GPU to host the model. Obtain the GGUF file so it is available at the path you will reference when starting the server.

02

Start the llama.cpp server

Launch llama.cpp’s OpenAI-compatible server with the MiniCPM5 model and 8192-token context. The --jinja flag enables the chat template, and -ngl 99 offloads all layers to the GPU when available. Run this from the directory containing MiniCPM5-2B-F16.gguf, or replace the path with the full path to the GGUF file.

llama-server -m MiniCPM5-2B-F16.gguf -a MiniCPM5-2B --port 8080 -ngl 99 -c 8192 --jinja
03

Send a chat request to the local endpoint

In a second terminal, send a request to the server using the OpenAI-compatible chat completions endpoint. Keep the sampling settings from the model documentation to avoid repetitive output.

curl http://localhost:8080/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "MiniCPM5-2B", "messages": [{"role": "user", "content": "1+1=?"}], "temperature": 1.0, "top_p": 0.95, "min_p": 0.0, "max_tokens": 256 }'
04

Run a documented tool round-trip against the local endpoint

Send a message that asks the model to call a tool, and pass a definition for a simple tool so the response can be checked for a complete tool round-trip. The model's tool-calling support is part of its documented capabilities.

05

Check that the response contains a complete tool call

Read the JSON returned by the server. In the model response choices, look for an emitted tool call: a tool_calls array with the function name plus its arguments. A response that only contains plain text without a tool call means the round-trip did not complete.

03
SUCCESS CHECK · MiniCPM5 2B Midtrain

Verify the tool round-trip

Give the agent a small bounded task. Confirm the tool request, its result, and the final response all complete through the local endpoint.

This is a source-linked setup, not a YouRunAI hardware test. Confirm your exact runtime version, package, and output before relying on it.

Back to setup steps

When it doesn’t go to plan

Repetitive output from default min_p filtering

The publisher documents that llama.cpp defaults to min_p=0.05; pass min_p=0.0 in the request or server settings to avoid filtering out tokens needed to break repetition loops.

The publisher run command does not start

Confirm the exact model files, runtime version, and platform shown in the source-linked steps, then retry the documented command.

REFERENCE LIBRARY

Sources and files

Original instructions, model files, and compatibility notes behind this setup.

2 SOURCES

The model behind this workflow

MiniCPM5 2B Midtrain
MY HARDWARE

Will it run on your machine?

Save your machine to see a personalized rating and its reasoning.

Add my hardware

Keep exploring