A listening HTTP port can appear before a model finishes loading. The llama.cpp server health response reports whether the service is ready to handle requests or is still loading its model.

/health returns JSON without checking an API key. Its /v1/health alias serves clients or proxies that route requests under /v1, but a successful health request does not establish that authentication works on protected routes.

A single-model server reports ready after loading its model. A router can be healthy with every model unloaded, so router health describes the front-facing service rather than a particular model's readiness for inference.

Steps to check llama.cpp server health:

  1. Request the health response and HTTP status from the running server.
    $ curl --silent --show-error --write-out '\nHTTP %{http_code}\n' \
      http://127.0.0.1:8080/health
    {"status":"ok"}
    HTTP 200

    The URL assumes an existing server configured to listen on 127.0.0.1:8080. A different listener needs its configured host, port, and scheme; port defaults vary between builds. The /v1/health path returns the same state.
    Related: How to start the llama.cpp server

    HTTP 200 with status set to ok means a single-model server is ready. During model loading, the response can instead be HTTP 503 with message set to Loading model and type set to unavailable_error. A connection error means no health response was received. For a router, the model's status.value in /models distinguishes unloaded, loading, and loaded independently of router health.
    Related: How to load a model with the llama.cpp server router

    Health polling does not wake a sleeping model or reset its idle timer. The /props endpoint reports sleep status; a health response alone does not prove that a sleeping model is resident in memory.

  2. Check the server health with curl fail mode for a monitor or script.
    $ curl --fail --silent --show-error \
      --write-out '\nHTTP %{http_code}; curl exit %{exitcode}\n' \
      http://127.0.0.1:8080/health
    {"status":"ok"}
    HTTP 200; curl exit 0

    --fail makes curl return a nonzero exit status for HTTP errors. A loading response produces HTTP 503 and exit 22, while a healthy response produces HTTP 200 and exit 0. The %{exitcode} write-out variable requires curl 7.75.0 or newer. This checks the health endpoint; model inference and client authentication remain separate checks.
    Related: How to call the llama.cpp chat completions API

Share this guide