Choosing an 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, click the Model field and pick your model from 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.
- Model — click the field: Spredin has already asked the server what it
has, and lists it. Type part of a name to narrow the list (
qwen 8b), then click it or press Return. A name that is not listed is kept as you typed it. - Test connection — if the list stays empty, this says why:
- Connected — N models available → pick one in the Model field.
- 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. |
| No endpoint at … (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. |
| …did not answer within 120 s. It may not be fast enough on this Mac… | the model is too big for this Mac, or it's still loading | The very first request loads the model into memory and can take a minute. Generate sends a long request (over 20,000 tokens: the whole scripting reference), and a large model on a laptop can need several minutes just to read it — longer than Spredin waits. Try a smaller or faster model, or a hosted service. |
| 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 (0), Low (1) or High (3). Settings → AI Model… → Auto-fix rounds sets any number from 0 to 4, and the switch shows the nearest position (Low for 1–2, High for 3–4). A new install starts at 2, shown as Low.
- Running locally, retries cost only time. High is free.
- On a paid cloud API, every retry is another billed request — High can cost up to four times as much as None for a script that keeps failing (the first try plus three retries).
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. Spredin asks your permission the first time it would send anything to one (see Privacy below).
Settings → AI Model… lists these as one-click presets. Pick one, paste your key (OpenRouter: sign in instead — see below), then click the Model field and choose from the service's own list; type to search it.
| 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 account, most models — sign in, no key to copy | Connect with OpenRouter… (or a key from 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.
OpenRouter without a key#
Choose OpenRouter and press Connect with OpenRouter…. Your browser opens OpenRouter's sign-in page; sign in the way your account does (Google, GitHub, email) and approve the request. The browser then says Spredin is connected — close the tab, and Spredin already has its own key, shown as "Spredin" in your OpenRouter account. Nothing to copy or paste.
- The page says
localhost: that is Spredin on your own Mac waiting for the answer. It listens for that one answer and stops. - If the browser never comes back, press Use a code instead: OpenRouter then shows a code after you authorize — paste it into Spredin.
- Disconnect removes the key from this Mac. It stays in your OpenRouter
account until you delete it on its Keys page (
openrouter.ai/settings/keys). - What you spend shows next to Connected; set a limit on the key in your OpenRouter account if you want one.
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 offers now, each
time you choose it (OpenRouter's list is public, so no key is needed to browse
it). Type any words of a name to search, in any order: claude sonnet,
qwen 32b, free. The field still takes any name, so a model released after
your copy of Spredin 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. In Setup, choose Other (OpenAI-compatible), 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 sheet names, cell values, headers and formulas the request needs in order to answer, and the script in the Python panel. 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.
Spredin asks before the first request to a hosted service. The question names the service and its address, says what is sent and that it goes under your own account, and links to the privacy policy:
- Allow sends the request, and is remembered for that service.
- Not Now sends nothing, and the panel says so. The next request asks again.
- A server on this Mac or on your own network (
localhost, a.localname, a private address such as192.168.1.20) is never asked about.
Settings → AI Model… lists the services you allowed, under Data sharing. Withdraw takes a permission back at once; the next request to that service asks again. The policy itself is at Help → Privacy Policy.
Either way, your API key is stored in your Mac's Keychain — encrypted, and
not readable by other apps without your say-so — 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.
If the Keychain will not take the key (a locked keychain, or a refused
prompt), Settings → AI Model… says so: Spredin uses the key until it quits
and keeps it nowhere else, and Save tries the Keychain again.
Spredin sends nothing from your workbook to an AI model unless you press Generate, and nothing from it to a hosted service you have not allowed. Listing a service's models, Test connection and signing in to OpenRouter reach the service with your key and nothing of the workbook, so they do not ask.