Providers & connections
Loach talks to providers over HTTP. When the model dropdown is empty or every request fails, the problem is almost always reachability, authentication or key storage.
Ollama is installed but Loach can’t see it
Test connection in Settings → Providers says Connection failed, the model picker lists Ollama as Not running, or the model dropdown is empty even though ollama list works in a terminal.
- Make sure Ollama is running. If it’s installed on this computer, click Start Ollama in the model picker, or turn on Auto-launch Ollama in Settings → Providers so Loach starts it each time it opens. Otherwise: on Windows, the Ollama tray icon needs to be active; on Linux, the
ollamaservice must be started; on macOS, launch the Ollama menu-bar app or runollama servefrom a terminal. - Open Settings → Providers and check the Ollama base URL. The default is
http://localhost:11434. If you run Ollama on another machine or a custom port, change it here, then click Test connection. A 404 there means the URL has a path on it: use the server’s address alone (http://localhost:11434, not…/v1or…/api). A 401 or 403 comes from a proxy in front of Ollama asking for a login - Loach sends Ollama no credentials, so point it at Ollama directly. - Click Refresh in the Models tab (or the refresh button at the top of the model picker). The list re-queries Ollama’s
/api/tagsendpoint. - If Ollama runs on another host, make sure its firewall allows inbound connections on the chosen port and that
OLLAMA_HOST=0.0.0.0is set on the server side (Ollama binds to localhost by default).
“Start Ollama” shows an error
Clicking Start Ollama in the model picker ends in a red message under the button.
- “Couldn’t find the Ollama executable” - Loach looks for
ollamaon yourPATHand in Ollama’s default install location. Install Ollama, or start it yourself withollama serve. - “… Loach can only start Ollama on this computer” - the base URL points at another machine. Start Ollama there; Loach connects as soon as it answers.
- “Ollama exited immediately” - usually something else is already listening on that port. Run
ollama servein a terminal to see the real error. - “Started Ollama, but it didn’t respond … in time” - the server didn’t answer within 20 seconds. A slow first start can do this; wait a moment and use the picker’s refresh button.
OpenAI says “invalid key” or returns 401
You added an OpenAI-compatible API key but every request fails with 401 (“API key invalid or expired”).
- Re-enter the key under OpenAI API key in Settings → Providers and click Save. Keys are stored in the operating system’s credential store, not on disk. Leading and trailing spaces are trimmed before saving, so a sloppy copy-paste isn’t the problem - a truncated one can be.
- Confirm the key is active on your provider’s dashboard and has not been rotated.
- If you’re using a custom OpenAI-compatible endpoint (vLLM, LM Studio, LiteLLM, OpenRouter, Groq), make sure the API base URL is the one its docs give - usually ending in
/v1(LiteLLM’s ishttp://localhost:4000; the presets dropdown at the end of the field fills in the common ones) - and that the endpoint accepts the sameAuthorization: Bearer …header the real OpenAI API uses. - A server on another machine reached over plain
http://never gets the key: Loach only sends it overhttps://, or overhttp://to this computer, so it can’t be read off the network. Put the server behind HTTPS, or turn off its key requirement if it’s on a network you trust. In a chat, the error then says “API key withheld because the base URL is http:// to another machine” rather than “API key invalid or expired”; Test connection reports it as a plain 401.
An OpenAI chat fails with “HTTP 400 Bad Request”
A chat on an OpenAI-compatible provider fails with OpenAI HTTP 400 Bad Request followed by the server’s own error.
Some models refuse request fields Loach sets on its own - OpenAI’s reasoning models (the o-series, GPT-5) reject max_tokens and any temperature but their default. When the server’s 400 names such a field (max_tokens, temperature, top_p, the frequency or presence penalty, seed or stream_options), Loach adjusts it and retries by itself - max_tokens becomes max_completion_tokens, the others are left out - so those never reach you as an error. A 400 that still shows is about something else: the server’s message after the status says what it refused.
Key won’t save on Linux
Saving the key shows a Couldn’t save API key error, or when you reopen Settings the key field shows the sk-… placeholder instead of •••••••• (stored). (The field itself is always blank - a saved key is never shown back.)
Loach uses the system Secret Service to store secrets. On minimal Linux installs (server-style, some tiling window managers) there is no Secret Service running.
- Install and start gnome-keyring or KWallet - whichever fits your desktop environment.
- Make sure a login session is unlocked so the keyring is available to user processes.
- Re-enter the key. Loach connects to the Secret Service again on each try, so a keyring that started after Loach is picked up without a restart; restart Loach if saving still fails.
On Windows, a key longer than 1,280 characters is refused with OpenAI API key is unusually long (N chars) - refusing to store, because Credential Manager can’t hold it. Check that you copied the key and nothing else.
On a managed Windows machine, see Windows - saving a key or the app lock fails.
Models list shows no models
Ollama is reachable but the list is empty.
You haven’t pulled any models yet. In the Models tab, click Pull model, type a tag (for example llama3.1:8b), and wait for the download to finish. The Models tab refreshes on its own when the download completes; if the chat-header picker doesn’t list the model yet, click the refresh button at the top of its menu.
The API models are missing from the picker
The API group in the model picker says Not connected or No models, it emptied after you cleared your key, or the model you want isn’t listed.
- With the default OpenAI base URL, nothing is listed until a key is saved, and clearing the key empties the list on purpose - those models could only fail at send time. A base URL pointing at your own server is listed with or without a key.
- Run Test connection under the key field to see the endpoint’s own error.
- The picker lists every model the endpoint returns. In a long catalog (OpenRouter, say), scroll the menu or type a model’s first letters to jump to it - or type
/model <name>in the composer. If a model you just added is missing, click the refresh button at the top of the picker’s menu.