Skip to content

For developers

Local API

Use your models from your own programs and scripts, with the OpenAI or Anthropic format, on this computer.

The local API lets programs on your computer use the models in Zero1LLM: your own scripts, tools written for OpenAI or Anthropic, and anything that lets you set an address and a key. It runs on your computer only, while Zero1LLM is open.

Turn it on

  1. Open Settings → Local API and turn on Local API server. It shows Running on port 47820.
  2. Choose Show key and copy it. Every request needs it. Keep it like a password; New key replaces it, and the old one stops working at once.
  3. Try it: the page has a ready-to-copy line, like this one.
curl http://127.0.0.1:47820/v1/models -H "Authorization: Bearer YOUR_KEY"

You get your models. Local ones are named local/<model>; cloud ones you've set up are cloud/<connection>/<model>.

OpenAI format

Anything written for OpenAI works with the address http://127.0.0.1:47820/v1 and your key.

import OpenAI from "openai";

const ai = new OpenAI({ baseURL: "http://127.0.0.1:47820/v1", apiKey: process.env.ZERO1LLM_API_KEY });
const reply = await ai.chat.completions.create({
  model: "local/gemma-4-e2b-it-q4",
  messages: [{ role: "user", content: "Hi" }],
});
console.log(reply.choices[0].message.content);
from openai import OpenAI

ai = OpenAI(base_url="http://127.0.0.1:47820/v1", api_key="YOUR_KEY")
reply = ai.chat.completions.create(model="local/gemma-4-e2b-it-q4", messages=[{"role": "user", "content": "Hi"}])
print(reply.choices[0].message.content)

Streaming (stream: true), tools (function calling), JSON output (response_format with json_object or a json_schema) and pictures in messages work with local models. Pictures need a model that can see them.

Anthropic format

Tools written for Claude use http://127.0.0.1:47820 (without /v1) and the key as x-api-key.

from anthropic import Anthropic

ai = Anthropic(base_url="http://127.0.0.1:47820", api_key="YOUR_KEY")
reply = ai.messages.create(model="local/gemma-4-e2b-it-q4", max_tokens=1000, messages=[{"role": "user", "content": "Hi"}])
print(reply.content[0].text)

The app's own chat

POST /api/v1/assistant chats as if you typed in Zero1LLM: web search, thinking, memory, your connectors' tools, and pictures. The chat is saved in the app's sidebar. The answer comes back as JSON lines, each a snapshot of the answer so far (entry), a picture, or which model answers.

curl -N http://127.0.0.1:47820/api/v1/assistant \
  -H "Authorization: Bearer YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"call": "send", "chatId": "my-first-chat", "text": "Latest Node release?", "web": true}'

When a tool asks to run, the entry's status is asking: answer with {"call": "decide", "chatId": "my-first-chat", "answer": true} (or false, or "always"). Other calls: chats (the saved chats), open and delete (one chat, by chatId). The SDKs wrap all of this as assistant.

Add "save": false to a send to keep the chat out of the sidebar: the app keeps it in memory until it closes.

A program with your key can allow tools for you, so give the key only to programs you trust.

Pictures and videos

POST /api/v1/images with {"prompt": "A red fox in snow", "shape": "16:9"} makes a picture where the app makes them (this computer, or Zero1LLM Cloud when chosen in Settings). POST /api/v1/videos with {"prompt": "Waves at sunset", "seconds": 3} makes a short video on this computer. The answer has the size and the file as a data URL (url); nothing is kept in the app. A video can take minutes: add "progress": true to get the answer as JSON lines instead, begun at once, so your HTTP client doesn't give up waiting. The last line is the answer, or {"error": "...", "code": "..."}.

Loading a model

POST /api/v1/models/load with {"model": "local/qwen3.5-9b"} waits until the model is ready. Add "progress": true to get JSON lines while it loads ({"progress": {"stage": "loading", "percent": 40}}), then the model. While nothing changes, JSON lines answers carry a blank line every 30 seconds: skip blank lines. /api/v1/models/eject frees its memory, and GET /api/v1/models lists the models on this computer.

Thinking

Models that can think (Gemma 4, Qwen3, gpt-oss) answer straight away unless you ask them to think: set reasoning_effort (OpenAI format) or thinking (Anthropic format). A thinking model spends max_tokens on thinking first, so give it more room.

Settings

  • Load models when asked: a request for a downloaded model that isn't running loads it, if there's room. Off, the request is refused until you load the model in the app.
  • Browser pages: lets web pages call the local API. Off by default: any page you open could otherwise use your models if it had the key.
  • Change port: if another program uses 47820. Programs then need the new address.
  • Requests: the latest requests, with the model, status and time. What was asked and answered is never kept.

When something goes wrong

You seeWhy
Can't connectZero1LLM isn't open, or the server is off. It starts by itself when the app opens and is signed in.
401The key is missing or wrong. Copy it again from Settings → Local API.
404No model by that name. List them with /v1/models.
409The model isn't loaded, there isn't room in memory for it, or it's answering in the app. Try again after.
403A web page called it with Browser pages off, or the local API is off for your account.

Good to know

  • Only this computer can reach it; it never listens on your network.
  • Cloud models answer in both formats too. Zero1LLM Cloud models count against your plan's limits, as in the app. JSON output works with cloud models too (response_format, or output_config.format in Anthropic's format), except Bedrock models.
  • MLX models answer the OpenAI format only.