Products Marketplace Blog About Contact Sign in Download
Switching AI Providers in lac-cli Without Breaking Everything

Switching AI Providers in lac-cli Without Breaking Everything

lac-cli doesn't lock you to one AI provider. Here's how the config works, when it makes sense to swap between Claude, GPT, and a local Ollama model, and a few gotchas to know before you do.

You don't have to pick one model forever

When I first set up lac-cli, I ran the provider wizard, chose Claude, and kind of forgot the option to change it existed. That worked fine until I started doing work on a client project with strict data handling requirements. Suddenly sending every file diff to Anthropic's API felt wrong. That's when I actually dug into how provider switching works — and it's simpler than I expected.

lac-cli stores all provider config in ~/.lac/config.json. One file. Everything lives there: your active provider, API keys, model names, and any custom endpoint you've pointed it at. You can edit it directly, or you can re-run the setup wizard any time with:

lac shell --setup

That walks you through picking a provider and entering a key again, same as first run. It overwrites the relevant fields in the config and you're good. No reinstalling, no clearing caches, no weird state left behind.

The four providers and when I actually reach for each

Claude (Anthropic)

This is my default for lac agent tasks — anything involving reading a bunch of files, reasoning about a codebase, or writing code that needs to be correct rather than just plausible. The context window is large enough that I rarely hit limits on real projects, and the responses from lac agent's PlanMode feel more considered than other providers when the task is ambiguous.

Downside: it costs money per token, and if you're running lac mind debates with long rounds, it adds up faster than you'd think.

OpenAI (GPT)

I switch to GPT when I'm doing something fast and conversational in lac shell — quick one-liners, explaining a flag, generating a regex. GPT-4o is snappy and I don't need Claude's depth for that kind of thing. Also useful if you're already deep in the OpenAI ecosystem and want your token usage in one dashboard.

Ollama (local)

This is the one that changes the calculus for privacy-sensitive work. Ollama runs models locally — nothing leaves your machine. I covered the full offline setup in a previous post, but the short version is: install Ollama, pull a model like llama3 or mistral, and set lac shell --offline or configure it as your default provider in the config. Zero API cost, zero data leaving the box.

The tradeoff is speed and capability. A 7B or 13B local model is not going to match Claude on complex multi-file refactors. But for shell autocomplete and quick queries? Totally fine. I run Ollama as my default on my home machine where I do personal projects, and switch to Claude on the work machine.

Custom OpenAI-compatible endpoint

This one's underrated. If your company self-hosts a model behind an OpenAI-compatible API — Groq, Together AI, a private deployment, whatever — you can point lac-cli at it with a custom base URL. Same setup wizard, just enter your endpoint instead of the default. Useful in organizations that have a preferred provider contract or an internal AI gateway.

What the config file actually looks like

I'm not going to tell you to hand-edit ~/.lac/config.json unless you know what you're doing, but understanding the structure is useful. It looks roughly like this:

{
  "provider": "claude",
  "api_key": "sk-ant-...",
  "model": "claude-opus-4-5",
  "custom_base_url": null
}

Switching to OpenAI means changing provider to openai, swapping in an OpenAI key, and updating the model name. Switching to Ollama means setting provider to ollama and clearing the key — local models don't need one.

The cleanest way to do this is still lac shell --setup, which handles validation and won't leave you with a half-broken config. But if you're scripting environments or setting up a new machine from dotfiles, knowing the shape of the file is handy.

Context and memory survive a provider switch

One thing I wasn't sure about the first time I switched: does lac agent's project memory carry over? Yes. The memory lives in .lac-memory.json inside your project directory and has nothing to do with the provider. Switch from Claude to Ollama mid-project and the agent still knows your stack, your conventions, the tasks you've been tracking. The model changes; the context doesn't.

This matters more than it sounds. It means you can start a project with Claude for the heavy architecture work, then switch to a local model for the boring repetitive stuff — adding tests, renaming things, generating boilerplate — without losing any context. I've done this a few times and it works exactly as you'd expect.

One gotcha: model names differ by provider

The setup wizard handles this for you, but if you're editing config manually: model name format is provider-specific. Claude uses names like claude-opus-4-5, OpenAI uses gpt-4o or gpt-4-turbo, Ollama uses whatever you pulled locally (llama3, mistral, codellama, etc.). If you put a Claude model name in an OpenAI config, you'll get an API error, not a helpful message. Just re-run --setup if you're ever in doubt.

The actual point: you're not married to one vendor

A lot of AI tools quietly lock you in. They build around one provider's quirks, one API format, one pricing model. lac-cli doesn't. The "bring your own model" thing in the philosophy isn't just marketing copy — the config is flat, the setup wizard is fast, and swapping providers is something you can actually do in under a minute when the situation calls for it.

For most daily work I stay on Claude. But knowing I can flip to a local Ollama model when I'm working offline, or on something sensitive, or just want to stop burning API credits on a repetitive task — that's the kind of flexibility that actually changes how I work.

Quick reference

  • Re-run provider setup: lac shell --setup
  • Force offline/Ollama for a single session: lac shell --offline
  • Config file location: ~/.lac/config.json
  • Project memory location: .lac-memory.json in your project root
  • Install lac-cli: pip install lac-cli or curl -fsSL https://lacai.io/install.sh | bash

If you haven't tried the Ollama path yet, it's worth an afternoon. Pull mistral or llama3, run lac shell --offline, and just see how far it gets you. You might be surprised how much of your daily terminal work doesn't actually need a frontier model.

We use cookies to keep you signed in and to serve ads via Google AdSense. By continuing to use this site you agree to our Privacy Policy.