Instructions to use unsloth/Kimi-K2-Thinking-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Kimi-K2-Thinking-GGUF with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("unsloth/Kimi-K2-Thinking-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/Kimi-K2-Thinking-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- Ollama
How to use unsloth/Kimi-K2-Thinking-GGUF with Ollama:
ollama run hf.co/unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
- Unsloth Desktop
- Pi
How to use unsloth/Kimi-K2-Thinking-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use unsloth/Kimi-K2-Thinking-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/Kimi-K2-Thinking-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.Kimi-K2-Thinking-GGUF-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use unsloth/Kimi-K2-Thinking-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use unsloth/Kimi-K2-Thinking-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "unsloth/Kimi-K2-Thinking-GGUF:UD-Q4_K_XL" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
No thinking tags when it runs?
Getting an issue where thinking tags never appear which results in no markdowns, making the model unusable. I've only tested it with Kimi-K2-Thinking-UD-Q3_K_XL. This works fine with Deepseek R1, just for example. I don't know if this is an issue with the latest llama cpp or the GGUF.
I run with the following:
llama-server --model Kimi-K2-Thinking-UD-Q3_K_XL-00001-of-00010.gguf -ts 99,0 -fa on --temp 1.0 --min-p 0.01 -c 131072 --threads 38 -ngl 99 --n-cpu-moe 54
I have this problem too with GLM4.5 and GLM4.6 quantized by unsloth, but it's random. The </think> only appears 80% of the time, the longer the context, the lower the probability of success is. Not sure if it's related.
You have to do --special and then it comes up and then you'll see the think token. This is normal expected behavior
CC: @Disdrix @AliceThirty
Thanks @danielhanchen - that worked. It would be good if this were added to the unsloth guide, as it doesn't seem documented anywhere and I've seen several people asking in various forums.
The only downside is that now it ends every answer with <|im_end|>. Maybe a template issue?
Also, it seems to have an identity crisis and thinks it's Claude. Probably an issue with the base model, but funny.
The only downside is that now it ends every answer with <|im_end|>.
Intended behavior when printing special tokens. <|im_end|> is a special token after all. You can set <|im_end|> as a stop string in openwebui.
Most front ends like ST, etc should support that.
Also, it seems to have an identity crisis and thinks it's Claude.
Thanks @danielhanchen - that worked. It would be good if this were added to the unsloth guide, as it doesn't seem documented anywhere and I've seen several people asking in various forums.
The only downside is that now it ends every answer with <|im_end|>. Maybe a template issue?
Also, it seems to have an identity crisis and thinks it's Claude. Probably an issue with the base model, but funny.
We added it here: https://docs.unsloth.ai/models/kimi-k2-and-thinking-how-to-run-locally#thinking-tags
Another update. After some number of messages back and forth, markdowns fail again. It seems to be that --special did not fix the issue entirely.
It seems to happen repeatedly around 2000 tokens. I did a "write a story" initial prompt and "continue the story" a couple times.
Here, you can see it didn't even bother reasoning and went right to normal text generation. It then did a weird thing where it added a think token and repeated this section of story again exactly. Sometimes at this point it will actually reason, but won't markdown. After it finished, I did another "continue the story" and it did reason this time, but no markdown.
@Disdrix Could you try setting
min_p = 0.01andtemperature = 0.8totemperature = 1.0
This is what I am doing already. It seems to always after ~2k tokens, start this problem. I've tried many new chats and it always does, 100% of the time in that range.
I have not yet tried using something other than llama cpp to rule out that being the issue yet.
Just updated again to the latest llama cpp and it persists. I did find some interesting behavior, however. If I am writing a story then suddenly prompt the AI with "hi", it will reason again.
I'm not convinced we should be using it with only temp and min-p 0.01 at these lower quants. The folk theory is that the harsher the quanting, the higher the effective temp compared to the unquanted model.
I think I'm going to be starting at more like temp 0.7 and min-p 0.05 for UD-TQ1_0 next time I play with it.





