Using a local AI model
This is the same document you'll find inside Spredin under Help.
Spredin can write Python for you from a plain-English description. That writing is done by an AI model, and you get to choose where the model runs.
Running it on your own Mac means:
- It is free. No account, no API key, no per-word billing.
- It is private. Your spreadsheet never leaves your machine.
- It works offline. On a plane, on hotel wifi, behind a company firewall.
The trade is speed and quality: a model small enough to run on a laptop is not as sharp as the big cloud ones, and it thinks more slowly. You can switch between local and cloud at any time in Settings → AI model….
You do not need any of this to use Spredin. Everything else — formulas, charts, pivots, the Python panel itself — works without an AI model. This page is only about the Generate button.
The short version#
- Install Ollama from https://ollama.com (a normal Mac app).
- Open Terminal and pull a model (the Ollama site lists what is current)
- In Spredin: Settings → AI model…, set Setup to Ollama, press Test connection, click your model in the list, press Save.
That's it. The GEN button in the Python panel now works.
Step 1 — install a server#
An "AI server" is just a small program that keeps the model in memory and answers requests. Any of these work with Spredin. If you have no preference, use Ollama — it is the least fiddly.
| App | Best for | Where to get it |
|---|---|---|
| Ollama | almost everyone; no window to keep open | https://ollama.com |
| LM Studio | browsing and downloading models in a UI | https://lmstudio.ai |
| Jan | an open-source desktop app | https://jan.ai |
| llama.cpp / llamafile | full control from the command line | https://github.com/ggml-org/llama.cpp |
| GPT4All | simple desktop app | https://gpt4all.io |
| LocalAI, vLLM, KoboldCpp, Text generation web UI | you already run one of these | their own sites |
Spredin has a preset for every app in that list, so you should never have to work out an address by hand.
Step 2 — download a model#
The server is the engine; the model is the thing that actually writes the code. You need at least one.
With Ollama, in Terminal:
ollama pull <model-name>
In LM Studio, Jan or GPT4All, use the app's own search-and-download screen.
Which model? Bigger models write better code but need more memory. A rough guide for how much free RAM a model wants:
| Model size | Roughly needs | Good on |
|---|---|---|
| 3–4 B | ~4 GB | any Apple-silicon Mac |
| 7–8 B | ~8 GB | 16 GB Mac — the usual sweet spot |
| 14 B | ~12 GB | 24 GB Mac |
| 30 B+ | ~24 GB and up | 32–64 GB Mac |
Prefer a model described as an instruct, chat or coder model. Base/completion-only models are not trained to follow instructions and will disappoint you here.
Step 3 — point Spredin at it#
Open Settings → AI model…
- Setup — pick the app you installed. The Endpoint fills in for you.
- Test connection — this asks the server what it has.
- Connected — N model(s) available → the model names appear as buttons. Click the one you want.
- Nothing is answering… → the server is not running, or it is on a different port. See troubleshooting below.
- Save.
Now open the Python panel, type what you want in plain English, and press GEN.
If you changed the port#
Every one of these servers lets you move it to a different port, and some do it automatically when the default is already taken. The Endpoint box stays editable after you pick a preset — just change the number to match what your server reports. These are only the defaults:
| App | Default endpoint |
|---|---|
| Ollama | http://localhost:11434 |
| LM Studio | http://localhost:1234/v1 |
| Jan | http://localhost:1337/v1 |
| llama.cpp / llamafile | http://localhost:8080/v1 |
| LocalAI | http://localhost:8080/v1 |
| vLLM | http://localhost:8000/v1 |
| GPT4All | http://localhost:4891/v1 |
| KoboldCpp | http://localhost:5001/v1 |
| Text generation web UI | http://localhost:5000/v1 |
If your server is not in the list at all, choose Other (OpenAI-compatible) and paste its address. Nearly every local server speaks the same protocol, so "not listed" almost never means "not supported".
Troubleshooting#
| What you see | What it means | What to do |
|---|---|---|
| Nothing is answering at… | the server isn't running | Start it. For LM Studio / Jan / GPT4All the API server is a separate switch inside the app — installing it is not enough. |
| Server answered 404 | right machine, wrong path | Most servers need the address to end in /v1. Ollama is the exception — it wants no suffix. |
| Model "x" isn't pulled | server is fine, model is missing | Run ollama pull x, or press Test connection and click a model you actually have. |
| …timed out | the model is too big, or it's still loading | The very first request loads the model into memory and can take a minute. If every request times out, try a smaller model. |
| It works but the code is wrong | the model is too small for the task | Try a larger model, or raise Auto-fix (see below). Rewording the request in smaller steps also helps a lot. |
Auto-fix, and what it costs#
When a generated script fails, Spredin can hand the error back to the model and ask for a fix. The AUTO-FIX switch above the GEN/RUN keys sets how many times: None, Low (1) or High (3).
- Running locally, retries cost only time. High is free.
- On a paid cloud API, every retry is another billed request — High can cost around three times as much as None for a script that keeps failing.
The first retry recovers most of what is recoverable and later ones add very little, so Low is the good default. If the model gets things wrong often enough that High seems necessary, a better model will help more than more retries will.
Using a hosted service instead#
Everything above is about running the model on your own Mac. The alternative is a hosted service you pay per request. It is faster and sharper; it costs money and your prompt leaves the machine.
Settings → AI model… lists these as one-click presets. Pick one, paste your key, press Test connection, and choose a model from the list it fetches.
| Service | Good for | Key from |
|---|---|---|
| OpenAI | The default everyone knows | platform.openai.com/api-keys |
| Anthropic (Claude) | Long context, careful code | console.anthropic.com |
| Google Gemini | Large free tier to start with | aistudio.google.com/apikey |
| DeepSeek | Strong at code for very little money | platform.deepseek.com |
| Alibaba Qwen | The Qwen models hosted, if you liked them locally | bailian.console.alibabacloud.com |
| Zhipu GLM | open.bigmodel.cn |
|
| Moonshot (Kimi) | platform.moonshot.ai |
|
| Mistral | European hosting | console.mistral.ai |
| Groq | Answers back in about a second | console.groq.com/keys |
| OpenRouter | One key, most models — the cheapest way to try several | openrouter.ai/keys |
If you are not sure which, start with OpenRouter or Gemini. OpenRouter gives you one account that reaches almost every model on this list, so you can compare without signing up ten times; Gemini has the largest free allowance to begin on. For everyday scripting on a budget, DeepSeek is hard to beat.
Two things worth knowing#
Model names change; addresses do not. Spredin ships each service's address, not a fixed list of its models — it asks the service what it currently offers when you press Test connection. The model box is free text, so a model released after your copy of Spredin still works without an update.
In mainland China, Qwen and Kimi have separate domestic addresses
(dashscope.aliyuncs.com and api.moonshot.cn). The endpoint field stays
editable — change the address and everything else is the same.
If you are inside a company#
Anything OpenAI-compatible works, including your own gateway: Azure OpenAI, AWS Bedrock through a proxy, LiteLLM, vLLM on a shared server. Choose Custom, paste the base URL, and add the key your platform team gave you.
Privacy#
This is the difference that matters between the two halves of this page.
With a local server, the prompt, your sheet's structure and the generated
code stay on your Mac — Spredin talks to localhost and nothing else.
With a hosted service, that same context goes to them: the cell values, headers and formulas the request needs in order to answer. That is not a side-effect you can turn off; it is how the feature works. If a workbook is confidential, use a local model for it.
Either way, your API key is stored only in this device's local storage and is
never written into a .sprd workbook file, never sent anywhere except the
service you entered it for, and never bundled into the app — Spredin ships no
key of its own, so every request is billed to your account and nobody else's.
Spredin does not send anything to an AI model unless you press Generate.