Skip to main content

Usage

Load a local model and expose it at localhost:6767/v1. Auto-detects LlamaCPP or MLX engine.

Arguments

model_id
string
Model ID to load. Omit to pick interactively from installed models.Can be:
  • A model ID from jan models list (e.g. qwen3.5-35b-a3b)
  • A HuggingFace repo ID (e.g. Qwen/Qwen2.5-35B-Instruct-GGUF) — will auto-download
  • Derived from --model-path filename if path is provided

Options

Model Configuration

model-path
string
Path to the GGUF file. Auto-resolved from model.yml when omitted.
bin
string
Path to the inference binary. Auto-discovered from Jan data folder when omitted.
mmproj
string
mmproj path for vision-language models. Auto-resolved from model.yml when omitted.

Server Configuration

port
number
default:"6767"
Port the model server listens on. Use 0 to pick a random free port.
api-key
string
default:""
API key required by clients. Sets LLAMA_API_KEY / MLX_API_KEY on the server.
Clients must include this in their requests:
timeout
number
default:"120"
Seconds to wait for the model server to become ready.

Performance Configuration

n-gpu-layers
number
default:"-1"
GPU layers to offload.
  • -1: All layers (full GPU acceleration)
  • 0: CPU only
  • > 0: Specific number of layers to offload
ctx-size
number
default:"4096"
Context window size in tokens. Use 0 for model default.
Setting --ctx-size explicitly disables --fit. Use --fit to maximize context based on available VRAM.
fit
boolean
default:"false"
Auto-fit context to available VRAM, maximizing the context window.
When enabled, Jan automatically determines the largest context size your GPU can handle.
threads
number
default:"0"
CPU threads for inference. Use 0 to auto-detect.

Model Type

embedding
boolean
default:"false"
Treat the model as an embedding model.

Background Mode

detach
boolean
default:"false"
Run in the background (detach from terminal) and print the PID.
Output:
log
string
Log file for background mode. Defaults to <data-folder>/logs/serve.log.

Output Control

verbose
boolean
default:"false"
Print full server logs (llama.cpp / mlx output) instead of the loading spinner.

Examples

Output

Success

The model is now serving at http://127.0.0.1:6767/v1 with OpenAI-compatible endpoints:
  • /v1/chat/completions
  • /v1/completions
  • /v1/embeddings (for embedding models)
  • /v1/models

Error

OpenAI-Compatible API

Once the model is serving, you can use it with any OpenAI-compatible client:

HuggingFace Auto-Download

Jan can automatically download models from HuggingFace when you specify a repo ID:
The CLI will:
  1. Fetch available GGUF files from the repo
  2. Let you pick a quantization interactively
  3. Download the model to your Jan data folder
  4. Serve the model

Private/Gated Models

Set a HuggingFace token to download private or gated models:

Background Mode

Run the model server in the background:
Output:
To stop the background server:
View logs:

Performance Tips

Maximize Context Window

Use --fit to automatically determine the largest context size your GPU can handle:

Optimize for Speed

Offload all layers to GPU:

Optimize for Memory

Reduce context size and GPU layers:

CPU-Only Mode

Run entirely on CPU (no GPU):

Troubleshooting

Model Not Found

Solution: Download the model first using the Jan desktop app, or use a HuggingFace repo ID to auto-download.

Binary Not Found

Solution: Install a backend from Jan’s settings, or specify the binary path with --bin.

Out of Memory

Solution: Reduce --ctx-size or --n-gpu-layers, or use --fit to auto-size the context.

Port Already in Use

Solution: Choose a different port with --port, or use --port 0 to auto-select a free port.

See Also

Launch Command

Wire AI agents to local models

Commands Reference

Complete reference for all CLI commands