Airpost
AI and plugins

Local AI with Ollama

Run thread summaries, reply suggestions and inbox sorting on a model on your own machine, so mail never leaves it.

What you’ll build

Airpost’s AI features backed by a model running in Ollama on your computer or a machine on your network. Summaries, reply suggestions and inbox sorting then work without an API key, and the mail sent to the model stays on hardware you control. You’ll also use the same model from the terminal with airpost ai.

Prerequisites

  • Airpost, with the desktop app for the setup step. See Install the CLI for the airpost command.
  • Ollama installed.
  • Enough memory for the model you pick. A 7-8B model at 4-bit needs roughly 5-6 GB of RAM or VRAM.

Pull a model and start Ollama

ollama pull llama3.1:8b
ollama serve            # skip if the Ollama app is already running

Check that it answers on its default address:

curl -s http://127.0.0.1:11434/api/tags | jq -r '.models[].name'

Add the model in Airpost

Open Preferences > AI and click + Add a model. Pick Ollama. The address defaults to http://127.0.0.1:11434 and no key is needed. Click Load models, choose llama3.1:8b, and click Test.

The provider is labelled On this computer, which means requests don’t leave the machine.

Turn on features

Under Features, choose the Ollama model for thread summaries, reply suggestions and inbox sorting. You can turn AI off for an account you don’t want sent to any model.

Use it from the terminal

Summarize a thread, printed as the model writes it:

id=$(airpost search 'in:inbox' -n 1 --json | jq -r '.threads[0].id')
airpost ai summarize "$id"

Sort the last two days of inbox mail and wait until it’s done:

airpost ai triage --since 2d

See how many tokens you’ve used:

airpost ai usage --days 7

Expected output

$ airpost ai summarize t_8a1...
Dana sent revised contract redlines and asks you to approve the changes
to section 4 (liability cap) by Wednesday. Legal has already signed off
on the rest.
(llama3.1:8b)

$ airpost ai triage --since 2d
you@example.com: triaged 23 of 23 threads

$ airpost ai usage --days 7
DAY         PROVIDER  FEATURE    REQUESTS  INPUT   OUTPUT
2026-11-16  ollama    summarize  4         9120    610
2026-11-16  ollama    triage     23        41800   1150

Running ai summarize again on the same thread prints the cached summary with (llama3.1:8b, cached); --refresh asks the model again. In the app, triaged threads show tags such as Needs reply and Newsletter.

With --json, ai summarize prints {"text", "model", "cached", ...} and ai triage prints {"accounts": [{"accountId", "jobId", "queued", "done"}]}.

How it works

The engine makes the model calls, not the desktop window, so airpost ai works from a terminal and inbox sorting runs on new mail with the app closed. For Ollama it uses the native /api/chat endpoint and sets num_ctx to 8192 tokens unless you set a context size, because Ollama’s own default window is smaller and it cuts input silently past it. Replies are limited to 1024 output tokens by default.

Plain http is accepted only for an address on this computer or your local network; a provider anywhere else must use https, so mail never crosses the internet unencrypted.

Variations

  • A GPU box on your network. Run OLLAMA_HOST=0.0.0.0 ollama serve on that machine and use its address, for example http://gpu.lan:11434, as the provider address. The provider then shows as a host on your network.
  • LM Studio or llama.cpp. Pick OpenAI-compatible and use the server’s address, for example http://localhost:1234/v1.
  • A smaller model for sorting. Use a small fast model (llama3.2:3b) for inbox sorting and a larger one for summaries and replies; each feature picks its own model.
  • Digest summaries. The Morning digest script calls airpost ai summarize per thread with DIGEST_SUMMARIES=1.

Cleanup

Remove the provider in Preferences > AI, or turn the features off there. Then free the disk space:

ollama rm llama3.1:8b