Skip to content

For developers

Without the app

Run Zero1LLM on a server or in CI with z1llm serve: your models through the local API, no app or screen needed.

On a computer with no screen (a server, a CI machine, a box in the corner), z1llm can serve your models itself. It answers through the same local API the app has, in the OpenAI and Anthropic formats, so the SDKs, the command line and other tools work with it as they do with the app.

z1llm chat and z1llm ask work with it as with the app, web search included. Memory, the knowledge base, making documents, pictures, videos and connected apps stay in the app.

What you need

  • Node.js 20 or later, and npm install -g z1llm.
  • A plan that includes the Local API. See plans and billing.
  • macOS or Linux. Windows isn't supported yet: autostart isn't there, and serve hasn't been tried on it.

This is new in z1llm 0.2.0 and has been tried most on macOS. If something doesn't work on Linux, tell us (Report a problem in the app's account menu, or the contact page).

1. Sign in once

z1llm login

It prints an address. Open it on any phone or computer and approve. With a browser on the same computer that's all. On a server, the other browser ends on a page that can't load: copy that page's address and paste it into the terminal. The computer then appears in your devices on the website. z1llm logout signs it out.

2. Download a model

z1llm download            # a list of models that suit this computer
z1llm download qwen       # or part of a name, or a search of Hugging Face

The list shows the models that run well here, the best one first (★) and the quickest (⚡), with each one's size and speed on this computer. Type to narrow it. The size of the model is chosen for this computer's memory, models too big for it aren't offered, and the free disk is checked. A model named outright that won't fit is refused with the reason.

The download goes on where it stopped after a break or a dropped connection, and each file is checked when it's done. Models go into the same folder the app uses, so if the app is on this computer too it sees them.

--yes downloads without asking, for scripts.

3. Serve

z1llm serve

The first start makes a key and saves it for z1llm on this computer; it's shown once. Ctrl+C stops the server and its models. Then, from another terminal or a program:

z1llm chat
curl http://127.0.0.1:47820/v1/models -H "Authorization: Bearer $ZERO1LLM_API_KEY"     # the models' names
curl http://127.0.0.1:47820/v1/chat/completions \
  -H "Authorization: Bearer $ZERO1LLM_API_KEY" -H "Content-Type: application/json" \
  -d '{"model": "local/gemma-4-e2b-it-q4", "messages": [{"role": "user", "content": "Hi"}]}'

A model is loaded when a request names it (z1llm load and z1llm eject do it by hand), and when memory runs short the idle model used longest ago is put away (a model answering never is).

Option
--port 47900Another port (47820 by default)
--host 0.0.0.0Answer other computers too, not only this one. Anyone with the key can use your models: keep it secret.
--no-jitDon't load a model a request names; load it with z1llm load first
z1llm chat --web
z1llm ask "What's the latest Node.js version?" --web

The chat searches the way the app does: each search engine's ordinary results page is opened in a hidden browser and read. Here that browser is Chrome, Edge, Chromium or Brave, if one is installed. It runs out of sight and closes when idle. Pasted links are read too, including pages built by script. A page can't reach this computer or your home network.

On a server there's usually no browser, and search engines often block datacenter addresses. Use a SearXNG server there instead:

z1llm serve --searxng http://localhost:8080

ZERO1LLM_SEARXNG works too, and the SearXNG set in the app is used when there is one. z1llm serve says when it starts which search it uses. Chats are kept in memory while the server runs, never saved.

Your own tools

Programs can bring their own tools, as with OpenAI's and Anthropic's APIs: send tools with /v1/chat/completions or /v1/messages, and the answer comes back as tool calls for your program to run. How reliably a model calls them depends on the model.

Start it by itself

z1llm autostart on        # with serve's options, e.g. --port 47900
z1llm autostart           # is it on?
z1llm autostart off

On a Mac it starts when you log in; on Linux, with the computer (as a systemd user service). Either way it starts again if it stops. Its log is ~/.config/z1llm/serve.log. On Linux, to start it at boot before anyone logs in, run loginctl enable-linger $USER once.

Install z1llm with npm before turning this on: a copy run with npx is removed later, so it's refused.

Free up disk

z1llm delete              # every downloaded model, biggest first
z1llm delete gemma

It asks first (--yes doesn't), puts the model away if it's loaded, and says how much disk came back. The app's own image, video and speech models are listed too.

With the app on the same computer

The app and z1llm serve share the models folder but not the local API: one serves at a time.

  • While the app's Local API is on, z1llm serve doesn't start. Programs can use the app's instead.
  • With autostart on, the engine waits while the app serves and starts when it stops. Started first, it holds the port, and the app's Local API reports it busy: run z1llm autostart off while you use the app.

z1llm status tells you which one is answering.

When something goes wrong

You seeWhat to do
Sign in firstz1llm login
Your plan doesn't include the Local APISee your plan on the website.
Couldn't reach … to check your planConnect once. After that it works offline for 30 days on the plan as last checked.
The Zero1LLM app already serves its Local API hereClose the app or turn off Settings → Local API, or use the app's.
z1llm serve already runs on this computerIt's running already (perhaps from autostart). Use it, or z1llm autostart off.
… won't run on this computerThe model needs more memory than this computer has: pick one from z1llm download.