New Tool Radar

Local AI

How to Call Jan’s Local API Server from a Script

Start Jan's built-in OpenAI-compatible local API server and call it from a script, so your own tools can use the model already on your computer.

Schematic diagram with three boxes: Jan settings with the local API server started, the server address on port 1337, and a curl chat request returning a joke.

Jan is a desktop chat app, but it also has a server inside it. Jan provides a built-in, OpenAI-compatible API server that runs entirely on your computer, with local models powered by llama.cpp or MLX on Apple Silicon Macs. Use it as a drop-in replacement for cloud APIs to build private, offline-capable AI applications — any tool that speaks the OpenAI format can talk to the model Jan already has, with one base-URL change.

Start the server

The server needs a local model that Jan can load to start, so download or import one first. Then:

  1. Navigate to Settings > Local API Server and select your model under Default Model Local API Server.
  2. Click Start Server. Jan uses an already-loaded model if one is running; otherwise, it loads the selected default model before starting the server.
  3. Wait for Server Status to show that the server is running. With the default settings, the API base URL is http://127.0.0.1:1337/v1.

Call it with curl

Open a terminal and make a request. Replace YOUR_MODEL_ID with your local model’s ID, and YOUR_API_KEY with the key configured in Configuration > API Key. If no key is configured, omit the Authorization header:

curl http://127.0.0.1:1337/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer " \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [{"role": "user", "content": "Tell me a joke."}]
  }'
Check What you should see If you do not see it
Server status Server Status shows the server is running No model is available — download or import one, then select it as the default model
Chat reply A joke in the response Connection refused means the server is not running or the address is wrong
401 error Only if a key is set and yours is missing or wrong Add the key to the Authorization header, or clear it in Configuration
404 error Only if the model ID or the URL is wrong Copy the model ID from Jan and check the API prefix is /v1

Expected result. We checked Jan’s own docs for the server steps, the default address, the curl example, and the error list. We did not run Jan or send a request.

Limits

The server only serves a local model: if a request is routed to a configured remote provider instead, that request is not offline and does not stay on your computer, so keep the default model local. The default address 127.0.0.1 means the server is only accessible from your own computer, which is the most secure option for personal use; changing it to 0.0.0.0 exposes it to other devices on your local network, so only do that with a key set. On macOS the bundled llama.cpp engine needs Apple Silicon, and MLX also requires Apple Silicon. We did not run Jan, so no reply here is a recorded result.

Sources

See all