New Tool Radar

Local AI

How to Serve a Vision Model with llama-server and Ask About an Image

Start llama-server with a SmolVLM model from Hugging Face, then send the image as a base64 data URI to /v1/chat/completions and read the description back.

Schematic diagram with three steps: start llama-server with a SmolVLM vision model, send an image as a base64 data URI to the chat endpoint, then read the description back.

A text-only model cannot describe a picture, but a vision-language model can — if it is served with its vision projector. llama.cpp splits that job across two files: the language-model weights and a matching multimodal projector, often named mmproj. Start llama-server with both, and any program can ask about an image through the server’s OpenAI-compatible chat endpoint. This is a different server from the Ollama vision guide and from the MLX vision guide: the model, the projector, and the API all belong to llama.cpp.

Start the vision model on the loopback address

Start the server with a small vision model that can run on a CPU. The small SmolVLM-500M-Instruct model can run on a CPU, and llama-server can download its weights and projector together from a public Hugging Face repository without an account:

~/llama.cpp/build/bin/llama-server \
  -hf ggml-org/SmolVLM-500M-Instruct-GGUF:Q8_0 \
  --alias local-vision --host 127.0.0.1 --port 8080 \
  --ctx-size 2048 --parallel 1 --threads 2 \
  --gpu-layers 0 --no-mmproj-offload

The -hf flag names the repository and the Q8_0 quantization; the repository provides that model and its matching projector. The first launch downloads them and needs internet access. The explicit 127.0.0.1 bind limits connections to this computer — a public listener would expose this unauthenticated API. --gpu-layers 0 and --no-mmproj-offload keep both components on the CPU.

Confirm the server is ready

From a second terminal, check the health endpoint:

curl --fail --silent --show-error http://127.0.0.1:8080/health
{"status":"ok"}

An HTTP 503 response means the server is still loading; a connection failure means there is no reachable listener at this address. The server’s startup log should show the multimodal projector loading before it accepts requests.

Send the image and read the answer

Make a practice image you can check at a glance — a red square on a white background, 256 by 256 pixels — and send it inside the JSON request as a base64 data URI, so the server does not need access to your image path. The request’s content array carries separate image and text objects:

{
    "model": "local-vision",
    "messages": [
        {
            "role": "user",
            "content": [
                {"type": "image_url", "image_url": {"url": "data:image/png;base64,..."}},
                {"type": "text", "text": "Describe this image in one sentence."}
            ]
        }
    ],
    "max_tokens": 80,
    "temperature": 0
}

Send it with curl and read the assistant’s reply from the saved response:

curl --fail --silent --show-error \
  http://127.0.0.1:8080/v1/chat/completions \
  --header 'Content-Type: application/json' \
  --data-binary @vision-request.json \
  --output vision-response.json \
  --write-out 'HTTP %{http_code}\n'
Check What you should see If you do not see it
Health /health returns {"status":"ok"} 503 means still loading; a connection failure means the server is not listening on port 8080
Request HTTP 200 and a vision-response.json file Check the endpoint address and that the JSON file was built
Answer choices[0].message.content reads “A red square is on a white background.” HTTP 200 alone does not establish that — the description must match the image you sent

Expected result. We checked a step-by-step llama.cpp vision API guide for the server command, the health check, the base64 request, and the expected reply, and the llama.cpp inference docs for the same server flow. We did not run llama-server.

Limits

The wording of the answer can vary from run to run, even at temperature 0; what matters is that the description matches the image. A client-side file path alone does not send image bytes — the data URI embeds them in the request. max_tokens bounds the answer length, and the 2,048-token context, one request slot, and two CPU threads in the command above deliberately limit resource use. A text-only model file without its matching projector cannot answer about an image. We did not run llama-server, so no description here is a recorded result.

Sources

See all