Deploying models to LM Studio
Saving models to GGUF so you can run and deploy them to LM Studio
You can run and deploy your fine-tuned LLM directly in LM Studio. LM Studio enables easy running and deployment of GGUF models (llama.cpp format).
You can use our LM Studio notebook or follow the instructions below:
Export your Unsloth fine-tuned model to
.ggufImport / download the GGUF into LM Studio
Load it in Chat (or run it behind an OpenAI-compatible local API)


1) Export to GGUF (from Unsloth)
If you already exported a .gguf, skip to Importing into LM Studio.
2) Import the GGUF into LM Studio
LM Studio provides a CLI called lms that can import a local .gguf into LM Studio’s models folder.
Import a GGUF file:
Keep the original file (copy instead of move):
After importing, the model should appear in LM Studio under My Models.

If you pushed your GGUF repo to Hugging Face, you can download it directly from within LM Studio.
Option A: Use LM Studio’s in-app downloader
Open LM Studio
Go to the Discover tab
Search for
hf_username/repo_name(or paste the Hugging Face URL)Download the quant you want (e.g.
Q4_K_M)
Option B: Use the CLI downloader
If you don’t want to use the CLI, you can place the .gguf file into LM Studio’s expected model directory structure.
LM Studio expects models to look like this:
Example:
Then open LM Studio and check My Models.
Tip: You can manage / verify your models directory from the My Models tab in LM Studio.
3) Load and chat in LM Studio
Open LM Studio → Chat
Open the model loader
Select your imported model
(Optional) adjust load settings (GPU offload, context length, etc.)
Chat normally in the UI
4) Serve your fine-tuned model as a local API (OpenAI-compatible)
LM Studio can serve your loaded model behind an OpenAI-compatible API (handy for apps like Open WebUI, custom agents, scripts, etc.).
Load your model in LM Studio
Go to the Developer tab
Start the local server
Use the shown base URL (default is typically
http://localhost:1234/v1)
Quick test: list models
Python example (OpenAI SDK):
cURL example (chat completions):
Troubleshooting
Model runs in Unsloth, but LM Studio output is gibberish / repeats
This is almost always a prompt template / chat template mismatch.
LM Studio will auto-detect the prompt template from the GGUF metadata when possible, but custom or incorrectly-tagged models may need a manual override.
Fix:
Go to My Models → click the gear ⚙️ next to your model
Find Prompt Template and set it to match the template you trained with
Alternatively, in the Chat sidebar: enable the Prompt Template box (you can force it to always show)
LM Studio doesn’t show my model in “My Models”
Prefer
lms import /path/to/model.ggufOr confirm the file is in the correct folder structure:
~/.lmstudio/models/publisher/model/model-file.gguf
OOM / slow performance
Use a smaller quant (ex:
Q4_K_M)Reduce context length
Adjust GPU offload (LM Studio “Per-model defaults” / load settings)
More resources
LM Studio + Unsloth blog post (FunctionGemma walkthrough):
LM Studio Import Models docs
LM Studio Prompt Template docs
LM Studio OpenAI-compatible API docs
Last updated
Was this helpful?

